/* R76S dashboard typography and readability layer.
 * Loaded after the generated Vite stylesheet so the production bundle remains
 * immutable and this adjustment stays easy to audit or remove.
 */

/* Industrial instrumentation palette: neutral graphite surfaces, restrained
 * steel blue for navigation/data, amber for attention, and green only for
 * explicit healthy/connected states. */
:root,
:root[data-theme="light"] {
  --bg: #eef1f4;
  --surface: #f8f9fa;
  --surface-strong: #ffffff;
  --surface-muted: #e7ebef;
  --ink: #171c22;
  --ink-soft: #525c67;
  --ink-faint: #626c77;
  --line: #d3d9df;
  --line-strong: #b7c0c9;
  --accent: #3f6f9c;
  --accent-soft: #e1eaf2;
  --violet: #6f668e;
  --amber: #9b6c2f;
  --blue: #51779c;
  --danger: #b9534e;
  --ok: #3f825c;
  --shadow: 0 18px 44px rgb(32 43 54 / 10%);
  --chart-teal: #3f6f9c;
  --chart-violet: #6f668e;
  --chart-amber: #9b6c2f;
  --chart-blue: #51779c;
  --chart-secondary: #6f668e;
  --chart-grid: rgb(82 92 103 / 16%);
  --sidebar: #171b20;
  --sidebar-ink: #f0f2f4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1014;
    --surface: #14191f;
    --surface-strong: #1a2027;
    --surface-muted: #202730;
    --ink: #f0f2f4;
    --ink-soft: #aab2bc;
    --ink-faint: #727d88;
    --line: #2b333d;
    --line-strong: #414c58;
    --accent: #5f8fbd;
    --accent-soft: #1b2a39;
    --violet: #8a7fa8;
    --amber: #c4944e;
    --blue: #6d91b8;
    --danger: #d06a63;
    --ok: #69a27d;
    --shadow: 0 20px 50px rgb(0 0 0 / 30%);
    --chart-teal: #5f8fbd;
    --chart-violet: #8a7fa8;
    --chart-amber: #c4944e;
    --chart-blue: #6d91b8;
    --chart-secondary: #8a7fa8;
    --chart-grid: rgb(170 178 188 / 12%);
    --sidebar: #0b0e12;
    --sidebar-ink: #eef1f4;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1014;
  --surface: #14191f;
  --surface-strong: #1a2027;
  --surface-muted: #202730;
  --ink: #f0f2f4;
  --ink-soft: #aab2bc;
  --ink-faint: #727d88;
  --line: #2b333d;
  --line-strong: #414c58;
  --accent: #5f8fbd;
  --accent-soft: #1b2a39;
  --violet: #8a7fa8;
  --amber: #c4944e;
  --blue: #6d91b8;
  --danger: #d06a63;
  --ok: #69a27d;
  --shadow: 0 20px 50px rgb(0 0 0 / 30%);
  --chart-teal: #5f8fbd;
  --chart-violet: #8a7fa8;
  --chart-amber: #c4944e;
  --chart-blue: #6d91b8;
  --chart-secondary: #8a7fa8;
  --chart-grid: rgb(170 178 188 / 12%);
  --sidebar: #0b0e12;
  --sidebar-ink: #eef1f4;
}

:root {
  --type-micro: clamp(11px, 0.18vw + 9px, 12px);
  --type-caption: clamp(12px, 0.18vw + 10px, 13px);
  --type-small: clamp(13px, 0.2vw + 10px, 14px);
  --type-body: clamp(15px, 0.22vw + 11px, 16px);
  --type-emphasis: clamp(16px, 0.25vw + 12px, 18px);
}

body {
  font-size: 16px;
  line-height: 1.5;
}

.live-state.connected i,
.state.is-ok i {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 14%, transparent);
}

.state.is-ok i {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 13%, transparent);
}

.hero-status {
  color: var(--ok);
}

.pulse {
  background: var(--ok);
}

.pulse::after {
  border-color: var(--ok);
}

.insight.success {
  border-color: var(--ok);
}

.insight.success > i {
  color: var(--ok);
}

/* Navigation and persistent chrome */
.brand small {
  font-size: var(--type-micro);
}

.sidebar nav a {
  font-size: var(--type-small);
}

.sidebar nav a span,
.sidebar-foot small {
  font-size: var(--type-micro);
}

.eyebrow {
  font-size: var(--type-micro);
  line-height: 1.35;
}

.live-state,
.flat-button,
.hero-status,
.state {
  font-size: var(--type-caption);
}

/* Overview */
.hero-section {
  min-height: 330px;
  padding-block: 42px 34px;
}

.hero-copy {
  max-width: 900px;
}

.hero-copy > p {
  max-width: 860px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(18px, 1.35vw, 24px);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.55;
}

.hero-facts span,
.health-orbit span,
.health-list span {
  font-size: var(--type-caption);
}

.hero-facts strong {
  font-size: var(--type-emphasis);
}

.health-list strong {
  font-size: var(--type-body);
}

.metric-head h3,
.panel-title h3 {
  font-size: var(--type-body);
}

.metric-main span,
.panel-title span {
  font-size: var(--type-caption);
  line-height: 1.45;
}

/* The headline percentage already communicates the current value. Keep only
 * the historical sparkline in overview metric cards to avoid a redundant bar. */
.metric-card > .progress-track {
  display: none;
}

.metric-card > .sparkline {
  margin-top: 12px;
}

.section-head p:not(.eyebrow) {
  font-size: var(--type-small);
  line-height: 1.7;
}

/* Hardware cards */
.spec-list dt,
.mini-specs dt,
.compute-subhead span,
.core-load span,
.cluster-frequency-grid span,
.accelerator-list span {
  font-size: var(--type-caption);
}

.spec-list dd,
.mini-specs dd,
.compute-subhead strong,
.core-load strong,
.cluster-frequency-grid strong,
.accelerator-list strong {
  font-size: var(--type-small);
}

.core-load small,
.cluster-frequency-grid small,
.accelerator-list small,
.thermal-grid span,
.emmc-main span {
  font-size: var(--type-micro);
  line-height: 1.4;
}

/* Network and service rows */
.network-numbers span,
.network-numbers small,
.connectivity-strip > div > span:last-child {
  font-size: var(--type-caption);
  line-height: 1.45;
}

.service-header {
  font-size: var(--type-micro);
}

