:root {
  color-scheme: light;
  --ink: #1e2923;
  --muted: #718078;
  --line: #e3e9e4;
  --paper: #ffffff;
  --canvas: #f5f7f4;
  --rail: #1e3028;
  --rail-muted: #9aafa3;
  --green: #207657;
  --green-pale: #e6f3ec;
  --blue: #386c9c;
  --blue-pale: #eaf1f8;
  --red: #b64e4d;
  --red-pale: #f8e9e8;
  --amber: #9b6c1e;
  --amber-pale: #f7f0df;
  --shadow: 0 8px 26px rgb(25 48 36 / 4%);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
button { font: inherit; }
.app-shell { min-height: 100vh; }
.rail { background: var(--rail); color: #f5f8f5; display: flex; flex-direction: column; inset: 0 auto 0 0; padding: 27px 18px 20px; position: fixed; width: 236px; z-index: 2; }
.brand { align-items: center; color: inherit; display: flex; gap: 11px; margin: 0 8px 52px; text-decoration: none; }
.brand-mark { align-items: center; border: 1px solid #83b89d; border-radius: 8px; color: #eaf5ee; display: inline-flex; font-size: 21px; font-weight: 700; height: 40px; justify-content: center; width: 40px; }
.brand-mark span { color: #80c49a; }
.brand-copy { display: grid; gap: 4px; }
.brand-copy strong { font-size: 14px; font-weight: 650; }
.brand-copy small, .rail-label { color: var(--rail-muted); font-size: 9px; }
.rail-label { margin: 0 10px 12px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { align-items: center; background: transparent; border: 0; border-radius: 6px; color: #c6d4cb; cursor: pointer; display: flex; gap: 12px; min-height: 42px; padding: 0 11px; text-align: left; text-decoration: none; transition: background 160ms ease, color 160ms ease; }
.nav-item:hover { background: rgb(255 255 255 / 7%); color: white; }
.nav-item.is-active { background: #31483b; color: white; box-shadow: inset 2px 0 #76c293; }
.nav-icon { color: #a5cbb2; font-size: 19px; line-height: 1; text-align: center; width: 19px; }
.rail-bottom { align-items: center; border-top: 1px solid rgb(255 255 255 / 12%); display: flex; gap: 11px; margin-top: auto; padding: 18px 7px 0; }
.rail-bottom strong, .rail-bottom small { display: block; }
.rail-bottom strong { font-size: 12px; font-weight: 550; }
.rail-bottom small { color: var(--rail-muted); font-size: 11px; margin-top: 4px; }
.mode-dot { background: #79c696; border-radius: 50%; box-shadow: 0 0 0 4px rgb(121 198 150 / 14%); height: 8px; margin: 0 2px 0 3px; width: 8px; }
.main-area { margin-left: 236px; min-height: 100vh; }
.topbar { align-items: center; background: rgb(255 255 255 / 88%); border-bottom: 1px solid var(--line); display: flex; height: 64px; justify-content: space-between; padding: 0 clamp(20px, 4vw, 56px); position: sticky; top: 0; z-index: 1; }
.crumb { align-items: center; color: var(--muted); display: flex; font-size: 10px; gap: 11px; }
.crumb strong { color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.crumb-slash { color: #c5cec7; }
.top-actions { align-items: center; color: var(--muted); display: flex; gap: 14px; font-size: 11px; }
.icon-button { background: white; border: 1px solid var(--line); border-radius: 6px; color: #496355; cursor: pointer; font-size: 20px; height: 34px; line-height: 1; width: 36px; }
.icon-button:hover { background: var(--green-pale); border-color: #bddac8; }
.icon-button.is-loading { animation: spin 850ms linear infinite; }
.connect-button { align-items: center; background: var(--green); border: 1px solid var(--green); border-radius: 5px; color: white; display: inline-flex; font-size: 11px; font-weight: 600; gap: 7px; min-height: 34px; padding: 0 11px; text-decoration: none; white-space: nowrap; }
.connect-button:hover { background: #196448; border-color: #196448; }
.connect-button:focus-visible { outline: 3px solid rgb(32 118 87 / 24%); outline-offset: 2px; }
.content-wrap { margin: 0 auto; max-width: 1440px; padding: 34px clamp(20px, 4vw, 56px) 58px; }
.view { display: none; }
.view.is-visible { animation: reveal 220ms ease both; display: block; }
.page-heading { align-items: flex-end; display: flex; justify-content: space-between; margin-bottom: 24px; }
.eyebrow { color: var(--green); font-size: 9px; font-weight: 700; margin: 0 0 8px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 29px; font-weight: 620; letter-spacing: 0; line-height: 1.15; margin-bottom: 8px; }
h2 { font-size: 15px; font-weight: 620; letter-spacing: 0; margin: 0; }
.subheading { color: var(--muted); font-size: 13px; margin: 0; }
.status-pill { align-items: center; border-radius: 20px; display: inline-flex; font-size: 11px; gap: 7px; padding: 7px 10px; white-space: nowrap; }
.status-pill i { border-radius: 50%; height: 7px; width: 7px; }
.status-neutral { background: #edf0ed; color: #59665e; }
.status-neutral i { background: #8b9a90; }
.status-good { background: var(--green-pale); color: var(--green); }
.status-good i { background: var(--green); }
.status-warning { background: var(--amber-pale); color: var(--amber); }
.status-warning i { background: #bd8628; }
.status-bad { background: var(--red-pale); color: var(--red); }
.status-bad i { background: var(--red); }
.metric-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.metric, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.metric { min-height: 126px; padding: 18px 19px; }
.metric-primary { border-top: 2px solid var(--green); }
.metric-label { color: var(--muted); display: block; font-size: 11px; margin-bottom: 15px; }
.metric strong { display: block; font-size: 23px; font-variant-numeric: tabular-nums; font-weight: 620; letter-spacing: 0; overflow-wrap: anywhere; }
.metric small { color: #87938b; display: block; font-size: 10px; margin-top: 8px; }
.overview-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); margin-bottom: 14px; }
.panel { min-width: 0; padding: 19px 20px; }
.panel-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 16px; min-height: 26px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-mark { color: #b5c5ba; font-size: 10px; font-variant-numeric: tabular-nums; }
.stat-list { display: grid; }
.stat-list > div, .system-row, .limit-row { align-items: center; border-top: 1px solid #edf0ed; display: flex; justify-content: space-between; min-height: 39px; }
.stat-list > div:first-child, .system-row:first-child, .limit-row:first-child { border-top: 0; }
.stat-list span, .system-row span, .limit-row span { color: #647169; font-size: 12px; }
.stat-list strong { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 620; }
.system-list { display: grid; }
.system-row strong { color: #4b5d52; font-size: 11px; font-weight: 600; text-align: right; }
.system-row strong.good { color: var(--green); }
.system-row strong.warn { color: var(--amber); }
.table-panel { margin-top: 14px; padding-bottom: 8px; }
.table-panel .panel-heading { padding: 0 0 1px; }
.table-scroll { overflow-x: auto; width: 100%; }
table { border-collapse: collapse; min-width: 660px; text-align: left; width: 100%; }
th { border-bottom: 1px solid var(--line); color: #78857d; font-size: 9px; font-weight: 650; padding: 11px 10px; text-transform: uppercase; white-space: nowrap; }
td { border-bottom: 1px solid #edf0ed; color: #39473e; font-size: 11px; padding: 12px 10px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--ink); font-weight: 600; }
.text-button { background: transparent; border: 0; color: var(--green); cursor: pointer; font-size: 11px; padding: 6px 0 6px 8px; }
.text-button span { margin-left: 4px; }
.count-label { color: var(--muted); font-size: 11px; }
.screener-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; }
.screener-actions input, .screener-actions select { background: white; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); font: inherit; min-height: 34px; padding: 0 9px; }
.screener-method-note { background: var(--blue-pale); border-left: 3px solid var(--blue); border-radius: 4px; color: #435d74; font-size: 11px; line-height: 1.55; margin: -9px 0 16px; padding: 10px 12px; }
.screener-detail[hidden] { display: none; }
.screener-chart { margin: 14px 0; min-height: 230px; overflow-x: auto; }
.screener-chart svg { display: block; min-width: 600px; width: 100%; }
.screener-chart .chart-close { fill: none; stroke: var(--green); stroke-width: 2; }
.screener-chart .chart-ema20 { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.screener-chart .chart-ema50 { fill: none; stroke: #bd8628; stroke-width: 1.5; }
.screener-legend { color: var(--muted); display: flex; font-size: 10px; gap: 15px; }
.screener-legend span::before { background: currentColor; content: ""; display: inline-block; height: 2px; margin: 0 5px 3px 0; width: 12px; }
.screener-factors { display: grid; gap: 8px 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.screener-factor { border-top: 1px solid #edf0ed; display: flex; justify-content: space-between; padding: 9px 0; }
.screener-factor span { color: var(--muted); font-size: 10px; }
.screener-factor .screener-help { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; }
.screener-factor .screener-help:focus-visible { border-radius: 2px; outline: 2px solid var(--blue); outline-offset: 2px; }
.screener-factor strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.screener-row { cursor: pointer; }
.screener-row:hover td { background: #f4f8f5; }
.empty-row td { color: #89958d; font-weight: 400; padding: 24px 10px; text-align: center; }
.badge { border-radius: 4px; display: inline-block; font-size: 9px; font-weight: 650; padding: 4px 6px; }
.badge-good { background: var(--green-pale); color: var(--green); }
.badge-bad { background: var(--red-pale); color: var(--red); }
.badge-neutral { background: #eef1ee; color: #5d6a61; }
.badge-warn { background: var(--amber-pale); color: var(--amber); }
.signal-guide { background: var(--blue-pale); border-left: 3px solid var(--blue); border-radius: 5px; color: #40596e; margin-bottom: 14px; padding: 14px 16px; }
.signal-guide > strong { color: #284c6c; display: block; font-size: 12px; margin-bottom: 6px; }
.signal-guide p { font-size: 11px; line-height: 1.55; margin: 0; }
.signal-guide .signal-plan-note { color: #647a8b; margin-top: 8px; }
.signal-rule-key { display: flex; flex-wrap: wrap; gap: 7px 20px; margin-top: 9px; }
.signal-rule-key span { font-size: 10px; line-height: 1.5; }
.signal-table { min-width: 940px; table-layout: fixed; }
.signal-table th, .signal-table td { white-space: normal; vertical-align: top; }
.signal-table th:nth-child(1) { width: 11%; }
.signal-table th:nth-child(2) { width: 15%; }
.signal-table th:nth-child(3) { width: 20%; }
.signal-table th:nth-child(4) { width: 19%; }
.signal-table th:nth-child(5) { width: 15%; }
.signal-table th:nth-child(6) { width: 20%; }
.signal-table td { line-height: 1.45; overflow-wrap: anywhere; }
.signal-table td > small { color: var(--muted); display: block; font-size: 9px; font-weight: 400; margin-top: 4px; }
.signal-symbol { display: block; font-size: 12px; margin-bottom: 5px; }
.signal-checks { display: grid; gap: 5px; }
.signal-check { align-items: center; display: flex; font-size: 10px; gap: 6px; }
.signal-check i { align-items: center; border-radius: 50%; display: inline-flex; font-size: 9px; font-style: normal; height: 15px; justify-content: center; width: 15px; }
.signal-check.is-met { color: var(--green); }
.signal-check.is-met i { background: var(--green-pale); }
.signal-check.is-missing { color: var(--amber); }
.signal-check.is-missing i { background: var(--amber-pale); }
.signal-plan { display: grid; gap: 5px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.signal-plan div { min-width: 0; }
.signal-plan small { color: var(--muted); display: block; font-size: 9px; margin-bottom: 3px; }
.signal-plan strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.signal-quantity { display: block; font-size: 12px; font-variant-numeric: tabular-nums; }
.signal-explanation > strong { font-size: 10px; }
.signal-explanation p { color: #58675e; font-size: 10px; line-height: 1.5; margin: 4px 0; }
.signal-explanation details { margin-top: 6px; }
.signal-explanation summary { color: var(--blue); cursor: pointer; font-size: 9px; }
.signal-explanation details p { overflow-wrap: anywhere; white-space: normal; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.risk-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.policy-panel { margin: 14px 0; }
.risk-policy-form { display: grid; gap: 13px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 17px; }
.risk-policy-form label { color: #647169; display: grid; font-size: 10px; gap: 6px; }
.risk-policy-form input { background: #fbfcfb; border: 1px solid #dce4de; border-radius: 5px; color: var(--ink); font: inherit; height: 36px; outline: none; padding: 0 9px; width: 100%; }
.risk-policy-form input:focus { border-color: #5b9b78; box-shadow: 0 0 0 3px rgb(32 118 87 / 10%); }
.risk-policy-form button { align-self: end; justify-self: start; }
.exposure-number { font-size: 30px; font-variant-numeric: tabular-nums; font-weight: 620; margin: 23px 0 16px; }
.meter { background: #e9efea; border-radius: 5px; height: 7px; overflow: hidden; }
.meter span { background: var(--green); border-radius: inherit; display: block; height: 100%; transition: width 250ms ease; width: 0; }
.muted, .footnote { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 12px 0 0; }
.limit-list { display: grid; }
.limit-row strong { color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.notice { background: var(--amber-pale); border: 1px solid #ebddb8; border-radius: 6px; color: #75561f; font-size: 12px; margin-bottom: 18px; padding: 11px 14px; }
.notice[hidden] { display: none; }
.footnote { margin-top: 14px; }
.logout-button { color: var(--muted); font-size: 18px; }
.login-page { align-items: center; background-color: var(--canvas); background-image: linear-gradient(135deg, rgb(32 118 87 / 3%) 0 1px, transparent 1px 24px); background-size: 24px 24px; display: flex; justify-content: center; min-height: 100vh; padding: 28px 18px; }
.login-shell { max-width: 390px; width: 100%; }
.login-brand { align-items: center; color: var(--ink); display: flex; gap: 11px; margin: 0 0 28px 2px; text-decoration: none; }
.login-brand .brand-mark { background: var(--rail); }
.login-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 18px 54px rgb(25 48 36 / 8%); padding: 31px; }
.login-heading { margin-bottom: 27px; }
.login-heading h1 { font-size: 25px; margin-bottom: 8px; }
.login-heading > p:last-child { color: var(--muted); font-size: 12px; margin-bottom: 0; }
#login-form { display: grid; gap: 9px; }
#login-form label { color: #46554b; font-size: 11px; font-weight: 600; margin-top: 4px; }
#login-form input { background: #fbfcfb; border: 1px solid #dce4de; border-radius: 5px; color: var(--ink); font: inherit; height: 42px; outline: none; padding: 0 11px; width: 100%; }
#login-form input:focus { border-color: #5b9b78; box-shadow: 0 0 0 3px rgb(32 118 87 / 10%); }
.login-submit { align-items: center; background: var(--green); border: 0; border-radius: 5px; color: white; cursor: pointer; display: flex; font-size: 12px; font-weight: 600; height: 43px; justify-content: space-between; margin-top: 12px; padding: 0 13px; }
.login-submit:hover { background: #196448; }
.login-submit:disabled { cursor: wait; opacity: .72; }
.login-error { background: var(--red-pale); border-radius: 4px; color: var(--red); font-size: 11px; line-height: 1.5; margin: 3px 0 0; padding: 9px 10px; }
.login-error[hidden] { display: none; }
.login-footnote { align-items: center; color: var(--muted); display: flex; font-size: 10px; gap: 7px; justify-content: center; margin: 17px 0 0; }
.secure-mark { color: var(--green); font-size: 8px; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .rail { width: 206px; }
  .main-area { margin-left: 206px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .rail { align-items: center; bottom: auto; flex-direction: row; height: 60px; justify-content: space-between; padding: 7px 12px; right: 0; top: 0; width: auto; }
  .brand { margin: 0; }
  .brand-mark { height: 36px; width: 36px; }
  .brand-copy small, .rail-label, .rail-bottom { display: none; }
  .nav-list { display: flex; gap: 3px; overflow-x: auto; }
  .nav-item { border-radius: 5px; flex: 0 0 auto; font-size: 0; gap: 0; justify-content: center; min-height: 38px; padding: 0; width: 38px; }
  .nav-icon { font-size: 18px; }
  .main-area { margin-left: 0; padding-top: 60px; }
  .topbar { height: 52px; padding: 0 16px; }
  .content-wrap { padding: 25px 16px 42px; }
  .overview-grid, .risk-grid { grid-template-columns: 1fr; }
  .risk-policy-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screener-factors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 115px; padding: 15px; }
  .metric strong { font-size: 20px; }
  .page-heading { align-items: flex-start; gap: 12px; }
  h1 { font-size: 26px; }
  .status-pill { font-size: 10px; padding: 6px 8px; }
  .updated-label { max-width: 126px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { gap: 8px; }
  .updated-label { display: none; }
  .connect-button { height: 34px; justify-content: center; padding: 0; width: 36px; }
  .connect-label { display: none; }
  .login-panel { padding: 26px 22px; }
  .signal-rule-key { display: grid; gap: 4px; }
}
@media (max-width: 430px) {
  .risk-policy-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}