/* ── Design tokens ───────────────────────────────────────────────────────── */
/* Validated with the dataviz skill's contrast/CVD checker before landing —
   see the redesign discussion for the exact validator output. Categorical
   --series-* are unchanged from the original build (still separately
   validated); only the brand accent and status ramp are new here. */

:root {
  color-scheme: light;
  --page-plane:     #f6f6fb;
  --surface-1:      #ffffff;
  --surface-2:      #fbfbfe;
  --text-primary:   #101223;
  --text-secondary: #565973;
  --text-muted:     #8a8da8;
  --gridline:       #e4e4f0;
  --border:         rgba(16, 18, 35, 0.08);

  /* AICPA & CIMA brand: sampled directly from aicpa-cima.com — --brand from
     the site's own "Log in" button (#72246C), --brand-gradient from the logo
     mark's actual gradient stops. Both re-validated for this UI's own
     surfaces (contrast + WCAG check, not just eyeballed from the source). */
  --brand:          #72246C;
  --brand-2:        #B54264;
  --brand-gradient: linear-gradient(135deg, #662E87 0%, #873678 45%, #B54264 100%);
  --brand-tint:     color-mix(in srgb, var(--brand) 10%, transparent);

  --series-1: #2a78d6; --series-2: #1baf7a; --series-3: #eda100; --series-4: #008300;
  --series-5: #4a3aa7; --series-6: #e34948; --series-7: #e87ba4; --series-8: #eb6834;

  --status-good:     #10B981;
  --status-warning:  #F59E0B;
  --status-serious:  #F43F5E;
  --status-critical: #EF4444;

  --shadow-sm: 0 1px 2px rgba(16, 18, 35, 0.05);
  --shadow-md: 0 8px 24px -12px rgba(16, 18, 35, 0.16);
  --shadow-lg: 0 16px 40px -16px rgba(16, 18, 35, 0.22);
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page-plane:     #0a0b14;
    --surface-1:      #141522;
    --surface-2:      #191a29;
    --text-primary:   #f4f4fb;
    --text-secondary: #b7b9d1;
    --text-muted:     #7d7f9c;
    --gridline:       #262838;
    --border:         rgba(255, 255, 255, 0.08);
    --brand:          #C07FB6;
    --brand-2:        #E08AA8;
    --brand-gradient: linear-gradient(135deg, #C07FB6 0%, #D091C4 45%, #E08AA8 100%);
    --brand-tint:     color-mix(in srgb, var(--brand) 14%, transparent);
    --series-1: #3987e5; --series-2: #199e70; --series-3: #c98500; --series-4: #008300;
    --series-5: #9085e9; --series-6: #e66767; --series-7: #d55181; --series-8: #d95926;
    --status-good:     #059669;
    --status-warning:  #D97706;
    --status-serious:  #E11D48;
    --status-critical: #DC2626;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 48px -18px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page-plane:     #0a0b14;
  --surface-1:      #141522;
  --surface-2:      #191a29;
  --text-primary:   #f4f4fb;
  --text-secondary: #b7b9d1;
  --text-muted:     #7d7f9c;
  --gridline:       #262838;
  --border:         rgba(255, 255, 255, 0.08);
  --brand:          #C07FB6;
  --brand-2:        #E08AA8;
  --brand-gradient: linear-gradient(135deg, #C07FB6 0%, #D091C4 45%, #E08AA8 100%);
  --brand-tint:     color-mix(in srgb, var(--brand) 14%, transparent);
  --series-1: #3987e5; --series-2: #199e70; --series-3: #c98500; --series-4: #008300;
  --series-5: #9085e9; --series-6: #e66767; --series-7: #d55181; --series-8: #d95926;
  --status-good:     #059669;
  --status-warning:  #D97706;
  --status-serious:  #E11D48;
  --status-critical: #DC2626;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 48px -18px rgba(0, 0, 0, 0.6);
}

/* ── Base ────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background:
    radial-gradient(1000px 460px at 14% -8%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 65%),
    radial-gradient(760px 400px at 92% 6%, color-mix(in srgb, var(--brand-2) 9%, transparent), transparent 60%),
    var(--page-plane);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font-family: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px;
}

/* ── Shell: sidebar + main column ────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-1) 70%, transparent);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 6px 8px 20px; }
.brand-logo-wrap {
  /* The logo's wordmark is a fixed dark ink, not currentColor, so it needs a
     stable light backing regardless of app theme — same treatment any site
     gives a partner/brand mark rather than placing it on an arbitrary ground. */
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
}
.brand-logo { display: block; height: 22px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-name-org { color: var(--text-secondary); font-weight: 600; }
.brand-name-product {
  font-weight: 800;
  /* All-caps acronyms read best with a touch of positive tracking, opposite
     the tight/negative tracking that suits "Nexus" — set here to override
     the parent's -0.01em rather than compromise on one value for both. */
  letter-spacing: 0.02em;
  /* Gradient wordmark for the product half of the name — color is the
     fallback if background-clip:text isn't supported, so the name still
     reads in solid brand purple rather than disappearing. */
  color: var(--brand);
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.main-nav { display: flex; flex-direction: column; gap: 2px; }
.main-nav a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500;
  padding: 9px 12px; border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.main-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-icon svg { width: 100%; height: 100%; display: block; }
.main-nav a:hover { background: var(--gridline); color: var(--text-primary); }
.main-nav a.is-active {
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
}
.main-nav a.is-active .nav-icon { opacity: 1; }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-footer-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-muted); font-size: 12.5px;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.sidebar-footer-link:hover { color: var(--text-primary); background: var(--gridline); }
.sidebar-footer-link .nav-icon { width: 16px; height: 16px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page-plane) 85%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 600; }
.sidebar-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-1); cursor: pointer; color: var(--text-secondary);
}
.sidebar-toggle .nav-icon { width: 18px; height: 18px; }

