:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --alert-bg: #fee2e2;
  --alert-text: #991b1b;
  --wait-bg: #fef3c7;
  --wait-text: #92400e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.55;
}

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.pulse-dot.online {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.2);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Container & Hero */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 6px;
}

h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-top: 6px;
  max-width: 660px;
}

.status-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Buttons & Inputs */
button {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface-alt);
}

/* Settings Drawer */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
}

.settings-header h2 {
  font-size: 1.05rem;
}

.settings-header p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 4px 0 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  align-items: end;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

input, select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text-main);
  background: var(--surface);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.settings-actions {
  display: flex;
  gap: 8px;
}

/* Alert Banner */
.alert-banner {
  display: none;
  background: var(--alert-bg);
  color: var(--alert-text);
  border: 1px solid #fca5a5;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 700;
  margin-bottom: 22px;
}

/* 4-Card Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-wait { background: var(--wait-bg); color: var(--wait-text); }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-alert { background: var(--alert-bg); color: var(--alert-text); }

.metric-reading {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-val {
  font-size: 2.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-meta {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Trend Charts */
.section-block {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.section-header p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 16px;
}

@media (max-width: 540px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
}

.chart-card h3 {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.chart-frame {
  width: 100%;
  height: 250px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-alt);
}

/* Telemetry Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 28px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
}

/* Architecture & Team */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.info-grid h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.team-intro {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.spec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.spec-list li {
  padding-left: 14px;
  border-left: 3px solid var(--primary);
}

.footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
}