/* main.css — DOCSight Dashboard Layout (Mobile-First) */

/* ── PWA offline status ── */
.offline-status-banner {
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  padding: calc(var(--space-xs) + var(--safe-top)) var(--space-md) var(--space-xs);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 36%, var(--glass-border));
  background: color-mix(in srgb, var(--warn) 18%, var(--void-deep));
  color: var(--text-primary);
  font-size: 0.82rem;
}
.offline-status-banner[hidden] { display: none !important; }
.offline-status-banner strong {
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}
.offline-last-known { color: var(--text-muted); }
.is-offline #refresh-btn { opacity: 0.5; cursor: not-allowed; }

/* ── App Layout ── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Mobile Header ── */
.mobile-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(var(--space-sm) + var(--safe-top));
  border-bottom: 1px solid var(--glass-border);
  background: var(--void-deep);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 52px;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-sm);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.hamburger:active { background: var(--border-tint); }
.hamburger svg { width: 22px; height: 22px; }
.mobile-header-title { font-weight: 600; font-size: 0.95rem; }
.mobile-header-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Desktop-only helper ── */
.desktop-only { display: none !important; }
@media (min-width: 1024px) {
  .desktop-only { display: flex !important; }
}

/* ── Sidebar (hidden by default on mobile) ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  max-width: calc(100vw - 56px);
  background-color: var(--void-deep);
  background-image:
    radial-gradient(ellipse at 20% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    radial-gradient(ellipse at 80% 100%, color-mix(in srgb, var(--info) 6%, transparent), transparent 60%);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease-out-expo);
  padding-top: var(--safe-top);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}
.sidebar-header:hover { color: var(--amethyst-light); }
.sidebar-logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo img { width: 32px; height: 32px; }
.sidebar-brand-text { min-width: 0; }
.sidebar-title { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-subtitle { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text-primary);
  cursor: pointer;
}
.sidebar-close svg { width: 18px; height: 18px; }
.sidebar-close:focus-visible { outline: 2px solid var(--amethyst); outline-offset: 2px; }

.sidebar-content {
  flex: 1;
  padding: 0 var(--space-sm);
  display: flex;
  flex-direction: column;
}

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: var(--space-md) var(--space-sm) var(--space-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--tint-hover); color: var(--text-primary); }
.nav-item:active { background: var(--tint-active); }
.nav-item:focus { outline: none; }
.nav-item:focus-visible { outline: 2px solid var(--amethyst); outline-offset: -2px; }
.nav-item.active { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--text-primary); font-weight: 550; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 6px; bottom: 6px;
  width: 3px;
  background: var(--grad-primary);
  border-radius: 2px;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--crit);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  min-width: 18px;
  text-align: center;
}

/* Collapsible nav sections */
.nav-group-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.nav-group-toggle:hover { color: var(--text-secondary); }
.nav-toggle-icon { width: 14px; height: 14px; transition: transform 0.2s ease; }
.nav-section-collapsible .nav-section-items {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.3s var(--ease-out-expo);
}
.nav-section-collapsible.collapsed .nav-section-items {
  max-height: 0;
}
.nav-section-collapsible.collapsed .nav-toggle-icon {
  transform: rotate(-90deg);
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
}
.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.sidebar-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.sidebar-footer a:hover { color: var(--amethyst-light); }
.sidebar-icons {
  display: flex;
  gap: 0;
}
.sidebar-icons a {
  padding: var(--space-sm) 10px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-icons svg { width: 16px; height: 16px; }

/* Dark mode toggle */
.dark-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  min-height: 44px;
}
.dark-toggle-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dark-toggle-label svg { width: 14px; height: 14px; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(120,130,180,0.3);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 4px; bottom: 4px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s var(--ease-smooth);
}
.toggle input:checked + .toggle-slider { background: var(--amethyst); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Backdrop */
.backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  -webkit-tap-highlight-color: transparent;
}

/* ── Main Content (mobile-first) ── */
.app-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
  max-width: 1200px;
  width: 100%;
}