.service-icon {
  font-size: var(--type-small);
}

.service-row {
  min-height: 78px;
}

.service-row strong {
  font-size: var(--type-small);
}

.service-row small {
  font-size: var(--type-micro);
  line-height: 1.4;
}

.service-row p {
  font-size: var(--type-caption);
  line-height: 1.65;
}

/* Traffic policy: the information-dense area needs a higher readability floor. */
.routing-flow {
  gap: clamp(20px, 1.8vw, 32px);
}

.flow-column {
  gap: 10px;
}

.flow-node {
  padding: 18px;
}

.flow-node strong {
  font-size: var(--type-body);
}

.flow-node > div span,
.flow-node small {
  font-size: var(--type-caption);
}

.flow-node small {
  line-height: 1.45;
}

.flow-node p {
  margin-top: 11px;
  font-size: var(--type-small);
  line-height: 1.6;
}

.flow-node em {
  padding: 5px 8px;
  font-size: var(--type-micro);
}

.flow-node.is-final > div {
  padding-right: 86px;
}

.rule-engine span,
.rule-engine small {
  font-size: var(--type-micro);
  line-height: 1.35;
}

.rule-list div {
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 12px;
}

.rule-list span,
.rule-list small {
  font-size: var(--type-micro);
  line-height: 1.35;
}

.rule-list strong {
  font-size: var(--type-caption);
  line-height: 1.4;
}

.policy-meta {
  padding: 12px 14px;
  font-size: var(--type-caption);
  line-height: 1.4;
}

.dns-card {
  padding: 18px;
}

.dns-card > div {
  padding: 10px 0;
}

.dns-card strong,
.dns-card span {
  font-size: var(--type-small);
}

.dns-card small {
  font-size: var(--type-micro);
  line-height: 1.4;
}

.route-row strong,
.route-row span,
.route-row small {
  font-size: var(--type-caption);
  line-height: 1.4;
}

.route-header span {
  font-size: var(--type-micro);
}

.insight > i {
  font-size: var(--type-caption);
}

.insight strong,
.security-note strong {
  font-size: var(--type-small);
}

.insight p,
.security-note p {
  font-size: var(--type-caption);
  line-height: 1.6;
}

/* The route table becomes the sole secondary routing panel. */
.insight-panel {
  display: none !important;
}

.route-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.route-table {
  min-width: 0;
}

footer {
  font-size: var(--type-micro);
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .routing-flow {
    gap: 18px;
  }

  .flow-core {
    grid-template-columns: 160px 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --type-micro: 11px;
    --type-caption: 12px;
    --type-small: 13px;
    --type-body: 15px;
    --type-emphasis: 16px;
  }

  .sidebar nav a {
    font-size: 12px;
  }

  .hero-copy > p {
    font-size: 18px;
    line-height: 1.6;
  }

  .service-row {
    min-height: auto;
  }

  .flow-node {
    padding: 16px;
  }

  .flow-core {
    grid-template-columns: 1fr;
  }

  .rule-list div {
    grid-template-columns: 26px 1fr auto;
    padding-inline: 10px;
  }
}


/* Connectivity explanations and upstream latency */
.connectivity-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.connectivity-strip > div > span:last-child {
  line-height: 1.55;
}
@media (max-width: 1100px) {
  .connectivity-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .connectivity-strip > div {
    border-top: 1px solid var(--line);
  }
  .connectivity-strip > div:nth-child(-n + 2) {
    border-top: 0;
  }
  .connectivity-strip > div:nth-child(odd) {
    border-left: 0;
  }
}
@media (max-width: 640px) {
  .connectivity-strip {
    grid-template-columns: 1fr;
  }
  .connectivity-strip > div,
  .connectivity-strip > div:nth-child(-n + 2) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .connectivity-strip > div:first-child {
    border-top: 0;
  }
}


/* Keep connectivity explanations on one line */
.connectivity-strip > div {
  min-width: 0;
  padding-inline: 14px;
}
.connectivity-strip > div > span:last-child {
  white-space: nowrap;
  font-size: clamp(10px, 0.78vw, var(--type-caption));
}
@media (max-width: 1100px) {
  .connectivity-strip > div > span:last-child {
    font-size: var(--type-caption);
  }
}


/* Highlight the native Google URL latency on the final encrypted outbound. */
.flow-node .urltest-latency {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  width: fit-content;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft);
  color: var(--ink);
  font-size: clamp(12px, 0.92vw, 14px);
  font-weight: 800;
  font-family: inherit;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-node .urltest-latency::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

/* UI/UX Pro Max refinement: compact observability console
 * - restrained industrial palette instead of generic saturated dashboard hues
 * - 16 px readable body floor with a consistent type scale
 * - stronger information hierarchy and denser, responsive instrumentation grid
 * - no external fonts, animation libraries, images or additional runtime writes
 */
:root,
:root[data-theme="light"] {
  --bg: #edf1f4;
  --surface: #f7f9fa;
  --surface-strong: #ffffff;
  --surface-muted: #e8edf1;
  --ink: #16212a;
  --ink-soft: #4b5b68;
  --ink-faint: #687783;
  --line: #d0d9e0;
  --line-strong: #aebbc5;
  --accent: #416f94;
  --accent-soft: #dfe9f1;
  --violet: #756f91;
  --amber: #9a702f;
  --blue: #527b9f;
  --danger: #b64f4a;
  --ok: #3d7f5b;
  --shadow: 0 12px 34px rgb(36 54 68 / 9%);
  --chart-teal: #416f94;
  --chart-violet: #756f91;
  --chart-amber: #9a702f;
  --chart-blue: #527b9f;
  --chart-secondary: #756f91;
  --chart-grid: rgb(75 91 104 / 16%);
  --sidebar: #121920;
  --sidebar-ink: #f2f5f7;
  --sidebar-muted: #91a0ab;
  --focus-ring: #5d8eb5;
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 15px;
  --sidebar-width: 224px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1015;
    --surface: #121920;
    --surface-strong: #18212a;
    --surface-muted: #1d2731;
    --ink: #f1f4f6;
    --ink-soft: #b0bbc4;
    --ink-faint: #83919d;
    --line: #293641;
    --line-strong: #42515e;
    --accent: #6f9bc0;
    --accent-soft: #1a2b39;
    --violet: #9188a9;
    --amber: #c29a5a;
    --blue: #7699b9;
    --danger: #d16b64;
    --ok: #6eaa84;
    --shadow: 0 16px 44px rgb(0 0 0 / 28%);
    --chart-teal: #6f9bc0;
    --chart-violet: #9188a9;
    --chart-amber: #c29a5a;
    --chart-blue: #7699b9;
    --chart-secondary: #9188a9;
    --chart-grid: rgb(176 187 196 / 13%);
    --sidebar: #080d12;
    --sidebar-ink: #f2f5f7;
    --sidebar-muted: #8796a2;
    --focus-ring: #8bb6d9;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1015;
  --surface: #121920;
  --surface-strong: #18212a;
  --surface-muted: #1d2731;
  --ink: #f1f4f6;
  --ink-soft: #b0bbc4;
  --ink-faint: #83919d;
  --line: #293641;
  --line-strong: #42515e;
  --accent: #6f9bc0;
  --accent-soft: #1a2b39;
  --violet: #9188a9;
  --amber: #c29a5a;
  --blue: #7699b9;
  --danger: #d16b64;
  --ok: #6eaa84;
  --shadow: 0 16px 44px rgb(0 0 0 / 28%);
  --chart-teal: #6f9bc0;
  --chart-violet: #9188a9;
  --chart-amber: #c29a5a;
  --chart-blue: #7699b9;
  --chart-secondary: #9188a9;
  --chart-grid: rgb(176 187 196 / 13%);
  --sidebar: #080d12;
  --sidebar-ink: #f2f5f7;
  --sidebar-muted: #8796a2;
  --focus-ring: #8bb6d9;
}

