:root {
  color-scheme: dark;
  --bg: #090a0a;
  --bg-raised: #0d0f0e;
  --surface: #111512;
  --surface-strong: #161b17;
  --surface-soft: #1b211c;
  --line: #293329;
  --line-strong: #405044;
  --text: #f3f7ff;
  --text-soft: #c6cbc5;
  --text-muted: #89928b;
  --accent: #ea8622;
  --accent-strong: #ffca05;
  --accent-ink: #1c1003;
  --good: #35d49a;
  --warning: #f5b642;
  --danger: #ff7068;
  --info: #73b6ff;
  --excluded: #a98cff;
  --focus: #ffca05;
  --brand-orange: #ea8622;
  --brand-yellow: #ffca05;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 250px;
  --topbar-height: 76px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .66;
}

::selection {
  color: var(--accent-ink);
  background: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--accent-ink);
  background: var(--accent-strong);
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 180ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript {
  position: fixed;
  z-index: 2000;
  inset: 16px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #2c0907;
  background: #ffd7d4;
  font-weight: 700;
  text-align: center;
}

/* Authentication is the only public-facing view. The operational shell is
   hidden and inert until /api/auth/session explicitly authenticates it. */
.auth-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(28px, 5vh, 58px) 22px 82px;
  isolation: isolate;
  background: #050606;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-grid {
  display: none;
}

.auth-glow {
  position: absolute;
  z-index: -1;
  bottom: -20rem;
  left: 50%;
  width: min(78rem, 120vw);
  height: 42rem;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(229, 148, 44, .42), rgba(139, 79, 18, .12) 38%, transparent 70%);
  filter: blur(24px);
  transform: translateX(-50%);
}

.brand-mark {
  width: 42px;
  height: 42px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 202, 5, .34);
  border-radius: 12px;
  background: linear-gradient(145deg, #f4a42a, #d76611);
  box-shadow: 0 10px 26px rgba(234, 134, 34, .2);
}

.brand-mark img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.brand-mark-small {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark-small img {
  width: 36px;
  height: 36px;
}

.brand-wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  letter-spacing: -.01em;
}

.brand-wordmark strong {
  font-size: 16px;
  letter-spacing: .035em;
}

.brand-wordmark span {
  color: var(--brand-orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.auth-layout {
  width: min(450px, 100%);
  display: grid;
  gap: 26px;
  margin: auto;
}

.auth-context {
  display: grid;
  justify-items: center;
  text-align: center;
}

.auth-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .52));
}

.auth-lockup {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 13px;
  margin: 14px 0 0;
  color: #f7f7f4;
  font: 800 clamp(22px, 3vw, 29px)/1.1 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .06em;
  white-space: nowrap;
}

.auth-lockup i {
  color: #5d5d5a;
  font-style: normal;
  font-weight: 300;
}

.auth-lockup em {
  color: var(--brand-orange);
  font-style: normal;
}

.auth-lockup span {
  text-transform: none;
}

.auth-kicker {
  margin-top: 24px;
  color: #d8ad65;
  font: 750 10px/1.2 "Cascadia Code", Consolas, monospace;
  letter-spacing: .34em;
  text-transform: uppercase;
}

.auth-context > p {
  margin: 13px 0 0;
  color: #aaa9a4;
  font-size: 14px;
}

.auth-context > small {
  margin-top: 8px;
  color: #777872;
  font-size: 10px;
  letter-spacing: .045em;
}

.auth-panel {
  display: grid;
  align-items: center;
  min-height: 326px;
  padding: 24px;
  border: 1px solid rgba(218, 170, 91, .28);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(25, 22, 17, .86), rgba(13, 14, 14, .9));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .52), 0 16px 42px rgba(196, 119, 30, .08);
  backdrop-filter: blur(18px);
}

.session-check {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-soft);
  font-weight: 700;
}

.session-check-mark {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--brand-yellow);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-form {
  display: grid;
  gap: 14px;
}

.form-heading {
  margin-bottom: 4px;
}

.form-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.form-heading p {
  margin: 7px 0 0;
  color: #8e8d87;
  font-size: 12px;
}