main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 28px 28px 56px; }

.sidebar-scrim { position: fixed; inset: 0; background: rgba(10, 11, 20, 0.5); z-index: 19; }

@media (max-width: 880px) {
  .topbar { display: flex; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 20; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  main { padding: 20px 16px 40px; }
}

/* ── Page intro / section headings ──────────────────────────────────────── */

.page-intro { margin-bottom: 24px; animation: fade-in-up 0.4s ease both; }
.page-intro h2 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.page-intro p { margin: 0; color: var(--text-secondary); font-size: 13.5px; max-width: 68ch; }
.page-intro p code { font-family: ui-monospace, monospace; background: var(--gridline); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

@keyframes fade-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { animation: fade-in-up 0.4s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; } .stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; } .stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.range-control { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.range-btn {
  border: none; background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 7px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.range-btn.is-active {
  /* Was var(--surface-1) against a var(--surface-2) track — the two are
     nearly the same lightness, so the "selected" pill was barely visible.
     brand-tint matches the sidebar nav's own active-state treatment. */
  background: var(--brand-tint);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.refresh-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
  font: inherit; font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 10px; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.refresh-btn svg { width: 15px; height: 15px; }
.refresh-btn:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.refresh-btn:active { transform: scale(0.96); }
.refresh-btn.is-spinning .nav-icon { animation: spin 0.6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── KPI tiles ───────────────────────────────────────────────────────────── */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }

.tile {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.tile::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--gridline);
}
.tile--info::before { background: var(--brand-gradient); }
.tile--good::before { background: var(--status-good); }
.tile--warning::before { background: var(--status-warning); }
.tile--serious::before { background: var(--status-serious); }

.tile-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.tile-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand); flex-shrink: 0;
}
.tile-icon svg { width: 18px; height: 18px; }
.tile-label { margin: 0; font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.tile-value { margin: 2px 0 0; font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.tile-note { margin: 6px 0 0; font-size: 11.5px; color: var(--text-muted); }
.tile-spark { margin-top: 10px; height: 36px; }

/* ── Sparkline ───────────────────────────────────────────────────────────── */

.sparkline { width: 100%; height: 100%; display: block; overflow: visible; }
.sparkline-area { fill: var(--brand); opacity: 0.12; }
.sparkline-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sparkline-empty { height: 100%; }

/* ── Card ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease;
}
.card-header { padding: 18px 18px 0; }
.card-header h2 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h2 svg { width: 16px; height: 16px; color: var(--brand); flex-shrink: 0; }
.cell-muted svg { width: 12px; height: 12px; vertical-align: -1px; }
.card-body { padding: 14px 18px 18px; }
.card-subtitle { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.card-subtitle code { font-family: ui-monospace, monospace; background: var(--gridline); padding: 1px 5px; border-radius: 4px; }

.card-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card-grid-2 .card { margin-bottom: 0; }

/* ── Donut chart ─────────────────────────────────────────────────────────── */

.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap { position: relative; flex-shrink: 0; }
.donut-chart { display: block; }
.donut-arc { cursor: pointer; transition: opacity 0.15s ease; }
.donut-wrap:has(.donut-arc:hover) .donut-arc:not(:hover) { opacity: 0.45; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-total { font-size: 22px; font-weight: 700; line-height: 1; }
.donut-total-label { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.donut-tooltip {
  position: absolute; pointer-events: none;
  background: var(--text-primary); color: var(--surface-1);
  font-size: 12px; padding: 4px 9px; border-radius: 7px; white-space: nowrap;
  transform: translateY(-100%); box-shadow: var(--shadow-md); z-index: 5;
}
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; flex: 1; min-width: 140px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.donut-legend-value { margin-left: auto; font-weight: 600; color: var(--text-primary); }
.donut-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

/* ── Category bar list (Epic breakdown) ─────────────────────────────────── */

.category-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.category-row { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 12px; font-size: 13px; }
.category-name { color: var(--text-secondary); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-weight: 500; }
.category-track { height: 9px; border-radius: 5px; background: var(--gridline); overflow: hidden; }
.category-fill { height: 100%; border-radius: 5px; width: 0; transition: width 0.7s cubic-bezier(.4,0,.2,1); }
.category-fill.is-in { } /* width set inline; transition triggers on class add via rAF in JS */
.category-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }

.cat-1 { background: linear-gradient(90deg, var(--series-1), color-mix(in srgb, var(--series-1) 70%, white)); }
.cat-2 { background: linear-gradient(90deg, var(--series-2), color-mix(in srgb, var(--series-2) 70%, white)); }
.cat-3 { background: linear-gradient(90deg, var(--series-3), color-mix(in srgb, var(--series-3) 70%, white)); }
.cat-4 { background: linear-gradient(90deg, var(--series-4), color-mix(in srgb, var(--series-4) 70%, white)); }
.cat-5 { background: linear-gradient(90deg, var(--series-5), color-mix(in srgb, var(--series-5) 70%, white)); }
.cat-6 { background: linear-gradient(90deg, var(--series-6), color-mix(in srgb, var(--series-6) 70%, white)); }
.cat-7 { background: linear-gradient(90deg, var(--series-7), color-mix(in srgb, var(--series-7) 70%, white)); }
.cat-8 { background: linear-gradient(90deg, var(--series-8), color-mix(in srgb, var(--series-8) 70%, white)); }
.cat-other { background: var(--text-muted); }

/* ── Table ───────────────────────────────────────────────────────────────── */

.table-section .table-header { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 18px 0; }
.table-count { font-size: 12px; color: var(--text-muted); }
.table-wrap { overflow-x: auto; padding: 12px 8px 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--gridline); padding: 8px 10px; white-space: nowrap; }
tbody td { padding: 11px 10px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.row-link { cursor: pointer; border-radius: var(--radius-sm); transition: background 0.12s ease; }
tbody tr.row-link:hover td { background: var(--surface-2); }
tbody tr.row-link:hover td:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
tbody tr.row-link:hover td:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
tbody tr.row-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.source-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.source-chip svg { width: 13px; height: 13px; opacity: 0.8; }

.time-cell, .cell-muted { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.error-cell { max-width: 360px; }
.error-cell .error-summary { color: var(--text-primary); font-weight: 500; }

.empty-state { text-align: center; color: var(--text-muted); padding: 32px 16px !important; font-size: 13.5px; }

/* Skeleton loading shimmer, replacing plain "Loading…" text */
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--gridline) 25%, color-mix(in srgb, var(--gridline) 50%, var(--surface-2)) 50%, var(--gridline) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-tile { height: 92px; border-radius: var(--radius); }
.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-row { height: 44px; margin-bottom: 8px; border-radius: var(--radius-sm); }

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge--good    { background: color-mix(in srgb, var(--status-good) 15%, var(--surface-1)); color: var(--text-primary); }
.badge--good::before    { background: var(--status-good); }
.badge--warning { background: color-mix(in srgb, var(--status-warning) 18%, var(--surface-1)); color: var(--text-primary); }
.badge--warning::before { background: var(--status-warning); }
.badge--serious { background: color-mix(in srgb, var(--status-serious) 16%, var(--surface-1)); color: var(--text-primary); }
.badge--serious::before { background: var(--status-serious); }
.badge--critical { background: color-mix(in srgb, var(--status-critical) 16%, var(--surface-1)); color: var(--text-primary); }
.badge--critical::before { background: var(--status-critical); }
.badge--neutral { background: var(--gridline); color: var(--text-secondary); }
.badge--neutral::before { display: none; }
.badge--info    { background: var(--brand-tint); color: var(--brand); }
.badge--info::before    { background: var(--brand); }

.jira-link { color: var(--brand); text-decoration: none; font-weight: 500; }
.jira-link:hover { text-decoration: underline; }

/* ── Detail screen ───────────────────────────────────────────────────────── */

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500; }
.back-link:hover { color: var(--brand); }
.back-link svg { width: 15px; height: 15px; }

.status-row { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.context-list { margin: 0; padding-left: 0; font-size: 13px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.context-list li { padding-left: 16px; position: relative; }
.context-list li::before { content: ''; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }

/* ── System health ───────────────────────────────────────────────────────── */

.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.health-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); }
.health-card-title { margin: 0 0 6px; font-size: 13px; text-transform: capitalize; display: flex; align-items: center; gap: 7px; font-weight: 500; }
.health-card-status { margin: 0 0 3px; font-weight: 700; font-size: 15px; }
.health-card-detail { margin: 0; font-size: 12px; color: var(--text-muted); white-space: normal; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px transparent; transition: box-shadow 0.2s ease; }
.status-dot--good { background: var(--status-good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-good) 20%, transparent); }
.status-dot--critical { background: var(--status-critical); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-critical) 20%, transparent); }

