/* USHS Applied Intelligence — night station
   Brand: Black #0B0B0B · Orange #E87722 · Station Gray #5C5468 · Paper #F4EFE8
   Fonts: Fraunces (display) · Atkinson Hyperlegible (body) · IBM Plex Mono (code)
*/

:root {
  --black:   #0B0B0B;
  --orange:  #E87722;
  --gray:    #5C5468;
  --paper:   #F4EFE8;
  --surface: #161310;
  --surface2: #1E1A16;
  --surface3: #26211C;
  --border:  rgba(244, 239, 232, 0.10);
  --border2: rgba(244, 239, 232, 0.18);
  --text:    #F4EFE8;
  --text-dim: #C4BBB0;
  --text-muted: #8A827A;
  --orange-dim: #c46216;
  --orange-glow: rgba(232, 119, 34, 0.16);
  --radius:  8px;
  --radius-lg: 14px;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --rail-bg: #0B0B0B;
  --rail-ink: #F4EFE8;
  --rail-muted: #8A827A;
  --strip-bg: rgba(11, 11, 11, 0.92);
  --job-bg: #161310;
  --dock-bg: #161310;
  --dock-ink: #F4EFE8;
}

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

html { font-size: 16px; }

body {
  background:
    radial-gradient(70% 55% at 12% -10%, rgba(232, 119, 34, 0.16), transparent 55%),
    radial-gradient(55% 40% at 100% 100%, rgba(92, 84, 104, 0.28), transparent 50%),
    var(--black);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }

/* ── NAV ───────────────────────────────────────────────────────────────────── */
.nav {
  background: rgba(11, 11, 11, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -3px 0 var(--orange);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 76px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo { height: 52px; width: auto; object-fit: contain; }
.nav-wordmark {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.nav-link {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}
.nav-link:hover, .nav-link.active {
  color: var(--orange);
  background: var(--orange-glow);
  text-decoration: none;
}
.nav-link.active { color: var(--orange); }
.nav-logout {
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.nav-logout:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }

/* dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 150px;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu { display: flex; flex-direction: column; }
.nav-dropdown-menu .nav-link { display: block; padding: 7px 12px; white-space: nowrap; }

/* ── MAIN ──────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  width: 100%;
}

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: var(--black);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── PAGE HEADER ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 36px; }
.page-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
}
.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-optical-sizing: auto;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}
.page-sub { color: var(--text-dim); font-size: 15px; }

/* ── BADGES ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  vertical-align: middle;
}
.badge-measured  { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.badge-modeled   { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-assumed   { background: rgba(234,179,8,0.15);  color: #fbbf24; border: 1px solid rgba(234,179,8,0.3); }
.badge-not-captured { background: rgba(107,114,128,0.15); color: #9ca3af; border: 1px solid rgba(107,114,128,0.3); }
.badge-orange    { background: var(--orange-glow); color: var(--orange); border: 1px solid rgba(232,119,34,0.4); }
.badge-muted     { background: var(--surface3); color: var(--text-muted); border: 1px solid var(--border2); }
.badge-bipa      { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-vawa      { background: rgba(168,85,247,0.15); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.3); }
.badge-live      { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.badge-unwired   { background: rgba(234,179,8,0.15); color: #fbbf24; border: 1px solid rgba(234,179,8,0.3); }

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-orange  { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #d06918; text-decoration: none; }
.btn-secondary { background: var(--surface3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--surface2); border-color: var(--orange); color: var(--orange); text-decoration: none; }
.btn-agent { background: var(--orange-glow); color: var(--orange); border: 1px solid rgba(232,119,34,0.3); margin-top: 12px; }
.btn-agent:hover { background: var(--orange); color: #fff; text-decoration: none; }

/* ── KPI GRID ──────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.kpi-card {
  background: linear-gradient(180deg, rgba(232,119,34,.06), transparent 42%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 10px; right: 10px; top: 8px;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(232,119,34,.45) 0 6px, transparent 6px 10px);
  opacity: .55;
}
.kpi-card:hover { border-color: rgba(232,119,34,.45); transform: translateY(-2px); }
.kpi-orange { border-left: 3px solid var(--orange); }
.kpi-gray   { border-left: 3px solid var(--gray); }
.kpi-muted  { border-left: 3px solid var(--border2); }
.kpi-icon {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  flex-shrink: 0;
  min-width: 2.4em;
}
.kpi-value { font-family: 'Fraunces', Georgia, serif; font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 4px; }
.kpi-value.kpi-nc { color: var(--text-muted); font-style: italic; font-size: 16px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.kpi-provenance { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-source { font-size: 11px; color: var(--text-muted); }

/* ── SECTION ROW ───────────────────────────────────────────────────────────── */
.section-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 28px; }
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}
.section-title { font-family: 'Fraunces', Georgia, serif; font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.section-body  { font-size: 14px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.7; }
.chain-pills { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.chain-pill { font-family: 'IBM Plex Mono', monospace; font-size: 12px; background: var(--surface3); border: 1px solid var(--border2); padding: 5px 10px; border-radius: 4px; color: var(--orange); }
.billing-paradox-badge { background: rgba(234,179,8,0.1); border: 1px solid rgba(234,179,8,0.3); color: #fbbf24; font-size: 12px; padding: 7px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.retention-stat { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.retention-val  { font-family: 'Fraunces', Georgia, serif; font-size: 32px; font-weight: 700; color: var(--orange); }
.retention-label { font-size: 13px; color: var(--text-dim); }
.nc-text { color: var(--text-muted); font-style: italic; }

/* ── HONESTY BANNER ────────────────────────────────────────────────────────── */
.honesty-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  font-size: 13px;
  color: var(--text-dim);
}
.honesty-icon { font-size: 20px; flex-shrink: 0; }

/* ── LOGIN ─────────────────────────────────────────────────────────────────── */
.login-body {
  background:
    radial-gradient(80% 70% at 50% -20%, rgba(232,119,34,.22), transparent 55%),
    radial-gradient(50% 40% at 80% 110%, rgba(92,84,104,.35), transparent 50%),
    #070707;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-stage { width: 100%; max-width: 440px; padding: 32px 24px 48px; text-align: center; }
.login-logo-hero { height: 148px; width: auto; object-fit: contain; display: block; margin: 0 auto 18px; filter: drop-shadow(0 16px 36px rgba(232,119,34,.28)); }
.login-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--orange); margin-bottom: 8px; }
.login-line { font-family: var(--display); font-size: 20px; font-weight: 500; line-height: 1.35; color: var(--paper); margin: 0 auto 28px; max-width: 28ch; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-card { background: rgba(22,19,16,.88); border: 1px solid var(--border2); border-radius: var(--radius-lg); padding: 32px 28px; text-align: left; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.login-logo  { height: 40px; width: auto; object-fit: contain; }
.login-org   { font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--text); }
.login-product { font-family: var(--mono); font-size: 11px; color: var(--orange); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.login-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 20px; }
.login-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); letter-spacing: 0.04em; margin-bottom: 6px; margin-top: 18px; }
.login-input { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text); font-family: var(--sans); font-size: 16px; padding: 12px 14px; outline: none; transition: border-color 0.15s; }
.login-input:focus { border-color: var(--orange); }
.login-btn { width: 100%; background: var(--orange); color: #fff; border: none; border-radius: 999px; font-family: var(--sans); font-size: 16px; font-weight: 700; padding: 13px; margin-top: 24px; cursor: pointer; transition: background 0.15s, transform 0.15s; }
.login-btn:hover { background: var(--orange-dim); transform: translateY(-1px); }
.login-footer { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 24px; line-height: 1.6; }

/* ── CHAT ──────────────────────────────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; height: calc(100vh - 220px); min-height: 500px; }
.chat-sidebar { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.agent-select-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 4px; }
.agent-btn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
.agent-btn:hover { border-color: var(--border2); background: var(--surface2); }
.agent-btn-active { border-color: var(--orange) !important; background: var(--orange-glow) !important; }
.agent-icon { font-size: 16px; flex-shrink: 0; }
.agent-btn-name { font-size: 13px; font-weight: 600; color: var(--text); }
.agent-btn-role { font-size: 11px; color: var(--text-muted); }
.chat-note { font-size: 11px; color: var(--text-muted); padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; line-height: 1.6; }
.chat-main { display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.chat-msg { display: flex; gap: 12px; align-items: flex-start; }
.chat-msg-user { flex-direction: row-reverse; }
.chat-msg-user .chat-msg-body { background: var(--orange-glow); border-color: rgba(232,119,34,0.3); }
.chat-msg-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.chat-msg-body { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; color: var(--text); max-width: 85%; line-height: 1.7; }
.chat-msg-system .chat-msg-body { border-color: rgba(232,119,34,0.2); }
.chat-form { display: flex; gap: 8px; }
.chat-input { flex: 1; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text); font-family: var(--sans); font-size: 16px; padding: 12px 14px; resize: none; outline: none; transition: border-color 0.15s; }
.chat-input:focus { border-color: var(--orange); }
.chat-send { background: var(--orange); color: #fff; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; padding: 0 20px; cursor: pointer; transition: background 0.15s; }
.chat-send:hover:not(:disabled) { background: var(--orange-dim); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-status { font-size: 12px; color: var(--text-muted); min-height: 18px; }
.chat-error { color: #f87171; }

/* ── CORPUS ────────────────────────────────────────────────────────────────── */
.corpus-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.corpus-search { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text); font-size: 14px; padding: 8px 12px; outline: none; margin-bottom: 12px; }
.corpus-search:focus { border-color: var(--orange); }
.corpus-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.corpus-file { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 6px; font-size: 12px; }
.corpus-file-folder { color: var(--text-muted); display: block; }
.corpus-file-name { color: var(--text-dim); font-weight: 600; }
.corpus-file-size { color: var(--text-muted); float: right; }
.corpus-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.corpus-grounding-title { font-family: 'Fraunces', Georgia, serif; font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.corpus-pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; font-size: 12px; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; max-height: 65vh; overflow-y: auto; line-height: 1.8; }
.corpus-results-title { font-family: 'Fraunces', Georgia, serif; font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.corpus-hit { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; }
.corpus-hit-text { font-size: 14px; color: var(--text); margin-bottom: 8px; line-height: 1.7; }
.corpus-hit-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.corpus-no-hits { color: var(--text-muted); font-size: 14px; padding: 16px 0; }

/* ── TELEMETRY ─────────────────────────────────────────────────────────────── */
.tele-banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.banner { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; line-height: 1.6; }
.banner-bipa { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #93c5fd; }
.banner-vawa { background: rgba(168,85,247,0.08); border: 1px solid rgba(168,85,247,0.25); color: #d8b4fe; }
.banner-coaching { background: rgba(232,119,34,0.08); border: 1px solid rgba(232,119,34,0.25); color: var(--orange); }
.tele-edge-status { margin-bottom: 20px; font-size: 13px; }
.tele-edge-label { color: var(--text-muted); margin-right: 8px; }
.tele-edge-live { color: #4ade80; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.tele-edge-synthetic { color: #fbbf24; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.tele-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tele-node { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: border-color 0.15s; }
.tele-node-ok      { border-left: 3px solid #4ade80; }
.tele-node-warning { border-left: 3px solid #fbbf24; }
.tele-node-loading { border-left: 3px solid var(--border2); opacity: 0.6; }
.tele-node-label   { font-family: 'Fraunces', Georgia, serif; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.tele-load-bar     { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; flex: 1; }
.tele-load-fill    { height: 100%; background: var(--orange); border-radius: 3px; transition: width 0.5s; }
.tele-node-load    { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tele-load-pct     { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.tele-node-meta    { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); }
.tele-advisory     { font-size: 11px; color: #fbbf24; margin-top: 6px; }
.tele-synthetic-note { font-size: 10px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.tele-legend       { display: flex; gap: 20px; margin-bottom: 16px; font-size: 12px; color: var(--text-muted); }
.legend-item       { display: flex; align-items: center; gap: 6px; }
.legend-dot        { width: 10px; height: 10px; border-radius: 50%; }
.legend-ok         { background: #4ade80; }
.legend-warning    { background: #fbbf24; }
.legend-synthetic  { background: var(--border2); }
.tele-disclaimer   { font-size: 12px; color: var(--text-muted); font-style: italic; line-height: 1.7; }

/* ── AGENTS ────────────────────────────────────────────────────────────────── */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 36px; }
.agent-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.agent-card-orch { border-color: rgba(232,119,34,0.4); }
.agent-card-header { display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: linear-gradient(135deg, var(--surface2), var(--surface3)); border-bottom: 1px solid var(--border); position: relative; }
.agent-card-icon  { font-size: 24px; flex-shrink: 0; }
.agent-card-name  { font-family: 'Fraunces', Georgia, serif; font-size: 20px; font-weight: 700; color: var(--text); line-height: 1; }
.agent-card-role  { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }
.agent-orch-badge { font-size: 10px; background: var(--orange); color: #fff; padding: 3px 8px; border-radius: 3px; position: absolute; top: 14px; right: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.agent-veto-badge { font-size: 10px; background: rgba(168,85,247,0.3); color: #d8b4fe; padding: 3px 8px; border-radius: 3px; position: absolute; top: 14px; right: 14px; }
.agent-claim-badge { font-size: 9px; background: rgba(234,179,8,0.2); color: #fbbf24; padding: 3px 8px; border-radius: 3px; position: absolute; top: 14px; right: 14px; }
.agent-card-tagline { padding: 12px 20px 0; font-size: 13px; font-weight: 600; color: var(--orange); font-style: italic; }
.agent-card-desc { padding: 8px 20px 0; font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.agent-caps-title, .agent-bounds-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; padding: 12px 20px 4px; }
.agent-caps, .agent-bounds { list-style: none; padding: 0 20px; display: flex; flex-direction: column; gap: 4px; }
.agent-caps li, .agent-bounds li { font-size: 12px; color: var(--text-dim); padding-left: 12px; position: relative; }
.agent-caps li::before { content: '→'; color: var(--orange); position: absolute; left: 0; }
.agent-bounds li::before { content: '⚠'; font-size: 10px; position: absolute; left: 0; }
.agent-bounds li { color: #fbbf24; }
.agent-card .btn { margin: 12px 20px 20px; display: block; text-align: center; }

.chains-section { margin-top: 8px; }
.chains-title { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.chains-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.chain-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.chain-label { font-family: 'Fraunces', Georgia, serif; font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.chain-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.chain-step-pill { background: var(--orange-glow); color: var(--orange); border: 1px solid rgba(232,119,34,0.3); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 4px; font-family: 'IBM Plex Mono', monospace; }
.chain-arrow { color: var(--text-muted); font-size: 14px; }
.chain-trigger { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.chain-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── MCP ───────────────────────────────────────────────────────────────────── */
.mcp-tools { display: flex; flex-direction: column; gap: 16px; }
.mcp-tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.mcp-tool-live   { border-left: 3px solid #4ade80; }
.mcp-tool-unwired { border-left: 3px solid #fbbf24; }
.mcp-tool-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mcp-tool-name   { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 600; color: var(--text); }
.mcp-tool-desc   { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.7; }
.mcp-tool-params-title { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.08em; margin-bottom: 8px; }
.mcp-tool-params { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mcp-param { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; }
.mcp-param-name { font-family: 'IBM Plex Mono', monospace; color: var(--orange); flex-shrink: 0; }
.mcp-param-type  { color: var(--text-muted); flex-shrink: 0; }
.mcp-param-desc  { color: var(--text-dim); }
.mcp-unwired-reason { background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.25); color: #fbbf24; padding: 8px 12px; border-radius: var(--radius); font-size: 12px; margin-bottom: 12px; }
.mcp-try { display: flex; flex-direction: column; gap: 8px; }
.mcp-try-params { display: flex; flex-direction: column; gap: 8px; }
.mcp-param-input { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text); font-family: 'IBM Plex Mono', monospace; font-size: 12px; padding: 8px 12px; resize: vertical; outline: none; width: 100%; }
.mcp-param-input:focus { border-color: var(--orange); }
.mcp-result { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 14px; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; color: var(--text-dim); }
.mcp-result-ok  { border-color: rgba(34,197,94,0.3); color: #4ade80; }
.mcp-result-err { border-color: rgba(239,68,68,0.3); color: #f87171; }
.mcp-badge-live    { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); padding: 2px 8px; border-radius: 3px; font-size: 11px; font-family: 'IBM Plex Mono', monospace; }
.mcp-badge-unwired { background: rgba(234,179,8,0.15); color: #fbbf24; border: 1px solid rgba(234,179,8,0.3); padding: 2px 8px; border-radius: 3px; font-size: 11px; font-family: 'IBM Plex Mono', monospace; }

/* ── HOUSING ───────────────────────────────────────────────────────────────── */
.nc-banner { background: rgba(107,114,128,0.08); border: 1px solid rgba(107,114,128,0.25); color: #9ca3af; padding: 14px 18px; border-radius: var(--radius); font-size: 13px; margin-bottom: 24px; line-height: 1.7; }
.housing-table-wrap { overflow-x: auto; margin-bottom: 28px; }
.housing-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.housing-table th { background: var(--surface2); border: 1px solid var(--border2); padding: 10px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.housing-table td { border: 1px solid var(--border); padding: 10px 14px; color: var(--text-dim); vertical-align: middle; }
.housing-table tr:hover td { background: var(--surface); }
.prop-id   { font-family: 'IBM Plex Mono', monospace; color: var(--orange); font-size: 12px; }
.prop-occ, .prop-hmis { font-style: italic; color: var(--text-muted) !important; }
.housing-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.housing-kpi  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.housing-kpi-val   { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.housing-kpi-val.nc-text { font-size: 16px; }
.housing-kpi-label { font-size: 12px; color: var(--text-muted); }
.housing-note { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 16px; line-height: 1.7; }

/* ── CALAIM ────────────────────────────────────────────────────────────────── */
.calaim-paradox-banner { display: flex; gap: 16px; align-items: flex-start; background: rgba(234,179,8,0.06); border: 1px solid rgba(234,179,8,0.3); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 28px; }
.paradox-icon  { font-size: 24px; flex-shrink: 0; }
.paradox-body  { font-size: 14px; color: var(--text-dim); line-height: 1.7; }
.calaim-codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 28px; }
.calaim-code-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.calaim-code-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.calaim-code   { font-family: 'IBM Plex Mono', monospace; font-size: 18px; font-weight: 700; color: var(--orange); }
.calaim-modifier { font-family: 'IBM Plex Mono', monospace; font-size: 14px; color: #fbbf24; background: rgba(234,179,8,0.1); padding: 2px 8px; border-radius: 3px; }
.calaim-code-name { font-size: 13px; font-weight: 600; color: var(--text); }
.calaim-rate   { font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.calaim-billing { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.calaim-desc   { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.6; }
.calaim-reqs   { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.calaim-req    { font-size: 11px; padding: 3px 9px; border-radius: 3px; font-weight: 600; }
.calaim-req-required { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.calaim-paradox { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; line-height: 1.6; }
.calaim-status { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.calaim-claim-gate { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--orange); border-radius: var(--radius-lg); padding: 24px; }
.claim-gate-title { font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.claim-gate-list { padding-left: 24px; color: var(--text-dim); font-size: 14px; line-height: 2; }
.claim-gate-note { font-size: 12px; color: var(--text-muted); margin-top: 12px; font-family: 'IBM Plex Mono', monospace; }
.claim-gate-note code { background: var(--surface3); padding: 2px 6px; border-radius: 3px; color: var(--orange); }

/* ── WORKFORCE ─────────────────────────────────────────────────────────────── */
.wf-banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.wf-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 28px; }
.wf-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.wf-kpi-alert { border-color: rgba(234,179,8,0.4); }
.wf-kpi-val  { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.wf-kpi-label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.wf-kpi-prov  { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.wf-kpi-note  { font-size: 11px; color: var(--text-muted); font-style: italic; line-height: 1.5; }
.wf-section-title { font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.wf-fabric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; }
.wf-fabric-desc { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 20px; }
.wf-fabric-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; padding: 16px; background: var(--surface2); border-radius: var(--radius); }
.wf-flow-step { text-align: center; padding: 10px; min-width: 100px; }
.wf-flow-icon  { font-size: 24px; margin-bottom: 6px; }
.wf-flow-label { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
.wf-flow-arrow { font-size: 18px; color: var(--orange); flex-shrink: 0; }
.wf-bipa-note  { font-size: 12px; color: #93c5fd; background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 8px; }
.wf-coaching-note { font-size: 12px; color: var(--orange); background: var(--orange-glow); border: 1px solid rgba(232,119,34,0.25); padding: 8px 12px; border-radius: var(--radius); }
.wf-labor-impact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.wf-impact-body { font-size: 14px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.7; }
.wf-impact-prov { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* ── SPECIAL (iframe) ──────────────────────────────────────────────────────── */
.special-header { margin-bottom: 20px; display: flex; flex-direction: column; gap: 4px; }
.special-actions { margin-top: 12px; }
.special-frame-wrap { width: 100%; background: #070707; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.special-frame { width: 100%; height: calc(100vh - 240px); min-height: 520px; border: none; display: block; background: #0B0B0B; }

.agent-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 12px 28px rgba(0,0,0,.22); }
.tele-node { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: border-color 0.15s, transform .15s; }
.tele-node:hover { transform: translateY(-2px); border-color: rgba(232,119,34,.35); }

@media (max-width: 768px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { flex-direction: row; flex-wrap: wrap; }
  .corpus-layout { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .page-title { font-size: 28px; }
  .nav-inner { height: 64px; }
  .nav-logo { height: 44px; }
  .login-logo-hero { height: 112px; }
}

strong { font-weight: 700; color: var(--text); }
em.nc-text { font-style: italic; color: var(--text-muted); }

/* ── APP SHELL (watchfloor) ────────────────────────────────────────────────── */
body.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
}
.rail {
  background: var(--rail-bg);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  text-decoration: none;
  color: var(--rail-ink);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.rail-brand:hover { text-decoration: none; color: var(--rail-ink); }
.rail-logo {
  height: 48px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  flex-shrink: 0;
}
.rail-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.rail-group {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rail-muted);
  padding: 14px 10px 6px;
}
.rail-link {
  display: block;
  color: var(--rail-ink);
  opacity: 0.78;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
}
.rail-link:hover { opacity: 1; background: rgba(255,255,255,.06); text-decoration: none; color: var(--rail-ink); }
.rail-link.on {
  opacity: 1;
  background: rgba(232,119,34,.16);
  box-shadow: inset 3px 0 0 var(--orange);
  color: var(--orange);
}
.rail-foot {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px;
  color: var(--rail-muted);
}
.rail-who { line-height: 1.4; margin-bottom: 8px; }
.rail-out { color: var(--rail-ink); opacity: .7; font-size: 12px; }
.rail-out:hover { opacity: 1; color: var(--orange); text-decoration: none; }

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.strip {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 0 20px;
  background: var(--strip-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.strip-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.strip-stats { display: flex; flex-wrap: wrap; gap: 14px; flex: 1; min-width: 0; }
.st { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.st b { color: var(--text); font-size: 13px; }
.st b.ok { color: #7dcea0; }
.st b.warn { color: var(--orange); }
.strip-ask {
  flex-shrink: 0;
  background: var(--orange);
  color: #0B0B0B;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 6px;
}
.strip-ask:hover { text-decoration: none; filter: brightness(1.08); color: #0B0B0B; }

.app-shell .main {
  flex: 1;
  overflow-y: auto;
  max-width: none;
  margin: 0;
  padding: 20px 22px 96px;
  width: 100%;
}
.app-shell:not(.is-dash) .page-title { font-size: 26px; letter-spacing: -0.02em; }
.app-shell:not(.is-dash) .page-header { margin-bottom: 18px; }
.app-shell.is-chat .page-header { display: none; }
.app-shell.is-chat .ask-dock,
.app-shell.is-special .ask-dock { display: none; }
.app-shell.is-chat .main { padding: 12px 16px 16px; }
.app-shell.is-chat .chat-layout { height: calc(100vh - 76px); min-height: 0; }
.app-shell.is-special .special-header { display: none; }
.app-shell.is-special .main { padding: 0; }
.app-shell.is-special .special-frame-wrap { border: none; border-radius: 0; }
.app-shell.is-special .special-frame { height: calc(100vh - 52px); min-height: 0; }

.ask-dock {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 16px 12px;
  background: var(--dock-bg);
  color: var(--dock-ink);
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  z-index: 40;
}
.ask-chips { display: flex; gap: 6px; }
.ask-chip {
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: var(--dock-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 9px;
  border-radius: 4px;
  cursor: pointer;
}
.ask-chip:hover { border-color: var(--orange); color: var(--orange); }
.ask-input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--dock-ink);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
.ask-input::placeholder { color: var(--rail-muted); }
.ask-input:focus { border-color: var(--orange); }
.ask-go {
  background: var(--orange);
  color: #0B0B0B;
  border: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.board { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.board-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.board-head-acts { display: flex; gap: 8px; flex-shrink: 0; }
.board-head .page-title { font-size: 28px; margin-bottom: 6px; }
.board-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 0 10px;
}
.funnel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}
.funnel-cell { background: var(--job-bg); padding: 12px 14px; }
.funnel-k { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.funnel-v { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 4px 0 6px; }
.funnel-v.nc { color: var(--text-muted); font-style: italic; font-size: 16px; font-weight: 600; }

.job {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 110px;
  gap: 12px;
  background: var(--job-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
}
.job-crit { box-shadow: inset 3px 0 0 var(--orange); }
.job-warn { box-shadow: inset 3px 0 0 #C9A227; }
.job-ok { box-shadow: inset 3px 0 0 var(--gray); }
.job-idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding-top: 4px;
}
.job-title { font-family: var(--display); font-size: 18px; font-weight: 600; line-height: 1.25; margin: 0; }
.job-topline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.job-chip {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--border2);
  padding: 2px 7px;
  border-radius: 3px;
  color: var(--text-dim);
}
.job-chip.muted { opacity: .7; }
.job-copy { font-size: 14px; color: var(--text-dim); line-height: 1.45; margin-bottom: 8px; }
.job-bar { height: 6px; background: var(--surface3); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.job-bar span { display: block; height: 100%; background: var(--orange); }
.job-crit .job-bar span { background: var(--orange); }
.job-warn .job-bar span { background: #C9A227; }
.job-ok .job-bar span { background: var(--gray); }
.job-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.act {
  display: inline-flex;
  align-items: center;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
a.act:hover, button.act:hover { border-color: var(--orange); color: var(--orange); text-decoration: none; background: var(--orange-glow); }
.job-stat { text-align: right; }
.job-stat-v { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1; }
.job-stat-v.nc { color: var(--text-muted); font-style: italic; font-size: 18px; }
.job-stat-l { font-size: 10px; color: var(--text-muted); margin-top: 4px; letter-spacing: 0.04em; text-transform: uppercase; }

.board-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.side-card { background: var(--job-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.side-k { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; }
.side-v { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.side-copy { font-size: 13px; color: var(--text-dim); line-height: 1.45; margin-bottom: 10px; }
.side-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.side-row:last-child { border-bottom: none; }
.side-flag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.side-flag.ok { color: #7dcea0; }
.side-flag.warn { color: var(--orange); }
.side-card .act { margin-top: 6px; margin-right: 6px; }

.drawer {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: min(520px, calc(100vw - 260px));
  max-height: 52vh;
  background: var(--job-bg);
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer[hidden] { display: none; }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.drawer-x { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 12px; font-weight: 700; }
.drawer-body { margin: 0; padding: 12px; overflow: auto; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }

.page-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }

@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; }
  .board-side { position: static; }
  .funnel { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  body.app-shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .job { grid-template-columns: 36px 1fr; }
  .job-stat { grid-column: 2; text-align: left; }
  .ask-dock { grid-template-columns: 1fr auto; }
  .ask-chips { display: none; }
  .drawer { width: calc(100vw - 24px); right: 12px; left: 12px; }
}

/* ── GLOBAL ACCESSIBILITY POLISH ─────────────────────────────────────────── */

/* Focus ring: warm orange, visible only on keyboard navigation */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* High-contrast mode overrides */
@media (forced-colors: active) {
  .badge        { border: 1px solid ButtonText !important; color: ButtonText; background: ButtonFace; }
  .btn-orange   { background: Highlight; color: HighlightText; border: 1px solid ButtonText; }
  .job          { border: 1px solid ButtonText; box-shadow: none; }
  .signal-panel { border: 1px solid ButtonText; }
  .gate-step    { border-right: 1px solid ButtonText; }
  .gate-needed  { border-top: 2px solid ButtonText; }
  .gate-blocked { border-top: 2px solid Highlight; }
  .ret-arc-fill   { stroke: CanvasText !important; }
  .estate-bar-fill,
  .hud-bar-fill   { background: CanvasText !important; }
  .estate-type-dot.ih,
  .estate-type-dot.psh { background: CanvasText; }
}

/* ── WATCHFLOOR SIGNAL ROW ───────────────────────────────────────────────── */

.watchfloor-signals {
  display: grid;
  grid-template-columns: 182px 1fr 216px;
  gap: 12px;
  margin-bottom: 12px;
  align-items: stretch;
}

.signal-panel {
  background: var(--job-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 15px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}

.signal-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.signal-eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  flex: 1;
}

.signal-caption {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: auto;
  padding-top: 4px;
}

.signal-caption a { color: var(--text-muted); text-decoration: underline; font-size: 11px; }
.signal-caption a:hover { color: var(--orange); }

/* ── RETENTION RING ──────────────────────────────────────────────────────── */

.ret-panel {
  align-items: center;
  justify-content: space-between;
}

.ret-ring-outer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.ret-ring-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ret-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ret-track {
  stroke: rgba(244, 239, 232, 0.07);
  stroke-width: 9;
  fill: none;
}

/* 97% arc: circumference of r=48 circle = 2π×48 = 301.593
   97% of that = 292.545; dashoffset = 301.593 − 292.545 = 9.048 */
.ret-arc-fill {
  stroke: var(--orange);
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 301.593;
  stroke-dashoffset: 9.048;
  animation: ret-draw 1.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes ret-draw {
  from { stroke-dashoffset: 301.593; }
  to   { stroke-dashoffset: 9.048; }
}

/* Residual 3% arc — honest representation of households not retained */
.ret-arc-residual {
  stroke: rgba(244, 239, 232, 0.14);
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 301.593;
  stroke-dashoffset: 292.545; /* shows only the remaining 3% gap */
  animation: ret-residual 1.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes ret-residual {
  from { stroke-dashoffset: 301.593; }
  to   { stroke-dashoffset: 292.545; }
}

@media (prefers-reduced-motion: reduce) {
  .ret-arc-fill     { animation: none; stroke-dashoffset: 9.048; }
  .ret-arc-residual { animation: none; stroke-dashoffset: 292.545; }
}

.ret-center {
  position: relative;
  z-index: 1;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.ret-pct {
  display: block;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.ret-sub-label {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-top: 3px;
}

/* ── ESTATE PANEL ────────────────────────────────────────────────────────── */

.estate-groups {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.estate-city-block { display: flex; flex-direction: column; gap: 2px; }

.estate-city-name {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 0 3px;
  border-top: 1px solid rgba(244, 239, 232, 0.05);
}

.estate-city-block:first-child .estate-city-name {
  border-top: none;
}

.estate-prop-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 3px;
  border-radius: 3px;
  transition: background 0.12s;
}
.estate-prop-row:hover { background: rgba(244, 239, 232, 0.04); }

.estate-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.estate-type-dot.ih  { background: var(--orange); opacity: 0.72; }
.estate-type-dot.psh { background: #7dcea0; opacity: 0.72; }

.estate-prop-label {
  font-size: 11px;
  color: var(--text-dim);
  flex: 0 0 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.estate-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(244, 239, 232, 0.06);
  border-radius: 2px;
  overflow: hidden;
  min-width: 24px;
}

.estate-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.estate-bar-fill.ih  { background: rgba(232, 119, 34, 0.55); }
.estate-bar-fill.psh { background: rgba(125, 206, 160, 0.50); }

.estate-units {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.estate-legend {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.estate-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ── HUD 48H PANEL ───────────────────────────────────────────────────────── */

.hud-scale-row {
  display: flex;
  justify-content: space-between;
  padding: 0 0 2px 58px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hud-scale-danger { color: var(--orange); }

.hud-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.hud-site-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-site-name {
  font-size: 10px;
  color: var(--text-dim);
  width: 54px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(244, 239, 232, 0.06);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

/* Vertical line marking the 48-hour deadline */
.hud-bar-track::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: rgba(232, 119, 34, 0.32);
  border-radius: 1px;
  pointer-events: none;
}

.hud-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: rgba(125, 206, 160, 0.48);
  transition: width 1.0s cubic-bezier(0.4, 0, 0.2, 1);
}
.hud-bar-fill.hud-warn     { background: rgba(201, 162, 39, 0.62); }
.hud-bar-fill.hud-critical { background: rgba(232, 119, 34, 0.68); }

.hud-lag {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.hud-lag.hud-critical { color: var(--orange); }
.hud-lag.hud-warn     { color: #C9A227; }

@media (prefers-reduced-motion: reduce) {
  .estate-bar-fill, .hud-bar-fill { transition: none; }
}

/* ── CLAIM GATE FLOW ─────────────────────────────────────────────────────── */

.claim-gate-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--job-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

.gate-step {
  padding: 12px 14px 11px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gate-step:last-child { border-right: none; }

.gate-step-num {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.gate-step-name {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 1px;
}

.gate-step-note {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 2px;
}

.gate-step-status {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  margin-top: 5px;
  align-self: flex-start;
}

/* Steps 1–3: "needed" — prerequisite not yet wired */
.gate-needed { border-top: 2px solid rgba(232, 119, 34, 0.28); }
.gate-needed .gate-step-num { color: rgba(232, 119, 34, 0.55); }
.gate-needed .gate-step-name { color: var(--text-dim); }
.gate-needed .gate-step-status {
  background: rgba(244, 239, 232, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border2);
}

/* Step 4: "blocked" — claim cannot submit */
.gate-blocked {
  border-top: 2px solid var(--orange);
  background: rgba(232, 119, 34, 0.035);
}
.gate-blocked .gate-step-num { color: var(--orange); }
.gate-blocked .gate-step-name { color: var(--orange); }
.gate-blocked .gate-step-note { color: var(--text-dim); }
.gate-blocked .gate-step-status {
  background: rgba(232, 119, 34, 0.10);
  color: var(--orange);
  border: 1px solid rgba(232, 119, 34, 0.28);
}

/* ── ENHANCED JOB CARD MOTION ────────────────────────────────────────────── */

@keyframes job-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.job { animation: job-in 0.28s ease both; }
.job:nth-child(1) { animation-delay: 0.04s; }
.job:nth-child(2) { animation-delay: 0.09s; }
.job:nth-child(3) { animation-delay: 0.14s; }
.job:nth-child(4) { animation-delay: 0.19s; }
.job:nth-child(5) { animation-delay: 0.24s; }
.job:nth-child(6) { animation-delay: 0.29s; }

@media (prefers-reduced-motion: reduce) {
  .job { animation: none; }
}

/* ── STRIP STAT PULSE — live vs overlay ─────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.st .ok::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7dcea0;
  margin-right: 5px;
  vertical-align: middle;
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .st .ok::before { animation: none; }
}

/* ── RESPONSIVE WATCHFLOOR ───────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .watchfloor-signals {
    grid-template-columns: 182px 1fr;
    grid-template-rows: auto auto;
  }
  .hud-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .claim-gate-flow {
    grid-template-columns: repeat(2, 1fr);
  }
  .gate-step:nth-child(2) { border-right: none; }
  .gate-step:nth-child(3) {
    border-top: 1px solid var(--border);
  }
  .gate-step:nth-child(4) {
    border-top: 1px solid var(--border);
    border-right: none;
  }
}

@media (max-width: 860px) {
  .watchfloor-signals {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .hud-panel { grid-column: auto; grid-row: auto; }
  .ret-panel {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
  }
  .ret-ring-outer { flex: 0 0 auto; }
  .ret-ring-wrap { width: 88px; height: 88px; }
  .ret-pct { font-size: 22px; }
  .claim-gate-flow { grid-template-columns: 1fr 1fr; }
  .gate-step:nth-child(3),
  .gate-step:nth-child(4) { border-top: 1px solid var(--border); }
  .estate-prop-label { flex: 0 0 96px; }
}
