:root {
  --bg: #0c1831;
  --bg-soft: #122143;
  --panel: rgba(14, 29, 58, 0.94);
  --panel-strong: rgba(12, 24, 49, 0.96);
  --border: rgba(82, 128, 210, 0.34);
  --border-strong: rgba(102, 157, 255, 0.55);
  --text: #eff4ff;
  --muted: #8fa4cf;
  --cyan: #4fc3ff;
  --green: #2ac57a;
  --orange: #ff9636;
  --purple: #747cff;
  --danger: #ff6b7f;
  --warning: #ffb24d;
  --shadow: 0 18px 50px rgba(2, 8, 22, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(79, 195, 255, 0.09), transparent 24%),
    radial-gradient(circle at 80% 15%, rgba(116, 124, 255, 0.08), transparent 18%),
    linear-gradient(180deg, #132246 0%, #0a1429 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background:
    linear-gradient(135deg, transparent 0 62%, rgba(255, 255, 255, 0.03) 62% 62.4%, transparent 62.4%) 0 0 / 320px 320px,
    linear-gradient(45deg, transparent 0 75%, rgba(255, 255, 255, 0.025) 75% 75.3%, transparent 75.3%) 100% 0 / 420px 420px;
}

.page-shell {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-card,
.stat-card,
.panel,
.system-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 24px 22px 26px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 24%, rgba(79, 195, 255, 0.16), transparent 0 14%, transparent 14%),
    linear-gradient(180deg, rgba(18, 33, 67, 0.98), rgba(10, 20, 41, 0.98));
  margin-bottom: 18px;
}

.hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.hero-content {
  min-width: 0;
}

.hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 40%),
    linear-gradient(180deg, transparent 70%, rgba(79, 195, 255, 0.05));
  pointer-events: none;
}

.eyebrow,
.panel-kicker,
.card-label,
.card-foot {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.eyebrow,
.panel-kicker,
.card-label {
  color: #7fb7ea;
  font-size: 0.72rem;
}

.eyebrow {
  margin: 0 0 10px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 800;
}

.hero-copy {
  margin: 10px 0 18px;
  color: #d9e5ff;
  font-size: 0.95rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.hero-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-pill {
  background: rgba(42, 197, 122, 0.16);
  color: #7ff0b1;
}

.hero-pill.is-warning,
.status-badge.is-warning {
  color: #ffd79d;
  background: rgba(255, 178, 77, 0.12);
}

.hero-pill.is-danger,
.status-badge.is-danger {
  color: #ff9baa;
  background: rgba(255, 107, 127, 0.14);
}

.hero-meta-text {
  color: #b8caef;
  font-size: 0.94rem;
}

.dashboard {
  display: grid;
  gap: 16px;
}

.system-card {
  position: relative;
  overflow: hidden;
  padding: 10px 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(184, 255, 255, 0.1), rgba(127, 211, 220, 0.06)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(163, 236, 244, 0.38);
  box-shadow: 0 18px 40px rgba(2, 8, 22, 0.28);
  backdrop-filter: blur(14px);
}

.system-card-header {
  min-height: 100%;
}

.stat-card:hover,
.stat-card:focus-visible,
.panel:hover,
.panel:focus-visible,
.system-card:hover,
.system-card:focus-visible {
  transform: scale(1.035);
  box-shadow: 0 22px 60px rgba(2, 8, 22, 0.48);
  border-color: var(--border-strong);
}

.stat-card:active,
.panel:active,
.system-card:active {
  transform: scale(1.025);
}

.system-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.22), transparent 36%),
    linear-gradient(135deg, transparent 0 35%, rgba(255, 255, 255, 0.05) 35% 36%, transparent 36% 64%, rgba(255, 255, 255, 0.04) 64% 65%, transparent 65%);
  pointer-events: none;
}

.system-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
}

.system-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 0 2px;
  border-top: 1px solid rgba(207, 247, 251, 0.18);
}

.system-item:first-child {
  border-top: 0;
}

.system-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #daf5fb;
}

.system-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(194, 241, 247, 0.28);
}

.system-item strong {
  color: #eefbff;
  font-size: 0.94rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.stat-card {
  min-height: 130px;
  padding: 10px 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(18, 33, 67, 0.98), rgba(13, 26, 52, 0.98));
}

.stat-card-accent {
  border-top-color: rgba(255, 150, 54, 0.72);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 6px;
}

.stat-value {
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.card-foot {
  margin: 0;
  color: #d4def4;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.status-badge {
  min-height: 24px;
  padding: 0 10px;
  font-size: 0.62rem;
  color: #85efb4;
  background: rgba(42, 197, 122, 0.12);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.panel {
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(18, 33, 67, 0.98), rgba(10, 20, 41, 0.98));
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-kicker {
  margin: 0 0 6px;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.legend-item {
  position: relative;
  padding-left: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.legend-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-panel::before {
  background: var(--orange);
}

.legend-battery::before {
  background: var(--purple);
}

.main-chart {
  display: block;
  width: 100%;
  height: auto;
}

.history-head {
  align-items: center;
}

.refresh-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(96, 142, 224, 0.35);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 0 12px;
  text-align: left;
  color: #90a4cf;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid rgba(104, 139, 201, 0.24);
}

tbody td {
  padding: 12px 0;
  color: #e5eeff;
  font-size: 0.83rem;
  border-bottom: 1px solid rgba(104, 139, 201, 0.16);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

@media (max-width: 1080px) {
  .hero-layout,
  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
  }

  .hero-card,
  .stat-card,
  .panel {
    border-radius: 16px;
  }

  thead th,
  tbody td {
    white-space: nowrap;
  }
}