/* ── Offline Indicator ── */
.offline-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px var(--space-md);
  background: var(--warn-muted);
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 500;
}
.offline-banner svg { width: 14px; height: 14px; }
body.is-offline .offline-banner { display: flex; }

/* ── View System ── */
.view { display: none; }
.view.active { display: block; }

/* ── Hero Card ── */
.hero-card {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  animation: staggerIn 0.5s var(--ease-out-expo) both;
}
.hero-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.hero-status {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.hero-icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hero-icon-wrap.good { background: var(--good-muted); color: var(--good); }
.hero-icon-wrap.tolerated { background: var(--tolerated-muted); color: var(--tolerated); }
.hero-icon-wrap.warn { background: var(--warn-muted); color: var(--warn); }
.hero-icon-wrap.crit { background: var(--crit-muted); color: var(--crit); }
.hero-icon-wrap svg { width: 22px; height: 22px; }

.hero-title {
  font-size: clamp(1.25rem, 1rem + 0.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.hero-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.hero-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}
.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 4px 2px;
  transition: color 0.2s;
}
.hero-meta-item:hover {
  color: var(--text-primary);
}
/* Light mode tints handled by token system */
.hero-meta-item svg { width: 13px; height: 13px; opacity: 0.6; }
#desktop-countdown, #topbar-countdown { min-width: 3ch; font-variant-numeric: tabular-nums; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}
.hero-actions .last-update {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.hero-chart-wrap {
  height: 100px;
  position: relative;
}

/* ── Insights Panel (#219) ── */
.insights-panel {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  animation: staggerIn 0.5s var(--ease-out-expo) 0.25s both;
}
.insights-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.insights-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--info-muted);
  color: var(--info);
  flex-shrink: 0;
}
.insights-icon svg { width: 16px; height: 16px; }
.insights-title { font-weight: 600; font-size: 0.9rem; }
.insights-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.insight-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--tint-subtle);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.insight-card:hover { border-color: var(--glass-border); }
.insight-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.insight-icon svg { width: 16px; height: 16px; }
.insight-icon.crit { background: var(--crit-muted); color: var(--crit); }
.insight-icon.warn { background: var(--warn-muted); color: var(--warn); }
.insight-content { flex: 1; min-width: 0; }
.insight-condition {
  font-weight: 550;
  font-size: 0.88rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.insight-explanation {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}
.insight-action {
  font-size: 0.78rem;
  color: var(--info);
  display: flex;
  align-items: center;
  gap: 4px;
}
.insight-action svg { flex-shrink: 0; }
.insights-healthy {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: staggerIn 0.5s var(--ease-out-expo) 0.25s both;
}
.insights-healthy-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--good-muted);
  color: var(--good);
  flex-shrink: 0;
}
.insights-healthy-icon svg { width: 14px; height: 14px; }
.insights-healthy-text { font-size: 0.85rem; color: var(--text-secondary); }
.insights-tolerated {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: staggerIn 0.5s var(--ease-out-expo) 0.25s both;
}
.insights-tolerated-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tolerated-muted);
  color: var(--tolerated);
  flex-shrink: 0;
}
.insights-tolerated-icon svg { width: 14px; height: 14px; }

/* ── Metric Cards ── */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.metric-card {
  padding: var(--space-md);
  animation: staggerIn 0.5s var(--ease-out-expo) both;
}
.metric-card:nth-child(1) { animation-delay: 0.05s; }
.metric-card:nth-child(2) { animation-delay: 0.1s; }
.metric-card:nth-child(3) { animation-delay: 0.15s; }
.metric-card:nth-child(4) { animation-delay: 0.2s; }

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.purple { background: var(--amethyst-muted); color: var(--amethyst-light); }
.metric-icon.blue { background: var(--info-muted); color: var(--info); }
.metric-icon.green { background: var(--good-muted); color: var(--good); }
.metric-icon.amber { background: var(--warn-muted); color: var(--warn); }

