/* ProposalPro Control — design tokens + components. No external assets (CSP: self only). */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef2ff;
  --accent-ink: #3730a3;
  --ok: #079455;  --ok-soft: #ecfdf3;  --ok-ink: #05603a;
  --warn: #dc6803; --warn-soft: #fffaeb; --warn-ink: #93370d;
  --crit: #d92d20; --crit-soft: #fef3f2; --crit-ink: #912018;
  --info: #1570ef; --info-soft: #eff8ff;
  --heat-rgb: 79, 70, 229;
  --chart-1: #4f46e5; --chart-2: #0ea5e9; --chart-3: #f59e0b; --chart-4: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --surface: #111723; --surface-2: #161d2b; --surface-3: #1d2536;
    --border: #232c3d; --border-strong: #2f3a50;
    --text: #eef1f6; --text-2: #b4bccb; --text-3: #8591a6;
    --accent: #818cf8; --accent-2: #a5b4fc; --accent-soft: #1e1f3d; --accent-ink: #c7d2fe;
    --ok: #32d583; --ok-soft: #0f2a1e; --ok-ink: #a6f4c5;
    --warn: #fdb022; --warn-soft: #2e2210; --warn-ink: #fedf89;
    --crit: #f97066; --crit-soft: #331514; --crit-ink: #fecdca;
    --info: #53b1fd; --info-soft: #102236;
    --heat-rgb: 129, 140, 248;
    --chart-1: #818cf8; --chart-2: #38bdf8; --chart-3: #fbbf24; --chart-4: #34d399;
    --shadow-sm: none; --shadow: none; --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 620; }