html {
  scrollbar-color: var(--line-strong) var(--bg);
}

body {
  min-width: 320px;
  font-family: "Segoe UI Variable Text", "Segoe UI", "PingFang SC",
    "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.005em;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.mono,
.hero-facts strong,
.metric-main strong,
.network-numbers strong,
.emmc-main strong,
.rule-engine strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums slashed-zero;
}

/* Persistent navigation */
.sidebar {
  width: var(--sidebar-width);
  padding: 30px 24px 26px;
  border-right-color: rgb(255 255 255 / 7%);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--accent) 56%, white 8%);
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 88%, #fff 12%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 16%);
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0.13em;
}

.brand small {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.sidebar nav {
  gap: 7px;
  margin-top: 64px;
}

.sidebar nav a {
  min-height: 48px;
  padding: 12px 13px;
  border-left-width: 3px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--sidebar-muted);
  font-size: 15px;
}

.sidebar nav a span {
  width: 26px;
  color: color-mix(in srgb, var(--sidebar-muted) 62%, transparent);
  font-size: 12px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgb(255 255 255 / 5%);
  color: var(--sidebar-ink);
}

.sidebar-foot {
  padding-top: 18px;
}

.sidebar-foot small {
  color: var(--sidebar-muted);
  font-size: 12px;
}

main {
  width: calc(100% - var(--sidebar-width));
  max-width: none;
  margin-left: var(--sidebar-width);
  padding-right: clamp(24px, 3.2vw, 62px);
  padding-left: clamp(24px, 3.2vw, 62px);
}

/* Header and overview */
.topbar {
  min-height: 84px;
}

.topbar h1 {
  font-size: 20px;
  letter-spacing: -0.015em;
}

.topbar .eyebrow {
  margin-bottom: 5px;
}

.flat-button,
.icon-button {
  min-width: 44px;
  height: 44px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.flat-button {
  padding-inline: 14px;
  font-size: 13px;
}

.live-state {
  font-size: 13px;
}

.hero-section {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
  gap: clamp(28px, 4vw, 64px);
  min-height: 292px;
  padding-block: 34px 30px;
}

.hero-copy {
  max-width: 980px;
}

.hero-status {
  margin-bottom: 14px;
  font-size: 13px;
}

.hero-copy > p {
  max-width: 980px;
  color: var(--ink);
  font-size: clamp(18px, 1.25vw, 22px);
  font-weight: 620;
  line-height: 1.55;
  text-wrap: balance;
}

.hero-facts {
  margin-top: 24px;
}

.hero-facts div {
  min-width: 170px;
  padding-inline: 24px;
}

.hero-facts span {
  margin-bottom: 6px;
  font-size: 13px;
}

.hero-facts strong {
  font-size: clamp(16px, 1.05vw, 18px);
}

.health-panel {
  grid-template-columns: 148px minmax(100px, 1fr);
  justify-items: start;
  gap: 24px;
  padding: 16px 0;
}

.health-orbit {
  width: 148px;
  height: 148px;
  padding: 9px;
  box-shadow: none;
}

.health-orbit::before {
  width: 128px;
  height: 128px;
}

.health-orbit strong {
  font-size: 48px;
  font-weight: 550;
}

.health-orbit span {
  margin-top: 5px;
  font-size: 12px;
}

.health-list {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.health-list div {
  min-width: 104px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.health-list div:first-child {
  border-top: 0;
}

.health-list span {
  font-size: 12px;
}

.health-list strong {
  margin-top: 3px;
  font-size: 15px;
}

/* KPI instruments */
.metric-grid {
  gap: 14px;
}

.metric-card,
.panel,
.connectivity-strip {
  border-color: var(--line);
  border-radius: var(--radius-md);
}

.metric-card,
.panel {
  box-shadow: 0 1px 0 rgb(255 255 255 / 3%), var(--shadow);
}

.metric-card {
  min-height: 246px;
  padding: clamp(20px, 1.6vw, 26px);
  overflow: hidden;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.metric-card:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface) 90%, var(--surface-strong));
}

.metric-head h3,
.panel-title h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.metric-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
}

.metric-main {
  margin: 28px 0 16px;
}

