/* Light theme, deliberately plain: one table, one accent. */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #e3e6ea;
  --text: #1c2530;
  --muted: #6b7684;
  --accent: #1a5fb4;
  --wide: #1a7f37;
  --narrow: #b26a00;
  --none: #75808c;
  --pending-bg: #fff8e6;
  --pending-line: #e8c86a;
}

* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px 32px;
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
}

header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); }
.logo { margin-left: auto; height: 38px; }

/* filter bar — a row of filters; more get added as the universe grows */
#filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin-bottom: 16px;
}
.filter { display: inline-flex; align-items: center; gap: 7px; }
.filter-label { color: var(--muted); font-size: 12.5px; }
#filters select {
  font: inherit; font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text);
}
.dropdown { position: relative; }
.dropdown summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); font-size: 13px;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown[open] summary { border-color: var(--accent); color: var(--accent); }
#co-count { font-weight: 600; }
.dd-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 340px; max-height: 320px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 35, 60, .12); padding: 6px;
}
.dd-item {
  display: block; padding: 6px 10px; border-radius: 5px;
  cursor: pointer; font-size: 13px;
}
.dd-item:hover { background: #f2f6fc; }
.dd-item em { font-style: normal; color: var(--muted); font-size: 12px; }

/* table */
table.moat {
  width: 100%; border-collapse: collapse;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.moat th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
  padding: 10px 14px; border-bottom: 2px solid var(--line);
  background: #fcfcfd;
}
.moat td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.moat tr:last-child td { border-bottom: none; }

.col-co { width: 15%; }
.col-rating { width: 11%; white-space: nowrap; }
.col-summary { width: 34%; }
.col-notes { width: 20%; }
.col-action { width: 9%; text-align: right; }

.co-name { font-weight: 600; }
.co-fy { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; color: #fff;
}
.badge.wide { background: var(--wide); }
.badge.narrow { background: var(--narrow); }
.badge.none { background: var(--none); }

.meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.none-yet { color: var(--muted); }
.col-summary { color: #2a3540; font-size: 13px; }

/* compact AI assessment facts */
td.facts { cursor: pointer; }
td.facts:hover { background: #f2f6fc; }
.facts-grid {
  display: grid; grid-template-columns: repeat(4, auto);
  gap: 4px 26px; justify-content: start;
}
.fact-label {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.fact-val { font-size: 14px; font-weight: 600; white-space: nowrap; }
.fact-sub { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.fact-chips { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip-warn {
  font-size: 11px; font-weight: 600; color: #8a5a00;
  background: #fff4d6; border: 1px solid #ecd48a;
  border-radius: 999px; padding: 1px 9px; white-space: nowrap;
}
.chip-warn.big { font-size: 12.5px; padding: 3px 12px; }
.chip-info {
  font-size: 11px; font-weight: 600; color: #1a5fb4;
  background: #e8f0fb; border: 1px solid #b9d0ee;
  border-radius: 999px; padding: 1px 9px; white-space: nowrap;
}
.src-chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; background: #f1f3f6;
  border: 1px solid var(--line); color: #37424e;
}
.src-chip.dominant { background: #e8f0fb; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.fin-row { font-size: 13px; margin-bottom: 5px; }
.fin-mark { display: inline-block; width: 18px; font-weight: 700; }
.fin-mark.yes { color: var(--wide); }
.fin-mark.no { color: #b3423f; }
.claims-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .claims-grid { grid-template-columns: 1fr; } }
.claim-col { border: 1px solid var(--line); border-radius: 7px; padding: 10px 13px; font-size: 13px; }
.claim-col h3 {
  margin: 0 0 6px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
}
.claim-col p { margin: 0; }
.claim-col.validated { border-left: 4px solid var(--wide); }
.claim-col.unvalidated { border-left: 4px solid #d9a400; background: #fffdf5; }
.card.devils { border-left: 4px solid #75808c; }
.badge.disagree {
  background: #fff; color: #b3423f; border: 1.5px solid #b3423f;
  margin-left: 4px;
}

td.editable { cursor: pointer; }
td.editable:hover { background: #f2f6fc; }

/* pending proposal */
td.pending { background: var(--pending-bg); }
tr td.pending { border-bottom-color: var(--pending-line); }
.approve-bar { margin-top: 8px; display: flex; gap: 6px; }

/* buttons */
.btn {
  font: inherit; font-size: 13px; padding: 5px 12px;
  border-radius: 5px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer;
}
.btn.agent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.agent:hover { background: #e8f0fb; }
.btn.agent:disabled { opacity: .45; cursor: not-allowed; }
.btn.approve { background: var(--wide); border-color: var(--wide); color: #fff; }
.btn.discard { color: var(--muted); }
.btn:hover { filter: brightness(.97); }

.btn.agent.progress {
  border-color: var(--line); color: var(--muted); font-weight: 500;
  cursor: progress; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.err { color: #a03e3b; font-size: 12px; margin-top: 4px; max-width: 160px; }

/* analyst inline form */
.analyst-form { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.analyst-form select, .analyst-form textarea, .analyst-form input[type="text"] {
  font: inherit; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 5px; background: #fff; color: var(--text); width: 100%;
}

/* ── detail page ─────────────────────────────────────────────── */
.co-name a { color: inherit; text-decoration: none; }
.co-name a:hover { color: var(--accent); text-decoration: underline; }
.back { color: var(--accent); text-decoration: none; font-size: 13px; margin-right: 6px; }
.muted { color: var(--muted); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 20px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin: 0 0 8px; }
.count {
  display: inline-block; min-width: 20px; text-align: center;
  background: #eef1f5; border-radius: 999px; font-size: 12px; padding: 1px 7px;
  color: var(--muted); font-weight: 600;
}
.explain { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }

.badge.big { font-size: 16px; padding: 5px 16px; }
.verdict-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.primary { font-size: 14px; }
.conf { margin-left: auto; color: var(--muted); }
.conf strong { color: var(--text); font-size: 16px; }

.verdict-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.vblock { border: 1px solid var(--line); border-radius: 7px; padding: 10px 13px; }
.vblock h3 {
  margin: 0 0 6px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
}
.bignum { font-size: 22px; font-weight: 700; }
.gates { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.cap {
  background: #fdf1f1; border: 1px solid #eccfcf; color: #8c3b3b;
  border-radius: 5px; padding: 4px 8px; font-size: 12.5px; margin-bottom: 4px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.ledger-item { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ledger-item:last-child { border-bottom: none; }
.card.intervene { border-left: 4px solid #d9a400; }
.card.intervene h2 { color: #7a5600; }
.why { color: #8a5a00; font-size: 12px; margin-left: 6px; }

.checklist-title { font-size: 17px; margin: 22px 0 10px; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.section-head h2 { margin: 0; }
.call {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 10px; border-radius: 4px; color: #fff; background: var(--none);
}
.call.yes { background: var(--wide); }
.call.leaning { background: #4a8bd4; }
.call.neutral { background: var(--none); }
.call.no { background: #b3423f; }
.call.silent { background: #9aa4af; }

.question { border-top: 1px solid var(--line); padding: 12px 0; }
.q-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.q-title .qid { font-weight: 400; margin-right: 4px; }
.q-score { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.score-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
}
.raw { font-size: 12px; color: #8a5a00; }
.q-evidence { margin-left: 10px; border-left: 2px solid var(--line); padding-left: 12px; }
.q-why {
  margin: 8px 0 0 10px; font-size: 12.5px; color: #7a5600;
  background: #fff8e6; border: 1px solid #ecd48a; border-radius: 5px;
  padding: 5px 10px; display: inline-block;
}
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qid {
  font-family: Consolas, monospace; font-size: 11.5px; color: var(--muted);
  background: #f1f3f6; border-radius: 4px; padding: 1px 6px;
}
.pol {
  font-weight: 700; font-size: 12px; border-radius: 4px; padding: 1px 8px; color: #fff;
}
.pol.p1 { background: var(--wide); }
.pol.p0 { background: var(--none); }
.pol.p-1 { background: #b3423f; }
.status { font-size: 12px; color: var(--muted); }
.claim {
  font-size: 11.5px; color: #8a6100; background: #fff4d6;
  border: 1px solid #ecd48a; border-radius: 4px; padding: 1px 7px;
}
.q-text { color: var(--muted); font-size: 12.5px; margin: 4px 0; }
.finding { font-size: 13px; margin: 6px 0; }
.quote { font-size: 12.5px; margin: 4px 0 0 10px; color: #37424e; }
.quote q { font-style: italic; }
.cite {
  display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--accent);
  background: #e8f0fb; border-radius: 4px; padding: 1px 7px; margin-right: 6px;
  text-decoration: none; cursor: pointer;
}
a.cite:hover { background: var(--accent); color: #fff; }

/* page-text modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(25, 35, 50, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box {
  background: var(--panel); border-radius: 10px; width: min(760px, 92vw);
  max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(10, 20, 40, .3);
}
.modal-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.modal-head .btn { margin-left: auto; }
.page-text {
  margin: 0; padding: 14px 18px; overflow: auto; white-space: pre-wrap;
  font: 12px/1.5 Consolas, monospace; color: #2a3540;
}

/* ── method review module ── */
.ev-list { width: 100%; border-collapse: collapse; }
.ev-list th, .ev-list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e3e7ec; }
.ev-obs { border: 1px solid #e3e7ec; border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: #fff; }
.ev-obs.accepted { border-left: 4px solid var(--wide); }
.ev-obs.rejected { border-left: 4px solid #b3423f; opacity: .55; }
.ev-obs.pending { border-left: 4px solid #c8cfd8; }
.ev-obs-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-note { margin: 4px 0 2px; font-size: 14px; }
.ev-btns { margin-left: auto; display: flex; gap: 6px; }
.ev-btns button { border: 1px solid #c8cfd8; background: #fff; border-radius: 6px;
  padding: 2px 12px; cursor: pointer; font-size: 14px; }
.ev-btns button.ok.on { background: var(--wide); color: #fff; border-color: var(--wide); }
.ev-btns button.no.on { background: #b3423f; color: #fff; border-color: #b3423f; }
.wchip { font-size: 11px; border-radius: 4px; padding: 1px 7px; background: #eef1f5; color: #444; }
.wchip.w3 { background: #2d3f57; color: #fff; }
.wchip.w2 { background: #7a8ba3; color: #fff; }
.erosion { font-size: 12px; color: #b3423f; margin-left: 6px; }
.ev-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.ev-actions form.inline { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.ev-actions input { border: 1px solid #c8cfd8; border-radius: 6px; padding: 4px 8px; }
.ev-actions button { border: 1px solid #2d3f57; background: #2d3f57; color: #fff;
  border-radius: 6px; padding: 5px 14px; cursor: pointer; }

/* method switcher */
.method-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.mtab { padding: 6px 18px; border: 1px solid #c8cfd8; border-radius: 8px; text-decoration: none;
  color: #2d3f57; font-weight: 600; }
.mtab.on { background: #2d3f57; color: #fff; border-color: #2d3f57; }

/* the agent's own output, kept verbatim beside the parsed structures */
.card.delivered { border-left: 3px solid #0E6B7A; }
.delivered-text {
  margin: 0; padding: 12px 14px; background: #F7F9FA; border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px; line-height: 1.55; color: #2C3A45;
  white-space: pre-wrap; word-break: break-word;
  max-height: 460px; overflow: auto;
}
/* transcribed financial series */
table.fin { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.fin th {
  text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: #8695A3; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #DCE4EA;
}
table.fin td { padding: 7px 8px; border-bottom: 1px solid #EEF2F4; vertical-align: top; }
table.fin tr:last-child td { border-bottom: none; }
.fin-metric { font-weight: 600; color: #16202A; }
.fin-val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.fin-quote { color: #5D6D7C; font-style: italic; }
.fin-flags span {
  display: inline-block; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 5px; border-radius: 2px; margin-right: 3px; font-weight: 600;
}
.fin-flags .ok { background: #E3F0F1; color: #0E6B7A; }
.fin-flags .bad { background: #F6EEDD; color: #8A5A00; }
.fin-note {
  margin-top: 10px; font-size: 12.5px; color: #5D6D7C; line-height: 1.5;
  border-left: 2px solid #DCE4EA; padding-left: 10px;
}

/* ---- sign-in: the Wolken sign-in look — pastel wash, one white card ---- */
body.signin {
  min-height: 100vh; padding: 0; display: grid; place-items: center;
  background:
    radial-gradient(60% 50% at 8% 12%, #dbe7ff 0%, transparent 60%),
    radial-gradient(45% 45% at 88% 20%, #fff7c2 0%, transparent 60%),
    radial-gradient(40% 40% at 55% 30%, #efdcff 0%, transparent 60%),
    radial-gradient(50% 45% at 85% 90%, #d9f1ff 0%, transparent 60%),
    #f3f4f7;
}
.signin-card {
  width: 480px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 35, 60, .10); padding: 34px 30px 30px;
}
.signin-logo { height: 30px; display: block; margin-bottom: 22px; }
.signin-card h1 { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.signin-sub { color: var(--muted); margin: 0 0 22px; }
.signin-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.signin-card input[type=email], .signin-card input[type=password], .signin-card input[type=text] {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1px solid #cfd5dd; border-radius: 6px; background: #fffbe6; color: var(--text);
}
.signin-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(26, 95, 180, .18); }
.signin-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 18px; }
.signin-check { font-weight: 400 !important; margin: 0 !important; display: inline-flex; align-items: center; gap: 8px; }
.signin-btn {
  width: 100%; font: inherit; font-size: 15px; font-weight: 600; color: #fff;
  background: #0f6fe5; border: 0; border-radius: 6px; padding: 11px; cursor: pointer;
}
.signin-btn:hover { background: #0b5cc1; }
.signin-error {
  background: #fdecec; border: 1px solid #f3b4b4; color: #8a1f1f;
  border-radius: 6px; padding: 9px 12px; margin: 0 0 8px;
}
header .who { margin-left: auto; color: var(--muted); font-size: 12.5px; }
header .who a { color: var(--muted); }
header .who + .logo { margin-left: 14px; }

/* ---- Ask drawer: read-only assistant over the stored record ---- */
.ask { margin: 18px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.ask > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; }
.ask > summary::-webkit-details-marker { display: none; }
.ask > summary::before { content: "▸"; color: var(--muted); }
.ask[open] > summary::before { content: "▾"; }
.ask-title { font-weight: 600; }
.ask-sub { color: var(--muted); font-size: 12.5px; }
.ask-body { padding: 0 14px 14px; }
.ask-log { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ask-turn { border-left: 3px solid var(--accent); padding: 6px 12px; background: #f7f9fc; border-radius: 0 6px 6px 0; }
.ask-q { font-weight: 600; margin-bottom: 4px; }
.ask-a { white-space: pre-wrap; }
.ask-a.err { color: #8a1f1f; }
.ask-meta { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.ask textarea { width: 100%; font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
.ask-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.ask-busy { color: var(--accent); font-size: 12.5px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.ask-note { color: var(--muted); font-size: 11.5px; margin-left: auto; }