.metric-value {
  font-size: clamp(1.6rem, 1.3rem + 0.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.metric-value .unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 3px;
}
.metric-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.metric-spark {
  width: 88px;
  height: 32px;
  flex-shrink: 0;
  opacity: 0.7;
}
@media (max-width: 360px) {
  .metric-spark { display: none; }
}
.metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric-sub .range {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Channel Health Overview (Ring Gauges) ── */
.health-overview {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.health-ring-card {
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: staggerIn 0.5s var(--ease-out-expo) 0.22s both;
}
.health-ring-card:nth-child(2) { animation-delay: 0.28s; }
.ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.ring-wrap canvas { width: 80px; height: 80px; }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-pct {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.ring-label-small {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.ring-details { flex: 1; min-width: 0; }
.ring-title { font-size: 0.9rem; font-weight: 600; margin-bottom: var(--space-xs); }
.ring-legend { display: flex; flex-direction: column; gap: 3px; }
.ring-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.ring-legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ring-legend-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
}

/* Ring tooltip */
.ring-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.ring-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--elevated);
}
.ring-wrap:hover .ring-tooltip,
.ring-wrap:active .ring-tooltip,
.ring-wrap.touched .ring-tooltip { opacity: 1; }

/* ── Channel Tables ── */
.channels-section {
  margin-bottom: var(--space-md);
}
.channel-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  padding-bottom: var(--space-sm);
}
.channel-title { font-size: 0.95rem; font-weight: 600; }
.channel-health-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.health-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 500;
}
.health-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.health-chip .dot.good { background: var(--good); }
.health-chip .dot.tolerated { background: var(--tolerated); }
.health-chip .dot.warn { background: var(--warn); }
.health-chip .dot.crit { background: var(--crit); }

.channel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 520px;
}
.channel-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--glass-bg);
}
.channel-table td {
  padding: 10px var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.channel-table tbody tr { min-height: 44px; }
.channel-table tbody tr:active { background: var(--tint-hover); }
/* Value color utilities (used across channel, BNetzA, speedtest tables) */
.val-good { color: var(--good); }
.val-tolerated { color: var(--tolerated); }
.val-bad { color: var(--crit); }
.val-warn { color: var(--warn); }
.val-crit { color: var(--crit); }
/* Per-metric health coloring via data attributes (channel tables) */
.channel-table td[data-health="good"]      { color: var(--good); }
.channel-table td[data-health="tolerated"] { color: var(--tolerated); }
.channel-table td[data-health="warning"]   { color: var(--warn); }
.channel-table td[data-health="critical"]  { color: var(--crit); }

.channel-table th:first-child,
.channel-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--glass-bg);
  z-index: 1;
}

.docsis-group { padding: var(--space-sm) var(--space-md); }
.docsis-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: var(--space-sm) 0;
  min-height: 44px;
  margin-bottom: var(--space-xs);
  -webkit-tap-highlight-color: transparent;
}
.docsis-group-header:active { opacity: 0.7; }
.docsis-group-header svg { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s; }
.docsis-group.open .docsis-group-header svg { transform: rotate(90deg); }
.docsis-group .table-scroll { display: none; }
.docsis-group.open .table-scroll { display: block; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

.table-scroll-wrapper { position: relative; }
.table-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0; bottom: 6px; right: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--void-deep));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}
.table-scroll-wrapper.scrolled-end::after { opacity: 0; }

/* ── Surface Hierarchy ──
   Hero + health rings keep full glass treatment for visual prominence.
   insights-panel keeps glass to signal urgent health issues.
   Everything else uses quieter surfaces so data speaks louder. */

.metric-card.glass {
  background: var(--elevated);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: var(--glass-border);
}
.metric-card.glass::before { display: none; }

.insights-healthy.glass,
.insights-tolerated.glass {
  background: var(--tint-subtle);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: var(--border-tint);
  border-radius: var(--radius-sm);
}
.insights-healthy.glass::before,
.insights-tolerated.glass::before { display: none; }