.metric-main strong {
  font-size: clamp(40px, 3vw, 52px);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.metric-main span {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: clamp(13px, 0.9vw, 15px);
  line-height: 1.45;
  min-height: 2.9em;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.metric-card > .sparkline {
  height: 64px;
  margin-top: 12px;
}

/* Section rhythm and panels */
.section-block {
  padding-top: clamp(64px, 5vw, 84px);
}

.section-head {
  margin-bottom: 22px;
}

.section-head h2 {
  font-size: clamp(28px, 2.35vw, 38px);
}

.section-head p:not(.eyebrow) {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.65;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
}

.panel {
  padding: clamp(22px, 1.8vw, 30px);
}

.panel-title {
  margin-bottom: 22px;
}

.panel-title span,
.state {
  font-size: 13px;
}

.hardware-layout {
  gap: 14px;
}

.spec-panel {
  grid-column: span 4;
}

.frequency-panel {
  grid-column: span 8;
}

.thermal-panel {
  grid-column: span 8;
}

.emmc-panel {
  grid-column: span 4;
}

.spec-list div,
.mini-specs div {
  grid-template-columns: minmax(90px, 0.72fr) minmax(0, 1.4fr);
  padding-block: 13px;
}

.spec-list dt,
.mini-specs dt,
.compute-subhead span,
.core-load span,
.cluster-frequency-grid span,
.accelerator-list span {
  font-size: 13px;
}

.spec-list dd,
.mini-specs dd,
.compute-subhead strong,
.core-load strong,
.cluster-frequency-grid strong,
.accelerator-list strong {
  font-size: 14px;
}

.core-load {
  padding: 12px;
  border-radius: var(--radius-sm);
}

.core-load small,
.cluster-frequency-grid small,
.accelerator-list small {
  font-size: 12px;
}

.cluster-frequency-grid > div {
  border-left-color: var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
}

.thermal-grid {
  gap: 10px;
}

.thermal-grid > div {
  min-height: 160px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: var(--radius-sm);
}

.thermal-grid span {
  font-size: 12px;
}

.thermal-grid strong {
  font-size: 22px;
  font-weight: 600;
}

.emmc-main strong {
  font-size: clamp(38px, 3vw, 48px);
  font-weight: 600;
}

.emmc-main span {
  font-size: 13px;
}

/* Network observability */
.network-panel {
  padding: clamp(24px, 2vw, 32px) clamp(24px, 2vw, 34px) 20px;
}

.network-numbers span,
.network-numbers small {
  font-size: 13px;
}

.network-numbers strong {
  font-size: clamp(24px, 2vw, 31px);
  font-weight: 620;
}

.network-panel .sparkline {
  height: 168px;
}

.connectivity-strip {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  overflow: hidden;
}

.connectivity-strip > div {
  min-height: 90px;
  padding: 18px clamp(14px, 1.3vw, 22px);
}

.connectivity-strip > div > span:last-child {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: clamp(12px, 0.72vw, 14px);
  line-height: 1.5;
}

/* Services */
.service-table {
  border-radius: var(--radius-md);
}

.service-row {
  min-height: 74px;
  padding-inline: 22px;
}

.service-header {
  min-height: 46px;
  font-size: 12px;
}

.service-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 14px;
}

.service-row strong {
  font-size: 14px;
}

.service-row small {
  font-size: 12px;
}

.service-row p {
  font-size: 13px;
}

/* Routing map */
.routing-flow {
  grid-template-columns: minmax(230px, 0.95fr) minmax(310px, 1.2fr) minmax(230px, 0.95fr);
  gap: clamp(20px, 2vw, 34px);
  padding: clamp(24px, 2.2vw, 36px);
}

.flow-column {
  gap: 12px;
}

.flow-node,
.rule-list,
.dns-card {
  border-radius: var(--radius-sm);
}

.flow-node {
  padding: 17px 18px;
}

.flow-node strong {
  font-size: 15px;
}

.flow-node > div span,
.flow-node small {
  font-size: 12px;
}

.flow-node p {
  margin-top: 10px;
  font-size: 13px;
}

.flow-node em {
  padding: 6px 9px;
  border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
  color: #0b1116;
  font-size: 11px;
}

.rule-engine {
  width: 138px;
  height: 138px;
  box-shadow: inset 0 0 0 7px color-mix(in srgb, var(--accent) 8%, transparent);
}

.rule-engine span,
.rule-engine small {
  font-size: 12px;
}

.rule-engine strong {
  font-size: 42px;
  font-weight: 550;
}

.rule-list div {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 14px;
}

.rule-list span,
.rule-list small {
  font-size: 12px;
}

.rule-list strong {
  font-size: 13px;
}

.policy-meta {
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 13px;
}

.dns-card {
  margin-top: 0;
  padding: 18px;
}

.dns-card strong,
.dns-card span {
  font-size: 13px;
}

.dns-card small {
  font-size: 12px;
}

.flow-node .urltest-latency {
  margin-top: 11px;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.route-layout {
  margin-top: 14px;
}

.route-row {
  padding-block: 14px;
}

.route-row strong,
.route-row span,
.route-row small {
  font-size: 13px;
}

.route-header span {
  font-size: 12px;
}

footer {
  margin-top: 64px;
  padding-top: 22px;
  font-size: 12px;
}

@media (min-width: 1900px) {
  :root {
    --sidebar-width: 246px;
  }

  .sidebar {
    padding-inline: 30px;
  }

  .metric-grid {
    gap: 18px;
  }

  .metric-card {
    min-height: 266px;
  }

  .metric-card > .sparkline {
    height: 72px;
  }

  .connectivity-strip > div > span:last-child {
    white-space: nowrap;
  }
}

@media (max-width: 1480px) {
  .hero-section {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
  }

  .health-panel {
    grid-template-columns: 132px minmax(96px, 1fr);
    gap: 18px;
  }

  .health-orbit {
    width: 132px;
    height: 132px;
  }

  .health-orbit::before {
    width: 112px;
    height: 112px;
  }

  .health-orbit strong {
    font-size: 42px;
  }

  .connectivity-strip > div > span:last-child {
    white-space: normal;
  }
}

@media (max-width: 1180px) {
  .spec-panel,
  .frequency-panel,
  .thermal-panel,
  .emmc-panel {
    grid-column: 1 / -1;
  }

  .routing-flow {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .flow-core {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .connectivity-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connectivity-strip > div:nth-child(odd) {
    border-left: 0;
  }

  .connectivity-strip > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    width: auto;
    height: 66px;
    padding: 10px 16px;
  }

  .sidebar nav {
    margin-top: 0;
  }

  .sidebar nav a {
    min-height: 44px;
    border-radius: var(--radius-sm);
  }

  main {
    width: 100%;
    margin-left: 0;
    padding-inline: clamp(18px, 3.4vw, 30px);
  }

  .hero-section {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .health-panel {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .health-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-self: center;
  }

  .health-list div,
  .health-list div:first-child {
    min-width: 0;
    padding: 8px 12px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .health-list div:first-child {
    border-left: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --type-micro: 12px;
    --type-caption: 13px;
    --type-small: 14px;
    --type-body: 16px;
    --type-emphasis: 17px;
  }

  .brand strong {
    font-size: 14px;
  }

  .sidebar nav a {
    min-height: 42px;
    padding-inline: 9px;
    font-size: 12px;
  }

  .topbar {
    min-height: 72px;
  }

  .hero-section {
    padding-top: 32px;
  }

  .hero-copy > p {
    font-size: 18px;
  }

  .hero-facts div {
    padding-inline: 12px;
  }

  .health-panel {
    grid-template-columns: 1fr;
  }

  .health-list {
    width: 100%;
  }

  .metric-card {
    min-height: 236px;
  }

  .metric-main strong {
    font-size: 44px;
  }

  .section-block {
    padding-top: 60px;
  }

  .panel,
  .network-panel,
  .routing-flow {
    padding: 18px;
  }

  .connectivity-strip {
    grid-template-columns: 1fr;
  }

  .connectivity-strip > div,
  .connectivity-strip > div:nth-child(-n + 2) {
    min-height: 78px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .connectivity-strip > div:first-child {
    border-top: 0;
  }

  .routing-flow {
    grid-template-columns: 1fr;
  }

  .flow-core {
    grid-template-columns: 1fr;
  }
}

/* Align both hardware rows to the same 4 + 8 column rhythm on desktop:
 * core specs / compute units above, eMMC / thermal sensors below. */
.emmc-panel {
  order: 3;
}

.thermal-panel {
  order: 4;
}

@media (min-width: 1181px) {
  .emmc-panel {
    grid-column: 1 / span 4;
    grid-row: 2;
  }

  .thermal-panel {
    grid-column: 5 / span 8;
    grid-row: 2;
  }
}

/* Keep the routing diagram semantically honest: the cards are not linked
 * one-to-one, and the kernel's TUN route-table details are not split rules. */
.routing-flow .flow-node::after,
.routing-flow .policy-meta {
  display: none !important;
  content: none !important;
}

/* Routing flow v2: present the real hierarchy as three ordered groups instead
 * of three uneven vertical columns. This keeps every item aligned without
 * implying one-to-one links between inbounds, rules and outbounds. */
.routing-flow {
  grid-template-areas:
    "inbounds"
    "rules"
    "outbounds";
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(26px, 2.4vw, 38px);
  align-items: start;
}

.routing-flow > .flow-column:not(.outbound-column) {
  grid-area: inbounds;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.routing-flow > .flow-column > .eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 4px;
}

.routing-flow > .flow-column:not(.outbound-column) .flow-node {
  grid-column: span 2;
  min-height: 150px;
  height: 100%;
}

.flow-core {
  grid-area: rules;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
}

.rule-engine {
  width: 100%;
  height: auto;
  min-height: 76px;
  margin: 0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
}

.rule-engine span,
.rule-engine small {
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.06em;
}

.rule-engine strong {
  font-size: 36px;
  line-height: 1;
}

.rule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.rule-list div,
.rule-list div:first-child {
  min-height: 56px;
  border-top: 0;
}

.rule-list div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.rule-list div:nth-child(even) {
  border-left: 1px solid var(--line);
}

.rule-list small {
  white-space: nowrap;
}

.outbound-column {
  grid-area: outbounds;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.outbound-column .flow-node,
.outbound-column .dns-card {
  min-height: 190px;
  height: 100%;
  margin-top: 0;
}

@media (max-width: 1180px) {
  .routing-flow > .flow-column:not(.outbound-column) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .routing-flow > .flow-column:not(.outbound-column) .flow-node,
  .routing-flow > .flow-column:not(.outbound-column) .flow-node:nth-of-type(n + 4) {
    grid-column: auto;
  }

  .routing-flow > .flow-column:not(.outbound-column) .flow-node:nth-of-type(odd):last-child {
    grid-column: 1 / -1;
  }

  .outbound-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outbound-column .dns-card {
    grid-column: auto;
  }
}

@media (max-width: 700px) {
  .routing-flow > .flow-column:not(.outbound-column),
  .outbound-column,
  .rule-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .outbound-column .dns-card {
    grid-column: auto;
  }

  .routing-flow > .flow-column:not(.outbound-column) .flow-node:nth-of-type(odd):last-child {
    grid-column: auto;
  }

  .rule-list div:nth-child(even) {
    border-left: 0;
  }

  .rule-list div:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }
}

/* Routing presentation v3: keep the rule and outbound group headings on one
 * typographic rhythm, then render direct, proxy and DNS as one card family.
 * The muted green is sampled from the supplied visual reference rather than
 * using the brighter global dashboard accent. */
#routing .routing-flow {
  --routing-accent: #4e7d5e;
  --routing-accent-soft: #e6eee9;
  --routing-accent-line: #96ad9d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #routing .routing-flow {
    --routing-accent: #79aa88;
    --routing-accent-soft: #1c2b22;
    --routing-accent-line: #557662;
  }
}

:root[data-theme="dark"] #routing .routing-flow {
  --routing-accent: #79aa88;
  --routing-accent-soft: #1c2b22;
  --routing-accent-line: #557662;
}

#routing .rule-engine {
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0 0 4px;
  padding: 0;
  gap: 0.55ch;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-faint);
  align-items: baseline;
}

#routing .rule-engine span,
#routing .rule-engine strong,
#routing .outbound-column > .eyebrow {
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: 0.16em;
}