.form-heading > span {
  display: block;
  margin-bottom: 8px;
  color: #b08e57;
  font: 750 9px/1.2 "Cascadia Code", Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #b1a485;
  font: 750 9px/1.2 "Cascadia Code", Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #2b2821;
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: rgba(3, 5, 5, .76);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-form input:hover {
  border-color: #6c5633;
}

.login-form input:focus {
  border-color: #d49a40;
  box-shadow: 0 0 0 3px rgba(212, 154, 64, .14);
}

.login-form input[aria-invalid="true"] {
  border-color: var(--danger);
}

.password-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.password-actions .quiet-button {
  min-height: 50px;
  padding-inline: 18px;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
  background: transparent;
}

.password-actions .quiet-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

.form-error {
  min-height: 22px;
  margin: -6px 0 0;
  color: #ffb7b2;
  font-size: 13px;
  font-weight: 700;
}

.primary-button,
.quiet-button,
.account-button,
.menu-button,
.retry-button,
.sidebar-close {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease);
}

.primary-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: fit-content;
  min-width: 112px;
  min-height: 44px;
  padding: 10px 16px;
  color: #201204;
  background: linear-gradient(110deg, #ea8622, #ffca05);
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(229, 145, 39, .18);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(110deg, #f29530, #ffd649);
  transform: translateY(-1px);
}

.primary-button b { font-size: 16px; font-weight: 600; }

.button-progress {
  width: 15px;
  height: 15px;
  display: none;
  border: 2px solid rgba(4, 17, 29, .36);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.primary-button.is-loading .button-progress {
  display: inline-block;
}

.auth-foot {
  position: absolute;
  right: 18px;
  bottom: 25px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  color: #6f706b;
  font: 650 10px/1.3 "Cascadia Code", Consolas, monospace;
  letter-spacing: .035em;
}

.auth-foot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 12px rgba(53, 212, 154, .72);
}

.auth-foot b { color: #3f413d; }

/* Application shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: #0a0c0b;
  box-shadow: 18px 0 44px rgba(0, 0, 0, .24);
}

.sidebar-brand {
  min-height: 44px;
  padding: 0 8px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  padding: 0 12px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 750;
}

.site-identity {
  display: grid;
  gap: 2px;
  margin: 24px 2px 22px;
  padding: 16px 14px;
  border: 1px solid #303b32;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #141915, #0f1210);
}

.site-identity span,
.site-identity small {
  color: var(--text-muted);
  font-size: 12px;
}

.site-identity strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-identity-label {
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.portfolio-lockup {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 1px 8px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.portfolio-lockup span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.portfolio-lockup b {
  color: var(--brand-orange);
  font-size: 13px;
  letter-spacing: .02em;
}

.portfolio-lockup i {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 9px;
  font-style: normal;
}

.site-navigation {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.nav-section {
  margin: 24px 10px 8px;
  color: var(--text-muted);
  font: 800 10px/1.2 "Cascadia Code", Consolas, monospace;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.nav-section:first-child {
  margin-top: 0;
}

.nav-link {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--text-soft);
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 720;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #7f8981;
  transition: color 160ms ease;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-link:hover {
  color: var(--text);
  background: #171b18;
}

.nav-link[aria-current="page"] {
  color: #fff;
  background: linear-gradient(100deg, #d86b16, #ed8b22);
  box-shadow: 0 10px 22px rgba(202, 95, 14, .16);
}

.nav-link[aria-current="page"] .nav-icon {
  color: #fff;
}

.sidebar-foot {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 18px 8px 2px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 11px;
}

.readonly-seal {
  color: var(--good);
  font-weight: 800;
}

.readonly-seal i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--good);
}

.workspace {
  position: relative;
  min-width: 0;
  grid-column: 2;
}

.topbar {
  position: absolute;
  z-index: 40;
  top: 0;
  right: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(20px, 2.4vw, 36px);
  background: transparent;
}

.menu-button {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  color: var(--text-soft);
  background: var(--surface);
}

.menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.menu-button b {
  margin-left: 5px;
  font-size: 12px;
}

.topbar-heading {
  display: none;
}

.topbar-heading span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.topbar-heading strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.connection-state {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

.connection-state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.connection-state[data-state="ready"] i { background: var(--good); }
.connection-state[data-state="warming"] i,
.connection-state[data-state="stale"] i,
.connection-state[data-state="partial"] i { background: var(--warning); }
.connection-state[data-state="invalid"] i,
.connection-state[data-state="offline"] i,
.connection-state[data-state="error"] i { background: var(--danger); }
.connection-state[data-state="excluded"] i { background: var(--excluded); }

.quiet-button {
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.quiet-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 5px;
  background: transparent;
}

.account-button:hover {
  background: var(--surface);
}

.account-initials {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.account-copy {
  display: grid;
  max-width: 150px;
  text-align: left;
}

.account-copy strong,
.account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong { font-size: 12px; }
.account-copy small { color: var(--text-muted); font-size: 11px; }

.account-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% - 6px);
  right: clamp(20px, 3vw, 42px);
  width: 230px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .34);
}

.account-menu p {
  display: grid;
  margin: 0 0 10px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line);
}

.account-menu p span {
  color: var(--text-muted);
  font-size: 12px;
}

.account-menu button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #ffc3bf;
  background: #38201e;
  font-weight: 800;
}

main {
  width: min(1560px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 20px clamp(24px, 2.4vw, 38px) 46px;
}

.screen-intro {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 66px;
  margin-bottom: 18px;
  padding: 0 390px 10px 14px;
  border-bottom: 1px solid #302b22;
}

.screen-intro::before {
  position: absolute;
  top: 0;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--brand-orange);
  content: "";
}

.screen-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #c09256;
  font: 760 9px/1.2 "Cascadia Code", Consolas, monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.screen-intro h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -.026em;
}

.screen-intro p {
  max-width: 68ch;
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.screen-meta {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-chip,
.evidence-chip,
.state-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--bg-raised);
  font-size: 11px;
  font-weight: 800;
}

.meta-chip i,
.state-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.global-notice,
.state-banner {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: var(--surface);
}

.state-banner-mark {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.state-banner-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.state-banner-copy strong {
  color: var(--text);
}

.state-banner-copy span {
  font-size: 13px;
}

.state-banner[data-state="ready"] .state-banner-mark { background: var(--good); }
.state-banner[data-state="warming"] .state-banner-mark,
.state-banner[data-state="stale"] .state-banner-mark,
.state-banner[data-state="partial"] .state-banner-mark { background: var(--warning); }
.state-banner[data-state="invalid"] .state-banner-mark,
.state-banner[data-state="offline"] .state-banner-mark,
.state-banner[data-state="error"] .state-banner-mark { background: var(--danger); }
.state-banner[data-state="unavailable"] .state-banner-mark { background: var(--text-muted); }
.state-banner[data-state="excluded"] .state-banner-mark { background: var(--excluded); }

.state-banner .retry-button {
  min-width: max-content;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.state-banner .retry-button:hover { background: var(--surface-soft); }

.screen-content {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 420px;
}

.screen-stack {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 20px;
}

.screen-stack > * {
  min-width: 0;
  max-width: 100%;
}

.operations-board {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.board-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.board-header > div,
.section-header > div { min-width: 0; max-width: 100%; }

.board-header {
  min-height: 64px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.board-header h2,
.section-header h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.015em;
}

.board-header p,
.section-header p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.facts-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fact {
  min-width: 0;
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.fact:last-child { border-right: 0; }

.fact span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.fact strong {
  overflow: hidden;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.fact small {
  color: var(--text-soft);
  font-size: 11px;
}

.section-block {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}

.section-header {
  margin-bottom: 16px;
}

.status-list,
.issue-list,
.system-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.status-row,
.issue-row,
.system-row {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
}

.status-row {
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto) minmax(120px, auto);
}

.issue-row {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.issue-row > i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
}

.issue-row[data-severity="critical"] > i,
.issue-row[data-severity="error"] > i { background: var(--danger); }
.issue-row[data-state="excluded"] > i { background: var(--excluded); }

.status-row strong,
.issue-row strong,
.system-row strong {
  font-size: 13px;
}

.status-row small,
.issue-row small,
.system-row small {
  color: var(--text-muted);
  font-size: 12px;
}

.status-row > span,
.status-row > time {
  color: var(--text-soft);
  font-size: 12px;
  text-align: right;
}

.system-row {
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(100px, .55fr)) auto;
}

.system-primary {
  min-width: 0;
  display: grid;
}

.system-primary strong,
.system-primary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-value {
  display: grid;
  gap: 2px;
}

.system-value span {
  color: var(--text-muted);
  font-size: 11px;
}

.system-value strong {
  font-variant-numeric: tabular-nums;
}

.table-shell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  scrollbar-color: var(--line-strong) var(--surface);
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table th {
  color: var(--text-muted);
  background: var(--surface-strong);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  color: var(--text-soft);
  background: var(--surface);
  font-size: 13px;
}

.data-table tbody tr:hover td { background: var(--surface-strong); }
.data-table td:first-child { color: var(--text); font-weight: 750; }

.state-chip[data-state="ready"] { color: #9cf0cd; border-color: #28775a; }
.state-chip[data-state="warming"],
.state-chip[data-state="stale"],
.state-chip[data-state="partial"] { color: #ffe0a0; border-color: #79602a; }
.state-chip[data-state="invalid"],
.state-chip[data-state="offline"],
.state-chip[data-state="error"] { color: #ffc0bc; border-color: #7b403e; }
.state-chip[data-state="excluded"] { color: #dacdff; border-color: #5f4f8b; }
.state-chip[data-state="empty"],
.state-chip[data-state="unavailable"] { color: var(--text-soft); }

.state-chip i { background: currentColor; }

.evidence-chip[data-evidence="reported"] { color: #d2dced; border-color: #4a607e; }
.evidence-chip[data-evidence="observed_unconfirmed"] { color: #bee0ff; border-color: #3e6993; }
.evidence-chip[data-evidence="approved"] { color: #9cf0cd; border-color: #28775a; }
.evidence-chip[data-evidence="needs_review"] { color: #ffc0bc; border-color: #7b403e; }
.evidence-chip[data-evidence="excluded"] { color: #dacdff; border-color: #5f4f8b; }

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, .6fr);
  gap: 20px;
}

.coverage-list {
  margin: 0;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.coverage-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  background: var(--surface);
}

.coverage-list dt { color: var(--text-muted); font-size: 12px; }
.coverage-list dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }

.trend-figure {
  margin: 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.trend-figure figcaption {
  display: grid;
  margin-bottom: 14px;
}

.trend-figure figcaption strong { font-size: 13px; }
.trend-figure figcaption span { color: var(--text-muted); font-size: 12px; }

.trend-chart {
  width: 100%;
  height: auto;
  max-height: 340px;
  display: block;
  overflow: visible;
}

.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis-label,
.chart-axis-caption { fill: var(--text-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-series { fill: none; stroke: var(--series-color); stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--series-color); stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-point:focus { outline: none; stroke: var(--focus); stroke-width: 4; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 0 18px 12px;
}

.chart-legend > span {
  display: inline-grid;
  grid-template-columns: 12px auto;
  align-items: center;
  gap: 2px 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

.chart-legend i {
  width: 11px;
  height: 3px;
  grid-row: 1 / 3;
  border-radius: 2px;
  background: var(--series-color);
}

.chart-legend small {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.trend-details {
  margin: 12px 18px 18px;
  color: var(--text-soft);
  font-size: 12px;
}

.visualization-section {
  padding: 0;
  overflow: hidden;
}

.visualization-section > .section-header {
  padding: 20px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

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

.visualization-panel {
  min-width: 0;
  min-height: 270px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.visualization-panel:nth-child(2n) { border-right: 0; }
.visualization-panel:nth-last-child(-n + 2) { border-bottom: 0; }
.visualization-panel:nth-child(odd):last-child { grid-column: 1 / -1; border-right: 0; }

.visualization-panel > header {
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.visualization-panel h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -.01em;
}

.visualization-panel header p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.visualization-panel .trend-figure {
  margin-top: 12px;
  background: transparent;
}

.visualization-panel .chart-legend { padding-inline: 0; }

.chart-unavailable {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  text-align: center;
}

.chart-unavailable > span {
  width: 100%;
  max-width: 180px;
  height: 42px;
  position: relative;
  border-bottom: 1px dashed var(--line-strong);
}

.chart-unavailable > span::after {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 1px;
  background: var(--line);
  transform: rotate(-7deg);
  content: "";
}

.chart-unavailable strong { color: var(--text-soft); font-size: 13px; }
.chart-unavailable p { max-width: 42ch; margin: 0; font-size: 11px; }

.trend-workbench { padding-bottom: 16px; }

.trend-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr) repeat(2, minmax(120px, .6fr));
  align-items: end;
  gap: 10px;
}

.trend-toolbar label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.trend-toolbar select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

.trend-toolbar select[multiple] { height: 104px; padding: 5px; }
.trend-toolbar label small { color: var(--text-muted); font-size: 10px; font-weight: 500; }
.trend-toolbar input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
}

.window-navigation { display: flex; flex-wrap: wrap; gap: 8px; }
.selection-error { margin: 12px 0 0; color: var(--danger); font-size: 12px; font-weight: 750; }

.selection-summary {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.selection-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.selection-meta div { min-width: 0; padding: 11px 14px; border-right: 1px solid var(--line); }
.selection-meta div:last-child { border-right: 0; }
.selection-meta dt { color: var(--text-muted); font-size: 10px; font-weight: 750; }
.selection-meta dd { margin: 3px 0 0; color: var(--text-soft); font-size: 12px; overflow-wrap: anywhere; }

.series-contract-list {
  display: grid;
  gap: 8px;
  padding: 0 18px 14px;
}

.series-contract-list .selection-meta {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.selection-warnings {
  display: grid;
  gap: 4px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: var(--warning);
  font-size: 11px;
}

.selection-warnings span { color: var(--text-soft); }

.compact-button { min-height: 40px; padding: 0 16px; }
.trend-policy,
.report-method { margin: 13px 0 0; color: var(--text-muted); font-size: 11px; }
.chart-loading-state { min-height: 240px; display: grid; place-items: center; color: var(--text-muted); border: 1px solid var(--line); background: var(--surface); }

.cell-note { display: block; max-width: 42ch; margin-top: 6px; color: var(--text-muted); font-weight: 400; }

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.report-provenance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.report-provenance div { min-width: 0; padding: 11px 13px; background: var(--surface); }
.report-provenance dt { color: var(--text-muted); font-size: 10px; font-weight: 750; }
.report-provenance dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 11px; }

.report-row {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px;
  background: var(--surface);
}

.report-row > div { min-width: 0; display: grid; gap: 4px; }
.report-row strong { font-size: 13px; }
.report-row span:not(.state-chip) { color: var(--text-muted); font-size: 11px; }

.trend-details summary {
  width: fit-content;
  padding: 6px 0;
  color: var(--info);
  font-weight: 750;
  cursor: pointer;
}

.key-value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.key-value-grid div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 15px;
  background: var(--surface);
}

.key-value-grid span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.key-value-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.empty-state {
  min-height: 310px;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-state > div {
  max-width: 56ch;
}

.empty-state-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text-soft);
  font-weight: 850;
}

.empty-state h2 {
  margin: 0;
  font-size: 19px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.empty-state .retry-button {
  margin-top: 20px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--surface);
  font-weight: 800;
}

.skeleton-stack {
  display: grid;
  gap: 16px;
}

.skeleton-block {
  height: 150px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.skeleton-block:first-child { height: 210px; }

.skeleton-block::after {
  width: 42%;
  height: 100%;
  display: block;
  background: rgba(255, 255, 255, .035);
  transform: translateX(-100%);
  animation: skeleton 1.5s var(--ease) infinite;
  content: "";
}

@keyframes skeleton {
  to { transform: translateX(350%); }
}

.mobile-scrim {
  position: fixed;
  z-index: 45;
  inset: 0;
  background: rgba(0, 0, 0, .64);
}

@media (max-width: 1120px) {
  :root { --sidebar-width: 248px; }
  .facts-ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(2) { border-right: 0; }
  .fact:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .system-row { grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(90px, .5fr)) auto; }
  .system-row .system-value:nth-of-type(3) { display: none; }
  .trend-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-provenance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .auth-context h1 { max-width: 19ch; font-size: 46px; }
  .auth-panel { min-height: auto; }

  .app-shell { display: block; }

  .sidebar {
    width: min(328px, calc(100vw - 48px));
    transform: translateX(-104%);
    transition: transform 210ms var(--ease);
  }

  .app-shell.is-nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-flex; align-items: center; }
  .workspace { width: 100%; }
  .topbar {
    position: sticky;
    min-height: 66px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 10, 10, .96);
    backdrop-filter: blur(16px);
  }
  .menu-button { display: inline-flex; }
  .two-column { grid-template-columns: 1fr; }
  .visualization-grid { grid-template-columns: 1fr; }
  .visualization-panel,
  .visualization-panel:nth-child(2n),
  .visualization-panel:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .visualization-panel:last-child { border-bottom: 0; }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auth-view { gap: 24px; padding: 22px 18px 84px; }
  .brand-wordmark span { display: none; }
  .auth-logo { width: 64px; height: 64px; }
  .auth-lockup { flex-wrap: wrap; gap: 7px; font-size: 19px; white-space: normal; }
  .auth-context > p { font-size: 13px; }
  .auth-assurances { grid-template-columns: 1fr; }
  .auth-assurances div,
  .auth-assurances div:first-child {
    padding: 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .auth-assurances div:last-child { border-bottom: 0; }
  .auth-panel { padding: 24px 20px; }
  .password-actions { grid-template-columns: 1fr; }

  .topbar {
    min-height: 66px;
    gap: 8px;
    padding: 9px 14px;
  }

  .topbar-heading { display: none; }
  .connection-state span { display: none; }
  .connection-state { padding: 6px; }
  .quiet-button { padding: 0 10px; }
  .account-copy { display: none; }
  .account-button { padding-right: 5px; }
  .account-menu { right: 14px; }

  main { padding: 24px 16px 38px; }

  .state-banner {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .state-banner .retry-button {
    grid-column: 2;
    min-width: 0;
    width: fit-content;
    margin-left: 0;
  }

  .global-notice,
  .state-banner-copy,
  .section-header,
  .report-row,
  .report-provenance dd { overflow-wrap: anywhere; }

  .screen-intro {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
    min-height: 0;
    padding: 0 0 14px 12px;
  }

  .screen-intro h1 { font-size: 26px; }
  .screen-meta { justify-content: flex-start; }
  .facts-ledger { grid-template-columns: 1fr; }
  .fact,
  .fact:nth-child(2) {
    min-height: 88px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .fact:last-child { border-bottom: 0; }
  .fact strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .board-header,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-row {
    grid-template-columns: 1fr auto;
  }

  .status-row > time { grid-column: 1 / -1; text-align: left; }

  .system-row {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .system-row .system-value {
    display: none;
  }

  .issue-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .issue-row .state-chip {
    grid-column: 2;
    width: fit-content;
  }

  .key-value-grid { grid-template-columns: 1fr; }
  .trend-chart { height: 180px; }
  .trend-toolbar { grid-template-columns: 1fr; }
  .trend-toolbar .quiet-button,
  .trend-toolbar .primary-button { width: 100%; min-height: 44px; }
  .trend-toolbar select,
  .trend-toolbar input,
  .window-navigation .quiet-button { min-height: 44px; }
  .window-navigation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .visualization-panel { min-height: 240px; padding: 16px; }
  .chart-legend { display: grid; padding-inline: 0; }
  .chart-axis-label { font-size: 12px; }
  .report-row { align-items: flex-start; flex-direction: column; }
  .report-provenance { grid-template-columns: 1fr; }
  .selection-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selection-meta div:nth-child(2) { border-right: 0; }
  .selection-meta div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .series-contract-list { padding-inline: 0; }
  .series-contract-list .selection-meta { grid-template-columns: 1fr; }
  .series-contract-list .selection-meta div { border-right: 0; border-bottom: 1px solid var(--line); }
  .series-contract-list .selection-meta div:last-child { border-bottom: 0; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead { display: none; }

  .data-table tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .data-table tr:last-child { border-bottom: 0; }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(100px, .8fr) minmax(0, 1.2fr);
    gap: 12px;
    padding: 6px 0;
    border: 0;
    background: transparent;
  }

  .data-table td::before {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    content: attr(data-label);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .skip-link,
  .retry-button { display: none !important; }
  .workspace { width: 100%; }
  main { max-width: none; padding: 0; }
  body,
  .section-block,
  .operations-board,
  .fact,
  .data-table td { color: #111; background: #fff; }
  .trend-toolbar,
  .global-notice,
  .chart-unavailable > span { display: none !important; }
  .report-provenance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visualization-panel,
  .report-row { break-inside: avoid; }
}
