/* Project Cassandra HC-GATE — GitHub Primer-Inspired Light & Dark NOC Design System */

:root {
  color-scheme: light dark;

  /* GitHub Primer-inspired neutral surface hierarchy (90% of UI) */
  --bg: light-dark(#f6f8fa, #0d1117);
  --header-bg: light-dark(#f6f8fa, #010409);
  --surface: light-dark(#ffffff, #161b22);
  --surface-2: light-dark(#f6f8fa, #1c2128);
  --surface-3: light-dark(#eaeef2, #21262d);
  --border: light-dark(#d0d7de, #30363d);
  --border-muted: light-dark(#d8dee4, #21262d);
  --border-strong: light-dark(#afb8c1, #484f58);
  --ink: light-dark(#1f2328, #e6edf3);
  --ink-2: light-dark(#424a53, #c9d1d9);
  --muted: light-dark(#57606a, #8b949e);

  /* Calm, eye-friendly semantic accents (10% of UI) */
  --teal: light-dark(#0d9488, #2dd4bf);
  --teal-ink: light-dark(#0f766e, #5eead4);
  --teal-soft: light-dark(#f0fdfa, rgba(45, 212, 191, 0.12));
  --teal-border: light-dark(#99f6e4, rgba(45, 212, 191, 0.35));

  --sage: light-dark(#1a7f37, #3fb950);
  --sage-ink: light-dark(#116329, #7ee787);
  --sage-soft: light-dark(#dafbe1, rgba(63, 185, 80, 0.12));
  --sage-border: light-dark(#aceebb, rgba(63, 185, 80, 0.36));

  --amber: light-dark(#bf8700, #d29922);
  --amber-ink: light-dark(#7d4e00, #f2cc60);
  --amber-soft: light-dark(#fff8c5, rgba(210, 153, 34, 0.14));
  --amber-border: light-dark(#eed888, rgba(210, 153, 34, 0.38));

  --coral: light-dark(#d94848, #f87171);
  --coral-ink: light-dark(#a40e26, #ffa198);
  --coral-soft: light-dark(#ffebe9, rgba(248, 113, 113, 0.13));
  --coral-border: light-dark(#ffcecb, rgba(248, 113, 113, 0.4));

  --slate: light-dark(#64748b, #8b949e);
  --shadow-sm: light-dark(0 1px 0 rgba(31, 35, 40, 0.04), 0 1px 0 rgba(1, 4, 9, 0.3));
  --shadow: light-dark(0 1px 3px rgba(31, 35, 40, 0.05), 0 3px 12px rgba(1, 4, 9, 0.32));
  --shadow-lg: light-dark(0 16px 42px rgba(31, 35, 40, 0.14), 0 20px 56px rgba(1, 4, 9, 0.65));

  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  color-scheme: inherit;
}

html {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
  font-size: 14px;
}

/* Preserve hidden="until-found" content-visibility while enforcing display:none on standard [hidden] */
[hidden]:not([hidden="until-found"]) {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.num {
  font-variant-numeric: tabular-nums;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.18em;
}

/* =========================================================================
   GITHUB-INSPIRED TWO-TIER APPLICATION HEADER (Top Bar + Integrated Tabs)
   ========================================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  border-radius: 8px;
  padding: 2px 4px 2px 2px;
}

.brand-logo-link:hover .brand-org {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Official Cassandra geometric mark adapted cleanly for Light & Dark NOC */
.cassandra-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: light-dark(#ffffff, #161b22);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cassandra-mark svg {
  width: 28px;
  height: 28px;
  display: block;
}

.cassandra-mark path {
  stroke: light-dark(#1d1d1f, #e6edf3);
}

.crumb-sep {
  color: var(--muted);
  font-weight: 400;
  font-size: 16px;
  user-select: none;
}

.brand-product {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.env-badge.live-csv {
  border-color: var(--teal-border);
  background: var(--teal-soft);
  color: var(--teal-ink);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-link-quiet {
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-link-quiet:hover {
  color: var(--ink);
  background: var(--surface-3);
}

/* GitHub Primer-style Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--teal);
  border-color: light-dark(rgba(15, 118, 110, 0.25), rgba(45, 212, 191, 0.3));
  color: light-dark(#ffffff, #0d1117);
  font-weight: 600;
}

.btn-primary:hover {
  background: light-dark(#0f766e, #5eead4);
  border-color: light-dark(#0f766e, #5eead4);
}

.btn-emphasis {
  background: light-dark(#1f2328, #e6edf3);
  border-color: light-dark(#1f2328, #e6edf3);
  color: light-dark(#ffffff, #0d1117);
}

.btn-emphasis:hover {
  opacity: 0.9;
}

.btn-sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon-only {
  padding: 6px 8px;
}

/* Two-state Theme Toggle Visibility (per modern-web-guidance) */
.theme-toggle .label-light {
  display: none;
}
@media (prefers-color-scheme: dark) {
  .theme-toggle .label-dark {
    display: none;
  }
  .theme-toggle .label-light {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .label-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .label-light {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-toggle .label-dark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-toggle .label-light {
  display: none;
}

/* Integrated GitHub Underline Tablist inside Header */
.tablist-wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
}

.tablist {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
}

.tablist::-webkit-scrollbar {
  display: none;
}

[role="tab"] {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 9px 12px 11px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}

[role="tab"]:hover {
  color: var(--ink);
  background: light-dark(rgba(208, 215, 222, 0.32), rgba(177, 186, 196, 0.08));
}

[role="tab"]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  border-radius: 6px;
}

/* Mandatory non-color-alone indicator via ::after border (per modern-web-guidance) */
[role="tab"][aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

[role="tab"][aria-selected="true"] .icon {
  color: var(--teal);
}

[role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 4px 0;
  border-block-end: 2px solid var(--teal);
  border-radius: 2px 2px 0 0;
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
}

.tab-count.coral {
  background: var(--coral-soft);
  color: var(--coral-ink);
}

.tab-count.amber {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

/* =========================================================================
   MAIN WORKSPACE
   ========================================================================= */
.workspace {
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

/* Compact Asset & Financial Parameters Bar */
.review-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.review-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--coral-soft);
  color: var(--coral-ink);
  border: 1px solid var(--coral-border);
  white-space: nowrap;
}

.status-pill.healthy {
  background: var(--sage-soft);
  color: var(--sage-ink);
  border-color: var(--sage-border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.asset-meta {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.asset-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  color: var(--ink-2);
}

.asset-sub {
  font-size: 12px;
  color: var(--muted);
}

.tariff-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.tariff-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.tariff-controls select,
.tariff-controls input {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.tariff-controls input[type="number"] {
  width: 68px;
}

/* Mandatory zero padding/border on role="tabpanel" (hidden="until-found") */
.panels-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

[role="tabpanel"] {
  grid-area: 1 / 1;
  min-width: 0;
}

.panel-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel-inner > *,
.two-col > *,
.asym-col > *,
.bento-grid > *,
.kpi-grid > *,
.gauges-grid > *,
.card,
.canvas-box {
  min-width: 0;
}

/* =========================================================================
   PLAIN-ENGLISH CUSTOMER EXECUTIVE VERDICT CARD (GitHub Alert / PR Style)
   ========================================================================= */
.verdict-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.verdict-head {
  padding: 10px 18px;
  background: var(--coral-soft);
  border-bottom: 1px solid var(--coral-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.verdict-card.healthy .verdict-head {
  background: var(--sage-soft);
  border-bottom-color: var(--sage-border);
}

.verdict-head-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--coral-ink);
}

.verdict-card.healthy .verdict-head-title {
  color: var(--sage-ink);
}

.verdict-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.verdict-meta span {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.verdict-body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}

.verdict-copy h2 {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.verdict-copy p {
  margin: 0;
  font-size: 13.2px;
  color: var(--ink-2);
  max-width: 78ch;
  line-height: 1.55;
}

.verdict-copy p + p {
  margin-top: 6px;
}

.verdict-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 210px;
}

.verdict-actions .btn {
  justify-content: flex-start;
  width: 100%;
}

/* KPI Grid (GitHub Metrics Style) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
}

.kpi-card.teal::before { background: var(--teal); }
.kpi-card.coral::before { background: var(--coral); }
.kpi-card.amber::before { background: var(--amber); }
.kpi-card.sage::before { background: var(--sage); }

.kpi-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.kpi-val {
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0 3px;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-sub {
  margin: 2px 0 0;
  font-size: 12.2px;
  color: var(--muted);
}

.card-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-2);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.toggle-chip input {
  accent-color: var(--teal);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-2);
  align-items: center;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.canvas-box {
  position: relative;
  width: 100%;
}

.canvas-box canvas {
  width: 100%;
  max-width: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: light-dark(#1f2328, #e6edf3);
  color: light-dark(#ffffff, #0d1117);
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 10;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Gauges Grid */
.gauges-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.gauge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 10px;
  box-shadow: var(--shadow-sm);
}

.gauge-card.fault {
  border-color: var(--coral-border);
  background: linear-gradient(180deg, var(--coral-soft), var(--surface) 60%);
}

.gauge-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink-2);
}

/* Bento 3-Column Diagnosis Panel */
.bento-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.12fr 0.95fr;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.bento-donut {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-hero {
  grid-column: 2;
  grid-row: 1;
  background: linear-gradient(135deg, #161b22 0%, #241d22 62%, #522026 100%);
  color: #ffffff;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.bento-hero.healthy-hero {
  background: linear-gradient(135deg, #0d1117 0%, #134e4a 65%, #166534 100%);
  border-color: rgba(63, 185, 80, 0.4);
}

.hero-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffa198;
}

.healthy-hero .hero-eyebrow {
  color: #7ee787;
}

.hero-component {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}

.hero-mech {
  font-size: 13.5px;
  color: #e6edf3;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hero-pills span {
  background: rgba(255, 255, 255, 0.12);
  color: #f0f6fc;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.bento-load {
  grid-column: 2;
  grid-row: 2;
}

.bento-cleared {
  grid-column: 3;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cleared-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cleared-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  padding: 10px 12px;
  border-radius: 8px;
}

.zero-pill {
  background: var(--sage-soft);
  color: var(--sage-ink);
  border: 1px solid var(--sage-border);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 34px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.cleared-item b {
  font-size: 12.8px;
  display: block;
}

.cleared-item p {
  margin: 2px 0 0;
  font-size: 11.4px;
  color: var(--muted);
}

.clearance-banner {
  margin-top: auto;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  color: var(--teal-ink);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Technician Checklist Card */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.check-step {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-step.skip {
  background: var(--sage-soft);
  border-color: var(--sage-border);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--teal-ink);
  font-family: var(--font-mono);
}

.check-step.skip .step-badge {
  color: var(--sage-ink);
}

.check-step b {
  font-size: 13px;
}

.check-step p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

/* Physics Accordion */
details.physics-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

details.physics-accordion summary {
  padding: 15px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
}

details.physics-accordion summary::-webkit-details-marker {
  display: none;
}

details.physics-accordion summary:hover {
  background: var(--surface-2);
}

.summary-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-ink);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  padding: 3px 10px;
  border-radius: 999px;
}

.physics-body {
  padding: 18px 20px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.asym-col {
  display: grid;
  grid-template-columns: 1.22fr 0.78fr;
  gap: 16px;
}

.pid-frame {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 10px;
  color: #e6edf3;
}

/* Decoder Cards */
.decoder-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.decoder-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
}

.decoder-card.match {
  background: var(--coral-soft);
  border-color: var(--coral-border);
}

.decoder-card.clue {
  background: var(--teal-soft);
  border-color: var(--teal-border);
}

.decoder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12.5px;
}

.decoder-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-ink);
}

.decoder-card.match .decoder-tag {
  background: var(--coral);
  color: #ffffff;
}

.decoder-card.clue .decoder-tag {
  background: var(--teal);
  color: light-dark(#ffffff, #0d1117);
}

.decoder-card p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

/* Responsive Semantic Data Table (per modern-web-guidance) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  container-type: inline-size;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  --label-1: "Tariff Rate";
  --label-2: "1 Chiller / yr";
  --label-3: "5 Chillers / yr";
  --label-4: "15 Chillers / yr";
}

table.data-table caption {
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

table.data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

table.data-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

table.data-table tbody th,
table.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
}

table.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--surface);
  font-weight: 600;
}

table.data-table tr.active-row th,
table.data-table tr.active-row td {
  background: var(--teal-soft);
  color: var(--teal-ink);
  font-weight: 700;
}

@container (width < 435px) {
  table.data-table,
  table.data-table caption,
  table.data-table thead,
  table.data-table tbody,
  table.data-table tr,
  table.data-table th,
  table.data-table td {
    display: block;
    width: 100%;
  }

  table.data-table thead {
    display: none;
  }

  table.data-table tr {
    margin: 10px;
    width: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }

  table.data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    background: var(--surface-2);
  }

  table.data-table td:nth-child(2)::before {
    content: var(--label-2) ": ";
    font-weight: 600;
    color: var(--muted);
  }
  table.data-table td:nth-child(3)::before {
    content: var(--label-3) ": ";
    font-weight: 600;
    color: var(--muted);
  }
  table.data-table td:nth-child(4)::before {
    content: var(--label-4) ": ";
    font-weight: 600;
    color: var(--muted);
  }
}

/* ESG Highlight Cards */
.esg-cta {
  background: linear-gradient(125deg, #0d1117 0%, #134e4a 65%, #166534 100%);
  color: #ffffff;
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.esg-cta h3 {
  margin: 0 0 3px;
  font-size: 16.5px;
}

.esg-cta p {
  margin: 0;
  font-size: 12.8px;
  color: #c9d1d9;
}

.esg-big {
  font-size: 28px;
  font-weight: 700;
  color: #7ee787;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.esg-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.esg-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 14px 20px;
  position: relative;
  overflow: hidden;
}

.esg-mini::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--teal);
}

.esg-mini.sage::before { background: var(--sage); }
.esg-mini.slate::before { background: var(--slate); }

.esg-mini .val {
  font-size: 23px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.esg-mini .lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--teal-ink);
}

.esg-mini.sage .lbl { color: var(--sage-ink); }
.esg-mini p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Lifecycle Year Summary Strip */
.year-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.year-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.year-card.drag {
  background: var(--coral-soft);
  border-color: var(--coral-border);
}

.year-card .yl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  font-family: var(--font-mono);
}

.year-card .yv {
  font-size: 17px;
  font-weight: 700;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}

.year-card .ys {
  font-size: 11px;
  color: var(--muted);
}

/* Native Modal Dialog: CSV Upload (per modern-web-guidance) */
dialog:modal {
  overscroll-behavior: contain;
}

dialog:modal::backdrop {
  background: rgba(1, 4, 9, 0.56);
  backdrop-filter: blur(3px);
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.chat-drawer::backdrop {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

dialog.upload-modal {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  width: min(640px, calc(100vw - 32px));
  max-height: 90dvh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.how-step {
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.how-step b {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 2px;
}

.dropzone {
  border: 1.5px dashed var(--teal-border);
  background: var(--teal-soft);
  border-radius: 10px;
  padding: 24px 18px;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--teal);
}

.dropzone p {
  margin: 5px 0 0;
  font-size: 12.2px;
  color: var(--muted);
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  font-size: 12px;
  color: var(--ink-2);
}

.mapper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mapper-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.mapper-grid select,
.mapper-grid input {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12.5px;
  font-family: inherit;
}

.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Native Non-Modal Docked Top-Layer Chatbot Drawer (<dialog popover="manual">) */
dialog.chat-drawer {
  margin: 0;
  padding: 0;
  position: fixed;
  inset: 12px 12px 12px auto;
  width: min(430px, calc(100vw - 24px));
  height: calc(100dvh - 24px);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.chat-drawer:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
}

.chat-head {
  background: #0d1117;
  color: #f0f6fc;
  padding: 13px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #30363d;
}

.chat-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #161b22;
  border: 1px solid #30363d;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-avatar svg {
  width: 24px;
  height: 24px;
}

.chat-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.chat-ctx {
  font-size: 11px;
  color: #5eead4;
}

.chat-close {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chat-prompts {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-chip {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.2px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.prompt-chip:hover {
  border-color: var(--teal);
  color: var(--teal-ink);
  background: var(--teal-soft);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg.user {
  align-items: flex-end;
}

.msg-bubble {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 12.6px;
  line-height: 1.5;
  white-space: pre-line;
}

.msg.user .msg-bubble {
  background: var(--teal);
  color: light-dark(#ffffff, #0d1117);
  font-weight: 600;
  border-bottom-right-radius: 3px;
}

.msg.bot .msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  border-bottom-left-radius: 3px;
  width: 100%;
  max-width: 100%;
}

.bot-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 5px;
  color: var(--ink);
}

.bot-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.bot-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-variant-numeric: tabular-nums;
}

.bot-kpi span {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.bot-kpi b {
  font-size: 13.5px;
  font-weight: 700;
}

.bot-kpi.coral b { color: var(--coral); }
.bot-kpi.sage b { color: var(--sage); }
.bot-kpi.teal b { color: var(--teal); }
.bot-kpi.amber b { color: var(--amber); }

.bot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.bot-act {
  background: var(--surface);
  border: 1px solid var(--teal-border);
  color: var(--teal-ink);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.bot-act:hover {
  background: var(--teal-soft);
}

.chat-form {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 12.8px;
  font-family: inherit;
}

/* Enterprise Footer matching projectcassandra.uk */
.app-footer {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px 24px 36px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--teal-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-note {
  font-size: 11.3px;
  color: var(--muted);
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .kpi-grid,
  .gauges-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bento-grid,
  .two-col,
  .asym-col,
  .checklist-grid,
  .verdict-body {
    grid-template-columns: 1fr;
  }
  .verdict-actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
  .verdict-actions .btn {
    width: auto;
  }
  .bento-donut,
  .bento-hero,
  .bento-load,
  .bento-cleared {
    grid-column: 1;
    grid-row: auto;
  }
  .year-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-inner,
  .tablist-wrap,
  .workspace,
  .app-footer {
    padding-inline: 14px;
  }
  .kpi-grid,
  .gauges-grid,
  .mapper-grid,
  .how-steps,
  .year-strip {
    grid-template-columns: 1fr;
  }
  .nav-link-quiet {
    display: none;
  }
}

/* Clean Board Handover Print Stylesheet */
@media print {
  .app-header,
  .tariff-controls,
  .verdict-actions,
  dialog {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #1f2328;
  }
  .card,
  .verdict-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