#routing .rule-engine small {
  display: none;
}

#routing .outbound-column .flow-node,
#routing .outbound-column .dns-card {
  min-height: 190px;
  height: 100%;
  margin-top: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgb(36 54 68 / 5%);
  overflow: hidden;
}

#routing .outbound-column .flow-node > div:first-child,
#routing .outbound-column .dns-card > .eyebrow {
  min-height: 22px;
  margin-bottom: 0;
}

#routing .outbound-column .flow-node > div span,
#routing .outbound-column .dns-card > .eyebrow {
  color: var(--routing-accent);
  font-weight: 750;
}

#routing .outbound-column .flow-node.is-final {
  border-color: var(--routing-accent-line);
  background: color-mix(in srgb, var(--routing-accent) 2.5%, var(--surface-strong));
}

#routing .outbound-column .flow-node em {
  border-radius: 0 var(--radius-md) 0 var(--radius-md);
  background: var(--routing-accent);
  color: #ffffff;
}

#routing .outbound-column .urltest-latency {
  border-color: color-mix(in srgb, var(--routing-accent) 48%, var(--line));
  background: var(--routing-accent-soft);
}

#routing .outbound-column .urltest-latency::before {
  background: var(--routing-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--routing-accent) 15%, transparent);
}

#routing .outbound-column .flow-node.is-final[data-state="warning"] {
  border-color: color-mix(in srgb, var(--amber) 66%, var(--line));
  background: color-mix(in srgb, var(--amber) 4%, var(--surface-strong));
}