.meter-block { margin-bottom: 18px; }
.meter-block:last-child { margin-bottom: 0; }
.meter-header { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 7px; }
.meter-header strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.meter-track { height: 9px; border-radius: 999px; background: var(--gridline); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; width: 0; transition: width 0.8s cubic-bezier(.4,0,.2,1); }
.meter-fill--good     { background: linear-gradient(90deg, color-mix(in srgb, var(--status-good) 70%, white), var(--status-good)); }
.meter-fill--warning  { background: linear-gradient(90deg, color-mix(in srgb, var(--status-warning) 70%, white), var(--status-warning)); }
.meter-fill--critical { background: linear-gradient(90deg, color-mix(in srgb, var(--status-critical) 70%, white), var(--status-critical)); }

/* ── Jira issue drill-down ───────────────────────────────────────────────── */

.jira-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 16px; font-size: 12.5px; }
.crumb { color: var(--text-secondary); text-decoration: none; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:hover { color: var(--brand); }
.crumb--current { color: var(--text-primary); font-weight: 600; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { color: var(--text-muted); }

.jira-hero { position: relative; }
.jira-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); }
.jira-hero-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.jira-hero-key { margin-left: auto; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.jira-hero-key svg { width: 13px; height: 13px; }
.jira-hero-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; text-wrap: balance; }