h3 { font-size: 13px; font-weight: 600; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.soft { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- layout ---------------- */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow); }
.brand-mark svg { width: 17px; height: 17px; stroke: #fff; }
.brand-name { font-weight: 680; font-size: 15px; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.env-chip { margin: 0 6px 18px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.env-chip b { font-weight: 650; text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.env-chip .grow { color: var(--text-3); }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a.active svg { stroke: var(--accent); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  display: inline-grid; place-items: center; background: var(--crit); color: #fff; }
.nav .count.warn { background: var(--warn); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 6px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; }
main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .sub { color: var(--text-3); font-size: 12.5px; }
.view { padding: 24px 32px 64px; max-width: 1360px; }
#menu { display: none; }

/* ---------------- primitives ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.card-head .grow p { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.section { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.btn { font: inherit; font-weight: 560; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 30px; }
.btn.wide { width: 100%; justify-content: center; }
.link { color: var(--accent); font-weight: 560; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

.tip { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--text-3); cursor: help; vertical-align: -3px; }
.tip svg { width: 15px; height: 15px; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: #101828; color: #f2f4f7; font-size: 12px; font-weight: 450;
  line-height: 1.45; white-space: normal; box-shadow: var(--shadow-lg); }

/* ---------------- status hero ---------------- */
.hero { display: flex; gap: 18px; padding: 22px 24px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--ok); }
.hero.attention::before { background: var(--warn); }
.hero.critical::before { background: var(--crit); }
.hero-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.hero.attention .hero-icon { background: var(--warn-soft); color: var(--warn); }
.hero.critical .hero-icon { background: var(--crit-soft); color: var(--crit); }
.hero-icon svg { width: 26px; height: 26px; stroke-width: 2; }
.hero h1 { font-size: 22px; }
.hero .lead { color: var(--text-2); margin-top: 4px; }
.findings { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.finding { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.finding .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--text-3); }
.finding.critical .dot { background: var(--crit); box-shadow: 0 0 0 4px var(--crit-soft); }
.finding.warning .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.finding.setup .dot { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.finding .t { font-weight: 600; }
.finding .m { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.finding .todo { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.finding .todo b { color: var(--text); font-weight: 600; }

/* ---------------- stat cards ---------------- */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 520; font-size: 13px; }
.stat .label svg { color: var(--text-3); }
.stat .value { font-size: 28px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; font-weight: 520; color: var(--text-3); letter-spacing: 0; margin-left: 2px; }
.stat .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--ok-ink); background: var(--ok-soft); }
.delta.down { color: var(--crit-ink); background: var(--crit-soft); }
.delta.flat { color: var(--text-2); background: var(--surface-2); }
.delta.bad.up { color: var(--crit-ink); background: var(--crit-soft); }
.delta.bad.down { color: var(--ok-ink); background: var(--ok-soft); }
.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.meter.ok > span { background: var(--ok); } .meter.warn > span { background: var(--warn); } .meter.crit > span { background: var(--crit); }
.meter.thin { height: 5px; }

/* ---------------- checklist ---------------- */
.checklist { display: flex; flex-direction: column; }
.check { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.check .ic.bad { background: var(--crit-soft); color: var(--crit); }
.check .ic.unk { background: var(--surface-2); color: var(--text-3); }
.check .ic svg { width: 15px; height: 15px; stroke-width: 2.4; }
.check .n { font-weight: 560; }
.check .d { color: var(--text-3); font-size: 12.5px; }

/* ---------------- timeline ---------------- */
.timeline { position: relative; }
.ev { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.ev::before { content: ""; position: absolute; left: 11px; top: 30px; bottom: -8px; width: 2px; background: var(--border); }
.ev:last-child::before { display: none; }
.ev .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); z-index: 1; }
.ev .ic svg { width: 13px; height: 13px; stroke-width: 2.2; }
.ev.ok .ic { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ev.critical .ic { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.ev.warning .ic { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ev.info .ic { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ev .t { font-size: 13px; }
.ev .w { font-size: 12px; color: var(--text-3); }

/* ---------------- tables / lists ---------------- */
.table-wrap { overflow-x: auto; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 2px 0; border-top: 1px solid var(--border); }
.pager .pg { display: flex; gap: 4px; align-items: center; }
.pager .pg button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.pager .pg button:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.pager .pg button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .pg button:disabled { opacity: .4; cursor: default; }
.pager .gap { color: var(--text-3); padding: 0 2px; }
.pager label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pager select { width: auto; min-width: 64px; height: 30px; padding: 2px 6px; font-size: 12px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.stat.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat.clickable:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kv > div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.kv .k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.kv .v { font-size: 17px; font-weight: 640; margin-top: 2px; }
.kv .v .sub { font-weight: 400; }
.modal-sec { margin-top: 18px; }
.modal-sec > h3 { margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 560; color: var(--text-3); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td .sub, .sub { color: var(--text-3); font-size: 12px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 16px; color: var(--text-3); }
.empty svg { width: 28px; height: 28px; color: var(--text-3); stroke-width: 1.5; }
.empty b { color: var(--text-2); font-weight: 600; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.svc-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.bar-cell { min-width: 140px; }
.bar-cell .row { justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field > span { font-weight: 560; font-size: 13px; color: var(--text); }
.field .help { font-size: 12px; color: var(--text-3); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 0 12px; height: 38px; width: 100%; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
select { padding-right: 30px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .sw { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .15s; border: 1px solid var(--border-strong); }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .15s; }
.toggle input:checked + .sw { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.toggle input:focus-visible + .sw { box-shadow: 0 0 0 4px var(--accent-soft); }
.toggle .tx b { display: block; font-weight: 560; }
.toggle .tx span { font-size: 12px; color: var(--text-3); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls select, .controls input { width: auto; height: 34px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 560; border: 0; background: none; color: var(--text-2); padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.subnav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 520; }
.subnav a:hover { background: var(--surface-2); text-decoration: none; }
.subnav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--border); }
.save-bar { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------------- charts ---------------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .marker { stroke: var(--text-3); stroke-dasharray: 3 3; stroke-width: 1; opacity: .7; }
.chart .marker-label { fill: var(--text-3); font-size: 10px; }
.chart .hover-line { stroke: var(--text-3); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 8px 10px; font-size: 12px; min-width: 140px; }
.chart-tip .h { color: var(--text-3); margin-bottom: 4px; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; }
.chart-tip .r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .r b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* heatmap */
.heat { display: grid; grid-template-columns: 44px repeat(24, minmax(0, 1fr)); gap: 3px; }
.heat .hl { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; }
.heat .hh { font-size: 10.5px; color: var(--text-3); text-align: center; }
.heat .c { aspect-ratio: 1.15; border-radius: 4px; background: var(--surface-2); transition: transform .1s; }
.heat .c:hover { transform: scale(1.15); outline: 2px solid var(--accent); }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.heat-scale span { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.insight svg { color: var(--accent); margin-top: 1px; }
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal .c { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }

/* steps (checks) */
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.step .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.step .ic.bad { background: var(--crit-soft); color: var(--crit); }
.step .ic.skip { background: var(--surface-2); color: var(--text-3); }
.step .ic svg { width: 13px; height: 13px; stroke-width: 2.6; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip-dot { width: 10px; height: 22px; border-radius: 3px; background: var(--ok); }
.chip-dot.bad { background: var(--crit); }

/* ---------------- login ---------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 32px; border-radius: 18px; }
.login-card .brand { padding: 0 0 22px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .lead { color: var(--text-3); margin-bottom: 22px; }
.form-error { color: var(--crit); font-size: 13px; min-height: 20px; margin-top: 10px; }
.otp-input { letter-spacing: .5em; font-size: 20px; text-align: center; font-family: var(--mono); height: 50px; }

/* ---------------- modal / toast ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, .55); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 20px; }
.modal-box { width: min(1080px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; overflow: auto; }
pre.logs { margin: 0; background: #0b1020; color: #d5dbe7; padding: 14px 16px; border-radius: 10px; max-height: 62vh; overflow: auto;
  font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 12px 16px;
  border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 520; animation: rise .18s ease-out; }
.toast.err { background: var(--crit); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) { .cols-4, .cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  #menu { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar .sub, #updated { display: none; }
  .view { padding: 16px 16px 48px; }
  .cols-2, .cols-3, .cols-4, .cols-6, .form-grid, .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; }
  .hero { flex-direction: column; padding: 18px; }
  .heat { grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat .hh { font-size: 9px; }
}

/* =====================================================================
   PROWEAVE CONTROL brand
   ===================================================================== */
:root { --brand: #e11d2a; --brand-ink: #0f1115; --brand-glow: rgba(225, 29, 42, .35); }
@media (prefers-color-scheme: dark) { :root { --brand: #ff3b47; --brand-ink: #f3f4f6; --brand-glow: rgba(255, 59, 71, .35); } }

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 18px; color: inherit; text-decoration: none !important; }
.logo-mark { position: relative; width: 38px; height: 38px; flex: none; border-radius: 11px; background: radial-gradient(120% 120% at 20% 0%, #2a2d35 0%, #0f1115 60%);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 6px 16px -6px rgba(15,17,21,.6); display: grid; place-items: center; overflow: visible; }
.logo-mark svg { width: 26px; height: 26px; overflow: visible; }
.logo-mark .live-dot { position: absolute; right: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--surface); }
.logo-mark .live-dot.on { background: #22c55e; }
.logo-mark .live-dot.on::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #22c55e; animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }
.logo-mark .live-dot.off { background: var(--warn); }
.logo-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.logo-mark.lg svg { width: 38px; height: 38px; }
@keyframes ping { 75%, 100% { transform: scale(2.1); opacity: 0; } }
.weave-a { stroke: var(--brand); filter: drop-shadow(0 0 4px var(--brand-glow)); }
.weave-b { stroke: #f8fafc; opacity: .92; }

.wordmark { line-height: 1; }
.wordmark .wm { font-family: "Anton", "Bebas Neue", "Oswald", Impact, "Arial Narrow", sans-serif; font-size: 23px; letter-spacing: .015em; text-transform: uppercase; }
.wordmark .wm-pro { color: var(--brand-ink); }
.wordmark .wm-weave { color: var(--brand); }
.wordmark .wm-sub { margin-top: 4px; font: 700 9.5px/1 var(--font); letter-spacing: .52em; color: var(--text-3); padding-left: 1px; display: flex; align-items: center; gap: 6px; }
.wordmark .wm-sub::after { content: ""; flex: 1; height: 2px; max-width: 22px; background: var(--brand); border-radius: 2px; }
.wordmark.lg .wm { font-size: 44px; }
.wordmark.lg .wm-sub { font-size: 12px; margin-top: 6px; letter-spacing: .6em; }
.wordmark.lg .wm-sub::after { max-width: 40px; height: 3px; }

.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.login-env { color: var(--text-3); font-size: 12px; font-family: var(--mono); margin: 0 0 22px; }
.login { background: radial-gradient(900px 500px at 0% 0%, rgba(225,29,42,.08), transparent 60%), radial-gradient(900px 600px at 100% 100%, var(--accent-soft), transparent 55%), var(--bg); }

.nav a.active { position: relative; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }

.live-pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); position: relative; }
.live-pill.on i { background: #22c55e; }
.live-pill.on i::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #22c55e; animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }
.live-pill.off i { background: var(--warn); }
[data-live] { transition: color .3s; }
.flash { animation: flash .6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
@media (max-width: 860px) { .live-pill span { display: none; } .live-pill { padding: 0 9px; } }

/* brand primary: ink instead of indigo */
.btn.primary { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--surface); }
.btn.primary:hover { background: var(--brand-ink); opacity: .88; }
.toggle input:checked + .sw { background: var(--brand-ink); border-color: var(--brand-ink); }
.seg button.on { box-shadow: var(--shadow), inset 0 -2px 0 var(--brand); }

/* Brand logo (the official ProposalWeave artwork, scaled to the sidebar) */
.brand { flex-direction: column; align-items: flex-start; gap: 8px; padding: 6px 8px 20px; }
.brand-logo { display: block; width: 100%; max-width: 208px; height: auto; }
.login-brand { flex-direction: column; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo { display: block; width: 100%; max-width: 320px; height: auto; }
.login-card .login-env { text-align: center; }
.brand-tag { display: flex; align-items: center; gap: 8px; font: 700 10px/1 var(--font); letter-spacing: .55em; color: var(--text-3); padding-left: 2px; }
.brand-tag::after { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--brand); }
.brand-tag.lg { font-size: 12px; letter-spacing: .7em; }
.brand-tag.lg::after { width: 36px; height: 3px; }
.brand-tag .live-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.brand-tag .live-dot.on { background: #22c55e; }
.brand-tag .live-dot.on::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #22c55e; animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }
.brand-tag .live-dot.off { background: var(--warn); }
/* The artwork is black + red on transparent: invert the black for dark mode, keep the red red. */
@media (prefers-color-scheme: dark) { .brand-logo, .login-logo { filter: invert(1) hue-rotate(180deg) saturate(1.2); } }

/* Centered "CONTROL CENTER" lock-up under the logo */
.brand { align-items: center; text-align: center; }
.brand-tag { justify-content: center; letter-spacing: .42em; font-size: 9.5px; padding-left: .42em; width: 100%; max-width: 208px; }
.brand-tag::before, .brand-tag::after { content: ""; flex: 1; max-width: 26px; height: 2px; border-radius: 2px; background: var(--brand); }
.brand-tag.lg { letter-spacing: .5em; font-size: 12px; max-width: 320px; padding-left: .5em; }
.brand-tag.lg::before, .brand-tag.lg::after { max-width: 44px; height: 3px; }

/* Presence */
.online-stack { display: inline-flex; align-items: center; text-decoration: none !important; color: var(--text-2); }
.online-stack .avatar.sm { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); margin-left: -8px; }
.online-stack .avatar.sm:first-child { margin-left: 0; }
.online-stack .avatar.more { background: var(--surface-3); color: var(--text-2); }
.online-stack .online-n { margin-left: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
@media (max-width: 860px) { .online-stack .online-n { display: none; } }

/* Chart export tools (appear on hover) */
.chart-tools { position: absolute; top: -4px; right: 0; display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); opacity: 0; transition: opacity .15s; z-index: 5; }
.chart:hover .chart-tools, .chart-tools:focus-within { opacity: 1; }
.chart-tools button { font: 600 11px var(--font); border: 0; background: none; color: var(--text-2); padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.chart-tools button:hover { background: var(--surface-2); color: var(--text); }
@media (hover: none) { .chart-tools { opacity: 1; } }

/* Server I/O line, data stores, service drawer */
.io-row { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.io-row span { display: inline-flex; align-items: center; gap: 8px; }
.io-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.store { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.store .kv { grid-template-columns: auto 1fr; }
.store .kv dd { text-align: right; }
.svc-open { font-weight: 650; color: var(--text); }
.svc-open:hover { color: var(--accent); }
.svc-live > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.svc-live b { font-size: 16px; font-variant-numeric: tabular-nums; }
.login-help { margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.login-help summary { cursor: pointer; }
.login-help p { margin: 8px 0; }
.login-help code { display: block; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font: 11.5px var(--mono); word-break: break-all; color: var(--text-2); }

.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .cols-5 { grid-template-columns: minmax(0, 1fr); } }

/* Card headers: let wide control groups wrap below the title instead of squeezing it */
.card-head { flex-wrap: wrap; row-gap: 10px; }
.card-head > .grow { min-width: min(260px, 100%); }

.stat-link { display: block; color: inherit; text-decoration: none !important; }
.stat-link .card { height: 100%; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover .card { border-color: var(--accent); box-shadow: var(--shadow); }
.chart-tip .tip-block { padding: 4px 0; border-top: 1px solid var(--border); }
.chart-tip .tip-block:first-of-type { border-top: 0; }
.chart-tip { max-width: 340px; }

/* ---------------- costs ---------------- */
.costbar { display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.costbar span { display: block; min-width: 3px; }
.cost-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.cost-item:last-child { border-bottom: 0; }
.howlist { display: grid; gap: 10px; font-size: 13px; line-height: 1.5; }
.calltl { position: relative; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 8px 10px 8px 40px; }
.calltl .ln { position: relative; height: 16px; margin: 3px 0; }
.calltl .ln i { position: absolute; top: 2px; height: 12px; border-radius: 4px; min-width: 3px; background: #8b5cf6; opacity: .85; }
.calltl .ln i.stream { background: var(--chart-1); }
.calltl .ln i.langchain { background: var(--chart-3); }
.calltl .ln i.ocr { background: var(--chart-2); }
.calltl .ln b { position: absolute; left: -6px; top: 0; font-size: 10.5px; color: var(--text-3); font-weight: 500; transform: translateX(-100%); }

.server-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin: 4px 0 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.server-box > svg { flex: none; margin-top: 2px; }
.server-box .grow > div + div { margin-top: 3px; }
.server-box.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); }
.server-box.muted { color: var(--text-3); }