#routing .outbound-column .flow-node.is-final[data-state="bad"] {
  border-color: color-mix(in srgb, var(--danger) 72%, var(--line));
  background: color-mix(in srgb, var(--danger) 5%, var(--surface-strong));
}

#routing .outbound-column .urltest-latency[data-state="warning"] {
  border-color: color-mix(in srgb, var(--amber) 60%, var(--line));
  background: color-mix(in srgb, var(--amber) 10%, var(--surface-strong));
  color: var(--amber);
}

#routing .outbound-column .urltest-latency[data-state="bad"] {
  border-color: color-mix(in srgb, var(--danger) 64%, var(--line));
  background: color-mix(in srgb, var(--danger) 11%, var(--surface-strong));
  color: var(--danger);
}

/* Circular color dots are reserved for actual status results. Resource cards
 * need no status marker; network series use line samples that match the chart. */
.metric-card .metric-dot,
#network .network-numbers .connection-mark {
  display: none !important;
}

#network .network-numbers .rx-mark,
#network .network-numbers .tx-mark {
  display: inline-block;
  width: 26px;
  height: 2px;
  margin: 0 9px 3px 0;
  border-radius: 999px;
  box-shadow: none;
  vertical-align: middle;
}

#network .network-numbers .rx-mark {
  background: var(--chart-teal);
}

#network .network-numbers .tx-mark {
  background: var(--chart-secondary);
}

/* Traffic colors are scoped to the network chart so resource sparklines keep
 * their own tones. The line legends inherit these exact series variables. */
#network .network-panel {
  --network-down: #5e7f69;
  --network-up: #a56f6f;
  --chart-teal: var(--network-down);
  --chart-secondary: var(--network-up);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #network .network-panel {
    --network-down: #7fa38a;
    --network-up: #c58c89;
  }
}

:root[data-theme="dark"] #network .network-panel {
  --network-down: #7fa38a;
  --network-up: #c58c89;
}

:root[data-theme="light"] #network .network-panel {
  --network-down: #5e7f69;
  --network-up: #a56f6f;
}

/* Proxy URLTest history. Healthy, elevated, and critical samples use distinct
 * green, amber, and red bands that match the dashboard health states. */
.latency-history-portal .latency-history {
  --latency-good: #5e7f69;
  --latency-warning: #c98512;
  --latency-bad: #ff3b30;
  --latency-grid: color-mix(in srgb, var(--line) 82%, transparent);
  --latency-label: var(--ink-soft);
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .latency-history-portal .latency-history {
    --latency-good: #7fa38a;
    --latency-warning: #f0b44d;
    --latency-bad: #ff453a;
  }
}

:root[data-theme="dark"] .latency-history-portal .latency-history {
  --latency-good: #7fa38a;
  --latency-warning: #f0b44d;
  --latency-bad: #ff453a;
}

:root[data-theme="light"] .latency-history-portal .latency-history {
  --latency-good: #5e7f69;
  --latency-warning: #c98512;
  --latency-bad: #ff3b30;
}

.latency-history__head,
.latency-history__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

body.latency-history-ready #network .network-panel {
  padding-bottom: 400px;
}

body > .latency-history-portal {
  position: absolute;
  z-index: 2;
  min-width: 0;
  pointer-events: auto;
}

.latency-history__summary {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  gap: 5px 8px;
  min-width: 0;
}

.latency-history__title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 680;
}

.latency-history__target {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.latency-history__summary > strong {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.latency-history__summary > small {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 12px;
}

.latency-zoom {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 50px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
}

.latency-zoom button {
  min-width: 44px;
  height: 44px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.latency-zoom button:hover:not(:disabled),
.latency-zoom button:focus-visible {
  background: color-mix(in srgb, var(--latency-good) 15%, transparent);
  outline: 2px solid color-mix(in srgb, var(--latency-good) 52%, transparent);
  outline-offset: 1px;
}

.latency-zoom button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.latency-zoom output {
  min-width: 58px;
  padding-inline: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.latency-zoom .latency-zoom__reset {
  margin-left: 3px;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.latency-history__plot {
  position: relative;
  height: 220px;
  margin-top: 14px;
  border-radius: 8px;
  cursor: ew-resize;
  touch-action: pan-y;
}

.latency-history__plot:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--latency-good) 58%, transparent);
  outline-offset: 3px;
}

.latency-history__plot canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.latency-history__empty {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.latency-history__tooltip {
  position: absolute;
  top: 8px;
  z-index: 2;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

.latency-history__caption {
  margin: 6px 12px 0 54px;
  color: var(--ink-soft);
  font-size: 11px;
}

.latency-threshold-legend,
.latency-threshold-legend__item {
  display: inline-flex;
  align-items: center;
}

.latency-threshold-legend {
  gap: 12px;
  white-space: nowrap;
}

.latency-threshold-legend__item {
  gap: 5px;
}

.latency-threshold-legend__stem {
  width: 2px;
  height: 12px;
  border-radius: 1px;
}

.latency-threshold-legend__stem--good {
  background: var(--latency-good);
}

.latency-threshold-legend__stem--warning {
  background: var(--latency-warning);
}

.latency-threshold-legend__stem--bad {
  background: var(--latency-bad);
}

@media (max-width: 640px) {
  .latency-history-portal .latency-history {
    margin-top: 20px;
    padding-top: 18px;
  }

  .latency-history__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .latency-zoom {
    width: 100%;
    justify-content: space-between;
  }

  .latency-history__plot {
    height: 190px;
  }

  .latency-history__caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    margin-left: 45px;
  }

  body.latency-history-ready #network .network-panel {
    padding-bottom: 430px;
  }
}

/* The version now lives beside the dashboard label; the redundant sampling
 * summary and read-only interface footer are removed from layout and a11y. */
.topbar .eyebrow {
  text-transform: none;
}

.topbar .eyebrow[data-dashboard-version]::after {
  content: " · " attr(data-dashboard-version);
}

main > footer {
  display: none !important;
}

/* Status system: every result uses color + explicit text so NG remains clear
 * in either theme and for users who cannot distinguish red from green. */
.state[data-state] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.state[data-state]::after {
  content: attr(data-status-text);
  min-width: 28px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: 0.035em;
  text-align: center;
}

.state[data-state] i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.state[data-state="ok"] i {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 14%, transparent);
}

.state[data-state="ok"]::after {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
}

.state[data-state="warning"] i {
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 14%, transparent);
  transform: rotate(45deg);
}