.channels-section.glass {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--surface);
}
.channels-section.glass::before { display: none; }


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE -- TABLET & DESKTOP
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  .sidebar {
    background-color: var(--void-deep);
  }
  .sidebar-close {
    display: inline-flex;
  }
  .sidebar-content {
    padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
  }
  .nav-item {
    min-height: 44px;
    white-space: normal;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
  .health-overview { grid-template-columns: 1fr 1fr; }
  .hero-header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  /* .hero-status uses flex-basis: auto (content-based) rather than the
     shorthand `flex: 1` (which expands to `1 1 0%`). With a 0 basis the
     flex algorithm only fed the left column the leftover free space after
     .hero-right took its full content width, which was not enough for the
     hero-title on long health labels such as "Critical" on top of the
     hero-subtitle. An auto basis gives .hero-status its intrinsic content
     width up front, so the available space is shared proportionally
     between both sides during shrink and the hero-title always has room
     to render (reported as issue #336). */
  .hero-status { flex: 1 1 auto; min-width: 0; }
  .hero-right { flex-shrink: 1; min-width: 0; justify-content: flex-end; }
  .hero-meta { min-width: 0; }
  /* .hero-meta keeps its base `flex-wrap: wrap` at this breakpoint. A prior
     `flex-wrap: nowrap` override forced the meta strip onto one line, which
     combined with `.hero-right { flex-shrink: 0 }` and `.hero-status`'s
     0 flex-basis squeezed the left column. Allowing both sides to shrink
     plus letting .hero-meta wrap now produces a balanced two-row meta
     layout on narrow viewports without touching the single-row layout on
     wider desktops, because `flex-wrap: wrap` only wraps when content
     actually overflows. */
  /* hero-title uses clamp() for fluid scaling */
  .hero-chart-wrap { height: 120px; }
  .hero-card { padding: var(--space-lg); }
  .metric-card { padding: var(--space-lg); }
  .metric-spark { width: 120px; height: 40px; }
  /* metric-value uses clamp() for fluid scaling */
  .health-ring-card { padding: var(--space-lg); gap: var(--space-lg); }
  .ring-wrap { width: 100px; height: 100px; }
  .ring-wrap canvas { width: 100px; height: 100px; }
  .ring-pct { font-size: 1.4rem; }
  .ring-title { font-size: 0.95rem; }
  .insights-panel { padding: var(--space-lg); margin-bottom: var(--space-lg); }
  .insights-healthy, .insights-tolerated { padding: var(--space-lg); margin-bottom: var(--space-lg); }
  .channel-header { padding: var(--space-lg) var(--space-lg) var(--space-md); flex-direction: row; align-items: center; justify-content: space-between; }
  .app-main { padding: var(--space-lg); padding-bottom: calc(var(--space-lg) + var(--safe-bottom)); }
}

/* Desktop: sidebar visible, bottom nav hidden */
@media (min-width: 1024px) {
  .mobile-header { display: none; }
  .sidebar {
    transform: translateX(0);
    width: 260px;
    backdrop-filter: blur(32px) saturate(1.2);
    -webkit-backdrop-filter: blur(32px) saturate(1.2);
  }
  .app-main {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
  .hero-card { padding: var(--space-lg); margin-bottom: var(--space-lg); }
  .hero-icon-wrap { width: 48px; height: 48px; }
  .hero-icon-wrap svg { width: 24px; height: 24px; }
  /* hero-title uses clamp() for fluid scaling */
  .metrics-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-md); margin-bottom: var(--space-xl); }
  .health-overview { gap: var(--space-md); margin-bottom: var(--space-2xl); }
  .insights-panel { margin-bottom: var(--space-xl); }
  .insights-healthy, .insights-tolerated { margin-bottom: var(--space-xl); }
  .channels-section { margin-bottom: var(--space-lg); }
  .channel-table tbody tr:hover { background: var(--tint-subtle); }
}

/* Wide desktop: 4-column metrics */
@media (min-width: 1440px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Small phones */
@media (max-width: 360px) {
  .health-ring-card { flex-direction: column; text-align: center; }
  .ring-legend { align-items: center; }
  .gaming-score { order: -1; }
}
