:root {
  --bg: #08111f;
  --panel: #0f1b2d;
  --panel-2: #13233a;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #f3f7ff;
  --muted: #9eb0c8;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

body {
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 14px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  min-width: 58px;
  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 132px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 18px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-title {
  margin: 8px 0 6px;
  font-size: 26px;
  line-height: 1.1;
}

.hero-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 640px;
}

.section-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-badge {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.status-on {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-off {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
}

.stat-value {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
}

.stat-value.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  font-size: 18px;
  line-height: 1;
  width: fit-content;
}

.tabs {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: auto;
  max-width: 952px;
  margin: 0 auto;
  overflow: hidden;
  z-index: 100;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(10, 23, 43, 0.96), rgba(8, 17, 31, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.tabs-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px;
  gap: 10px;
}

.tab-btn {
  height: 64px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tab-btn.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tabs-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-content-card {
  padding: 16px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}

#tab-dashboard .panel-block {
  min-height: 100%;
}

.panel-block {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}

.info-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.message-box {
  margin-top: 10px;
  min-height: 88px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.danger-btn {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}

.activity-title {
  font-weight: 700;
}

.activity-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.footer-card {
  padding: 14px 16px;
}

.footer-note {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .tab-content-card {
    padding: 14px;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 12px 10px 22px;
  }

  .content {
    padding-bottom: 124px;
  }

  .hero-row {
    flex-direction: column;
  }

  .tabs {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px;
  }

  .tabs-header {
    grid-template-columns: repeat(4, 1fr);
    padding: 8px;
    gap: 8px;
  }

  .tab-btn {
    height: 58px;
    font-size: 13px;
    border-radius: 18px;
  }

  .tabs-body {
    gap: 14px;
  }

  .tab-content-card {
    padding: 14px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 22px;
  }
}