.state[data-state="warning"]::after {
  border-color: color-mix(in srgb, var(--amber) 58%, var(--line));
  background: color-mix(in srgb, var(--amber) 13%, var(--surface));
  color: var(--amber);
}

.state[data-state="bad"] {
  color: var(--danger);
  font-weight: 650;
}

.state[data-state="bad"] i {
  border-radius: 2px;
  background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent);
}

.state[data-state="bad"]::after {
  border-color: color-mix(in srgb, var(--danger) 62%, var(--line));
  background: color-mix(in srgb, var(--danger) 13%, var(--surface));
  color: var(--danger);
}

.state[data-state="unknown"] i {
  border: 1px solid var(--ink-faint);
  background: transparent;
  box-shadow: none;
}

.hero-status[data-state="warning"] {
  color: var(--amber);
}

.hero-status[data-state="bad"] {
  color: var(--danger);
}

.hero-status[data-state="unknown"] {
  color: var(--ink-faint);
}

.hero-status[data-state="warning"] .pulse,
.hero-status[data-state="warning"] .pulse::after {
  background: var(--amber);
  border-color: var(--amber);
}

.hero-status[data-state="bad"] .pulse,
.hero-status[data-state="bad"] .pulse::after {
  background: var(--danger);
  border-color: var(--danger);
}

.hero-status[data-state="unknown"] .pulse,
.hero-status[data-state="unknown"] .pulse::after {
  background: var(--ink-faint);
  border-color: var(--ink-faint);
}

.health-panel[data-state]::after {
  content: attr(data-summary);
  grid-column: 1 / -1;
  box-sizing: border-box;
  width: 100%;
  margin-top: -6px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.health-panel[data-state="ok"] .health-orbit {
  background: conic-gradient(var(--ok) var(--health), var(--line) 0);
}

.health-panel[data-state="warning"] .health-orbit {
  background: conic-gradient(var(--amber) var(--health), var(--line) 0);
}

.health-panel[data-state="bad"] .health-orbit {
  background: conic-gradient(var(--danger) var(--health), var(--line) 0);
}

.health-panel[data-state="unknown"] .health-orbit {
  background: conic-gradient(var(--ink-faint) var(--health), var(--line) 0);
}

.health-panel[data-state="warning"]::after {
  border-color: color-mix(in srgb, var(--amber) 44%, var(--line));
  color: var(--amber);
}

.health-panel[data-state="bad"]::after {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
  color: var(--danger);
}

/* Failure summaries are real keyboard-operable controls. They lead directly
 * to the first NG row instead of looking clickable without doing anything. */
[data-r76s-failure-jump="true"] {
  cursor: pointer;
}

[data-r76s-failure-jump="true"]:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 3px;
}

.health-panel[data-r76s-failure-jump="true"]:hover::after,
.health-panel[data-r76s-failure-jump="true"]:focus-visible::after {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.section-head .state[data-r76s-failure-jump="true"] {
  min-height: 44px;
  padding-inline: 10px;
  border-radius: 8px;
}

.connectivity-strip > div[data-state] {
  position: relative;
  background: var(--surface);
  box-shadow: inset 0 3px 0 var(--line);
}

.connectivity-strip > div[data-state="ok"] {
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--ok) 76%, transparent);
}

.connectivity-strip > div[data-state="warning"] {
  background: color-mix(in srgb, var(--amber) 5%, var(--surface));
  box-shadow: inset 0 3px 0 var(--amber);
}

.connectivity-strip > div[data-state="bad"] {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  box-shadow: inset 0 3px 0 var(--danger);
}

.connectivity-strip > div[data-state="unknown"] {
  box-shadow: inset 0 3px 0 var(--ink-faint);
}

.connectivity-strip > div[data-state="warning"] > span:last-child {
  color: var(--amber);
  font-weight: 620;
}

.connectivity-strip > div[data-state="bad"] > span:last-child {
  color: var(--danger);
  font-weight: 650;
}

.service-row[data-state="warning"],
.service-row[data-state="bad"] {
  background: color-mix(in srgb, var(--amber) 4%, var(--surface));
}

.service-row[data-state="bad"] {
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
  box-shadow: inset 4px 0 0 var(--danger);
}

.service-row[data-state="bad"] .service-icon {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
}

.service-row[data-state="bad"].is-failure-target,
.service-row[data-state="bad"]:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  scroll-margin-block: 18vh;
}

.flow-node.is-final[data-state="warning"] {
  border-color: color-mix(in srgb, var(--amber) 66%, var(--line));
}

.flow-node.is-final[data-state="bad"] {
  border-color: color-mix(in srgb, var(--danger) 72%, var(--line));
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.urltest-latency[data-state="warning"] {
  border-color: color-mix(in srgb, var(--amber) 60%, var(--line)) !important;
  color: var(--amber) !important;
}

.urltest-latency[data-state="bad"] {
  border-color: color-mix(in srgb, var(--danger) 64%, var(--line)) !important;
  background: color-mix(in srgb, var(--danger) 11%, var(--surface)) !important;
  color: var(--danger) !important;
}

@media (max-width: 700px) {
  .state[data-state] {
    white-space: normal;
  }

  .health-panel[data-state]::after {
    grid-column: 1;
  }
}

/* Keep the connectivity checks readable across the dashboard's usable width,
 * which is narrower than the viewport because of the fixed sidebar. */
#network {
  container-type: inline-size;
}

.connectivity-strip .state[data-state]::after {
  flex: 0 0 auto;
  white-space: nowrap;
}