.code-block {
  margin: 8px 0 0;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  max-height: 320px;
  overflow-y: auto;
}

/* ── Outcome chart (legacy hook, kept for compat) ───────────────────────── */
.chart-grid { stroke: var(--gridline); }
.chart-axis-label { fill: var(--text-muted); font-size: 9px; }

/* ── Buttons & form fields (manual investigate trigger) ─────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.98); }
.btn:disabled { cursor: not-allowed; opacity: 0.7; transform: none; }

.btn-primary {
  background: var(--brand-gradient); border-color: transparent; color: #fff;
}
.btn-primary:hover { box-shadow: var(--shadow-md); }

.btn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.investigate-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; position: relative; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.form-field input {
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary); font-size: 14px;
  font-family: inherit;
}
.form-field input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.form-field input:disabled { opacity: 0.6; }
.form-error {
  /* Absolutely positioned so showing/hiding it doesn't change .form-field's
     height — otherwise the parent form's align-items:flex-end shifts the
     submit button down to re-match the now-taller field, visibly misaligning
     it from the input the moment an error appears. Width matches the field
     itself so long messages wrap within it instead of overflowing. */
  position: absolute; top: 100%; left: 0; width: 100%; margin: 4px 0 0;
  font-size: 12px; color: var(--status-serious); font-weight: 500;
}
.form-error[hidden] { display: none; }

.investigate-running { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text-secondary); font-size: 13.5px; }
.investigate-result { animation: fade-in-up 0.35s ease both; }
.investigate-summary { margin: 12px 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.investigate-log summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-top: 14px; }
.investigate-log summary:hover { color: var(--brand); }
.investigate-log[open] summary { margin-bottom: 4px; }

.scan-trigger-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#scan-last-run { margin: 10px 0 0; font-size: 12.5px; }
.scan-log { margin-top: 16px; max-height: 480px; }