.connectivity-strip > div > span:last-child {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

@container (max-width: 1280px) {
  .connectivity-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #network .connectivity-strip > div:nth-child(n) {
    border-left: 1px solid var(--line);
    border-top: 0;
  }

  #network .connectivity-strip > div:nth-child(3n + 1) {
    border-left: 0;
  }

  #network .connectivity-strip > div:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@container (max-width: 720px) {
  .connectivity-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #network .connectivity-strip > div:nth-child(n) {
    border-left: 1px solid var(--line);
    border-top: 0;
  }

  #network .connectivity-strip > div:nth-child(odd) {
    border-left: 0;
  }

  #network .connectivity-strip > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@container (max-width: 500px) {
  .connectivity-strip {
    grid-template-columns: 1fr;
  }

  #network .connectivity-strip > div,
  #network .connectivity-strip > div:nth-child(n + 2) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  #network .connectivity-strip > div:first-child {
    border-top: 0;
  }
}

/* Keep the final separator continuous when the two-column rule grid has an
 * odd item count. The final rule becomes a deliberate full-width row. */
@media (min-width: 701px) {
  .rule-list > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Overview NIC card. The main content width, rather than the viewport width,
 * determines how the fixed-sidebar dashboard redistributes five KPI cards. */
main {
  container-name: dashboard-main;
  container-type: inline-size;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(420px, 1.7fr);
}

.nic-metric-card {
  --nic-down: #5e7f69;
  --nic-up: #a56f6f;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nic-metric-card {
    --nic-down: #7fa38a;
    --nic-up: #c58c89;
  }
}

:root[data-theme="dark"] .nic-metric-card {
  --nic-down: #7fa38a;
  --nic-up: #c58c89;
}

:root[data-theme="light"] .nic-metric-card {
  --nic-down: #5e7f69;
  --nic-up: #a56f6f;
}

.nic-metric-card .metric-head {
  min-width: 0;
}

.nic-metric-card .metric-head > div {
  min-width: 0;
}

.nic-metric-card .eyebrow {
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.19em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nic-metric-card .metric-head h3 {
  font-size: 18px;
  line-height: 1.35;
}

.nic-rate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.nic-rate {
  min-width: 0;
}

.nic-rate + .nic-rate {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.nic-rate-label,
.nic-total,
.nic-connection-summary > small {
  display: block;
}

.nic-rate-label {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  align-items: center;
  gap: 8px;
  display: flex;
}

.nic-series {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 2px;
  margin-right: 0;
  border-radius: 999px;
}

.nic-series-rx {
  background: var(--nic-down);
}

.nic-series-tx {
  background: var(--nic-up);
}

.nic-rate > strong {
  display: flex;
  align-items: baseline;
  gap: 0.24em;
  min-width: 0;
  margin-top: 10px;
  color: var(--ink);
  font-size: clamp(27px, 2.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
}

.nic-rate > strong small {
  color: inherit;
  flex: 0 0 auto;
  font-size: 0.68em;
  font-weight: inherit;
  letter-spacing: -0.02em;
  line-height: inherit;
}

.nic-total {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.nic-total b {
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
}

.nic-connection-summary {
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1.65fr);
  grid-template-areas:
    "head protocols"
    "head detail";
  column-gap: 24px;
  row-gap: 5px;
  align-items: center;
  min-width: 0;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.nic-connection-head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  align-self: stretch;
  gap: 8px;
}

.nic-connection-head span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.nic-connection-head strong {
  color: var(--ink);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.nic-connection-summary > small {
  margin-top: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: normal;
  word-break: normal;
}

.nic-connection-summary > [data-nic-protocols] {
  grid-area: protocols;
  align-self: end;
}

.nic-connection-summary > small.nic-tcp-detail {
  grid-area: detail;
  align-self: start;
  margin-top: 0;
  color: var(--ink-faint);
}

@container dashboard-main (max-width: 430px) {
  .nic-metric-card {
    padding: 20px;
  }

  .nic-rate-grid {
    gap: 12px;
  }

  .nic-rate + .nic-rate {
    padding-left: 12px;
  }

  .nic-rate > strong {
    font-size: clamp(23px, 7vw, 28px);
  }

  .nic-connection-summary {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "protocols"
      "detail";
    gap: 7px;
  }

  .nic-connection-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
}

.nic-metric-card[data-link-state="down"] {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}

@container dashboard-main (max-width: 1250px) and (min-width: 761px) {
  .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .metric-grid > .metric-card {
    grid-column: span 2;
  }

  .metric-grid > .metric-card:nth-last-child(-n + 2) {
    grid-column: span 3;
  }
}

@container dashboard-main (max-width: 760px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid > .metric-card {
    grid-column: auto;
  }

  .metric-grid > .metric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@container dashboard-main (max-width: 500px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid > .metric-card,
  .metric-grid > .metric-card:last-child:nth-child(odd) {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-section > * {
    min-width: 0;
  }

  .hero-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-facts div {
    min-width: 0;
  }
}

/* 2026-09-08 quality pass: keep the dashboard usable at the 320 px reflow
 * boundary, preserve horizontal Chinese labels, and meet readable caption and
 * status contrast targets without changing the established visual language. */
html,
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
}

.brand {
  min-width: 44px;
  min-height: 44px;
}

.brand-mark {
  width: 44px;
  height: 44px;
}

.sidebar nav a {
  touch-action: manipulation;
}

.progress-track > span {
  transition: none;
}

#routing .outbound-column .flow-node em {
  color: #07110b;
  font-size: 12px;
}

.nic-connection-summary > small,
.latency-zoom .latency-zoom__reset,
.latency-history__tooltip,
.latency-history__caption {
  font-size: 12px;
}

.nic-connection-summary > small {
  overflow-wrap: anywhere;
}

.state[data-state]::after {
  font-size: 11px;
}

@media (max-width: 640px) {
  .sidebar {
    padding-inline: 8px;
  }

  .sidebar nav {
    gap: 4px;
    min-width: 0;
  }

  .sidebar nav a {
    flex: 0 0 44px;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding-inline: 4px;
    line-height: 1.2;
    white-space: nowrap;
    word-break: keep-all;
    writing-mode: horizontal-tb;
  }
}

@media (max-width: 380px) {
  .brand strong {
    display: none;
  }
}

@media (max-width: 340px) {
  .thermal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thermal-grid > div {
    min-width: 0;
  }
}

#routing .outbound-column .urltest-latency {
  box-sizing: border-box;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}

@media (max-width: 380px) {
  .latency-threshold-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    white-space: normal;
  }
}
