/* OKCapture collector console. Same design system as the portal: values come from tokens.css
   (a copy of portal/app/static/css/tokens.css). No new colours here. */
* { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { min-height: 100vh; padding: var(--page-pad); }
.topbar, .page { max-width: var(--content-max); margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: var(--section-gap); margin-top: 24px; }

/* ---- top bar ---- */
.topbar { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; font: 600 19px/1 var(--font-display); letter-spacing: -0.02em; color: var(--accent); }
.brand .hex { display: block; flex: none; width: 26px; height: 30px; background: var(--accent); }
.brand-tag { padding: 4px 9px; border-radius: 10px; background: var(--surface); color: var(--ink-3); font: 500 11px/1 var(--font-text); letter-spacing: 0.08em; text-transform: uppercase; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav a { display: flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid transparent; background: var(--surface-muted); }
.nav a:hover { background: var(--surface); }
.nav a[aria-current] { background: var(--surface); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.tenant { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 22px; background: var(--surface-muted); font-weight: 500; }
.tenant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tenant:has(#company:empty) { visibility: hidden; }

/* ---- hero ---- */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px 48px; align-items: end; padding-top: 20px; border-top: var(--rule-hero); }
.hero-right { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; padding-bottom: 4px; }
.hero-right > p { margin: 0; max-width: 460px; color: var(--ink-2); }
.eyebrow a:hover { text-decoration: underline; }
.page-title { margin-top: 8px; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 13px; }
.note { font-size: 12px; color: var(--ink-3); margin: 0; }

/* ---- cards, split panel ---- */
.card { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card-head .section-title { margin-top: 6px; line-height: 1.2; }
.card-title { margin: 0; font: 600 17px/1.2 var(--font-display); letter-spacing: -0.01em; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.split-main { grid-column: span 2; padding: 26px 30px 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.split-hl { background: var(--accent); color: #fff; padding: 14px 30px 22px; border-bottom-left-radius: var(--radius-panel-corner); display: flex; flex-direction: column; }
.split-hl .eyebrow { color: rgba(255, 255, 255, 0.88); padding: 14px 0 4px; }
.hl-row { display: block; padding: 14px 0; border-top: 1px solid rgba(255, 255, 255, 0.35); }
.hl-row b { display: block; font: 400 34px/1 var(--font-display); letter-spacing: -0.03em; }
.hl-row span { display: block; margin-top: 4px; font-size: 13px; }
@media (max-width: 760px) { .split-main { grid-column: auto; } .split-hl { border-bottom-left-radius: 0; } }
.kpi-xl .of { color: var(--rule); }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; }
.grow { flex: 1; }
.scroll { overflow-x: auto; }

/* ---- stats strip (run detail) ---- */
.stats { display: flex; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.stat { flex: 1 1 160px; padding: 22px 26px; border-right: var(--rule-row); border-bottom: var(--rule-row); margin: 0 -1px -1px 0; min-width: 0; } /* outer rules are clipped by the card */
.stat .eyebrow { color: inherit; opacity: 0.8; }
.stat b { display: block; margin-top: 6px; font: 400 34px/1 var(--font-display); letter-spacing: -0.03em; }
.stat span { display: block; margin-top: 4px; font-size: 13px; opacity: 0.85; }
.stat.hl { background: var(--accent); color: #fff; border-color: var(--accent); }
.stat.hl .eyebrow, .stat.hl span { opacity: 0.92; }

/* ---- marks: unit squares, bars, legend, tags ---- */
.squares { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.sq { display: block; flex: none; width: 14px; height: 14px; border-radius: 3px; }
.sq.c-done, .legend i.c-done { background: var(--accent); }
.sq.c-rules, .legend i.c-rules { background: var(--ink); }
.sq.c-model, .legend i.c-model { background: var(--depth-working); }
.sq.c-same, .legend i.c-same { background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--border); }
.sq.c-err, .legend i.c-err { background: var(--risk-high); }
.k-input { background: var(--accent); }
.k-cache { background: var(--depth-working); }
.k-write { background: var(--depth-aware); box-shadow: inset 0 0 0 1px var(--depth-working); }
.k-output { background: var(--accent-deep); }
.s-triage { background: var(--depth-working); }
.s-extract { background: var(--accent); }
.s-other { background: var(--ink-3); }
.unit-row { display: grid; grid-template-columns: minmax(120px, 170px) 44px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: var(--rule-row); }
.unit-row .n { font: 500 16px/1.2 var(--font-display); text-align: right; }
.unit-row .lab { font-weight: 500; }
.unit-row .share { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; color: var(--ink-3); }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { display: block; width: 10px; height: 10px; border-radius: 3px; }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; min-width: 8px; }
.bar i { display: block; height: 100%; }
.tag { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-2); }
.tag.llm { background: var(--depth-aware); color: var(--accent-deep); }
.tag.drop { background: var(--risk-soft-bg); color: var(--risk-soft-label); }
.tag.err { background: var(--risk-high); color: var(--ink); max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.tag.live { background: var(--accent); color: #fff; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid var(--ink); background: transparent; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.card .btn:hover, .split .btn:hover { background: var(--surface-sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.arrowed { padding: 0 8px 0 20px; gap: 10px; }
.badge-arrow { display: flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--accent); }
.btn.danger { border-color: var(--risk-soft-label); color: var(--risk-soft-label); }
.btn.danger:hover { background: var(--risk-soft-bg); }
.btn.sm { min-height: 40px; padding: 0 16px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:disabled:hover { background: transparent; }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 22px; background: var(--surface); align-self: flex-start; }
.seg.on-card { background: var(--surface-sunken); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 18px; background: transparent; cursor: pointer; white-space: nowrap; }
.seg button small { font-size: 12px; opacity: 0.8; }
.seg [aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 500; }
.seg.on-card [aria-pressed="true"] { background: var(--surface); color: var(--ink); }
input[type=text], input[type=number], select { height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--border); background: var(--surface); max-width: 100%; }
input[type=number] { padding-right: 8px; }
textarea { display: block; width: 100%; min-height: 120px; padding: 12px 14px; border-radius: var(--radius-tile); border: 1px solid var(--border); background: var(--surface); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 20px; background: var(--surface-sunken); cursor: pointer; }
.check:has(input:checked) { background: var(--depth-aware); color: var(--accent-deep); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .inline-field > span { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.field input[type=text], .field input[type=number] { width: 100%; max-width: 420px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; }
.fields { display: flex; flex-direction: column; gap: 16px; }
.msg { padding: 12px 18px; border-radius: var(--radius-tile); background: var(--risk-soft-bg); color: var(--risk-soft-text); }
.msg.ok { background: var(--surface-sunken); color: var(--ink); }
.msg.live { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--ink); }
.spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-faint); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.empty { padding: 28px 0; text-align: center; color: var(--ink-3); margin: 0; }

/* ---- tables: no fills, dotted row rules ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px 10px 0; border-bottom: var(--rule-row); vertical-align: top; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; vertical-align: bottom; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.strong { font-weight: 500; }
td.nowrap { white-space: nowrap; }
td .sub { display: block; font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
td.wide { min-width: 220px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-muted); }
tr.click td:first-child a { font-weight: 500; }
tr.click td:first-child a:hover { color: var(--accent); }
.t-min { min-width: 760px; }
.t-wide { min-width: 980px; }
pre { white-space: pre-wrap; word-break: break-word; font: 12px/1.45 ui-monospace, Menlo, monospace; margin: 0; }

/* ---- pipeline band: each step is an arrow, its results of the last run below it ---- */
.fx-stage { display: flex; flex-direction: column; gap: 22px; padding: 8px 0 4px; }
.fx-row { display: flex; padding-left: 16px; }
.fx-col { flex: 1 1 0; min-width: 0; margin-left: -16px; display: flex; flex-direction: column; }
.fx-col.spacer { visibility: hidden; }
.fx-note { display: flex; gap: 10px; align-items: flex-start; min-height: 74px; padding: 14px 12px 0 38px; }
.fx-dot { flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--depth-working); margin: 4px 0; }
.fx-col.alt .fx-dot { background: var(--depth-advanced); }
.fx-col.llm .fx-dot { background: var(--accent); }
.fx-col.end .fx-dot { background: var(--ink); }
.fx-col.off .fx-dot { background: var(--meter-off); }
.fx-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fx-text b { font: 600 15px/1.2 var(--font-display); letter-spacing: -0.01em; white-space: nowrap; }
.fx-text small { font-size: 12px; line-height: 1.4; color: var(--ink-3); overflow-wrap: anywhere; }
.fx-drop { display: inline-block; padding: 0 8px; border-radius: 10px; background: var(--risk-soft-bg); color: var(--risk-soft-label); font-weight: 500; }
.fx-chev { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 88px; padding: 0 34px 0 38px;
  border: 0; text-align: left; background: var(--depth-aware); color: var(--ink); cursor: pointer; transition: transform .15s ease, filter .15s ease;
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 50%, calc(100% - 24px) 100%, 0 100%, 24px 50%); }
div.fx-chev { cursor: default; }
button.fx-chev:hover { transform: translateY(-3px); }
.fx-chev.alt { background: var(--depth-working); }
.fx-chev.llm { background: var(--accent); color: #fff; }
.fx-chev.end { background: var(--ink); color: #fff; }
.fx-chev.off { background: repeating-linear-gradient(135deg, var(--surface-sunken) 0 7px, var(--surface) 7px 14px); color: var(--ink-3); }
.fx-label { min-width: 0; font: 600 12px/1.25 var(--font-text); letter-spacing: 0.06em; text-transform: uppercase; overflow-wrap: break-word; hyphens: auto; }
.fx-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--ink); }
.fx-chev.llm .fx-ico { color: var(--accent); }
.fx-chev.off .fx-ico { color: var(--ink-3); }
/* selected: an ink outline that follows the arrow shape (the element itself is clipped, so the outline
   comes from drop-shadows on the column) */
.fx-col.sel .fx-wrap { filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)); position: relative; z-index: 2; }
.fx-chev:focus-visible { outline: none; filter: brightness(0.92); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding-top: 16px; border-top: var(--rule-row); }
.toolbar input[type=number] { width: 84px; }
.applies { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.applies .eyebrow { margin-right: 2px; }

@media (max-width: 520px) {
  .fx-chev { height: 76px; padding: 0 26px 0 30px; gap: 4px; }
  .fx-label { font-size: 10.5px; letter-spacing: 0.03em; }
  .fx-ico { width: 26px; height: 26px; }
  .fx-note { padding-left: 30px; }
  .split-main, .split-hl { padding-left: 20px; padding-right: 20px; }
  .card { padding: 22px 20px; }
  .unit-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .unit-row .squares { grid-column: 1 / -1; }
}

/* ---- sign-in and account menu (docs/SPEC-signin.md §5) ---- */
.signed-out #nav, .signed-out .tenant { visibility: hidden; }
.signin-card { max-width: 720px; }
.signin-card .lead { margin: 0; max-width: 600px; color: var(--ink-2); }
.topbar-end { display: flex; align-items: center; gap: 10px; }
.account { position: relative; }
.account summary { list-style: none; cursor: pointer; border-radius: 50%; }
.account summary::-webkit-details-marker { display: none; }
.account summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
  font: 600 14px/1 var(--font-display); letter-spacing: 0.02em; color: var(--ink); }
.account[open] .avatar { background: var(--ink); color: #fff; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(300px, calc(100vw - 32px)); background: var(--surface);
  border-radius: var(--radius-tile, 16px); box-shadow: 0 12px 40px rgba(17, 18, 22, 0.14); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.account-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-who span { color: var(--ink-3); font-size: 13px; overflow-wrap: anywhere; }
.account-menu .btn { width: 100%; }

/* ---- activity page (design: Activity.dc.html; moved here from the portal) ---- */
.act-hero { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: flex-end; justify-content: space-between; }
.act-run { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 420px; margin-left: auto; }
.act-status { text-align: right; color: var(--ink-2); }
.act-status:empty { display: none; }
.act-progress { display: inline-flex; align-items: center; gap: 10px; text-align: left; }
.act-spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-faint); border-top-color: var(--accent); animation: act-spin 0.9s linear infinite; }
@keyframes act-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .act-spin { animation-duration: 3s; } }
.act-result { display: inline-block; padding: 8px 14px; border-radius: var(--radius-tile); background: var(--surface); text-align: left; }
.act-result.bad { background: var(--risk-soft-bg); color: var(--risk-soft-text); }

/* stats strip: three white cells and the blue one */
.act-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.act-stat { padding: 22px 26px; border-right: var(--rule-row); min-width: 0; }
.act-stat:last-child { border-right: 0; }
.act-stat .eyebrow { color: inherit; opacity: 0.8; }
.act-num { margin-top: 6px; font: 400 34px/1 var(--font-display); letter-spacing: -0.03em; }
.act-sub { margin-top: 4px; font-size: 13px; opacity: 0.85; }
.act-stat.hl { background: var(--accent); color: #fff; border-right: 0; }
.act-stat.hl .eyebrow, .act-stat.hl .act-sub { opacity: 0.92; }
@media (max-width: 480px) { .act-stat { border-right: 0; border-bottom: var(--rule-row); } }

.act-filter { align-self: flex-start; }
.act-filter button { padding: 0 14px; font: inherit; font-weight: 500; color: var(--ink-2); }
.act-filter button[aria-pressed="true"] { color: #fff; }

/* day card with the vertical timeline */
.act-day { padding: 24px 28px 12px; gap: 8px; }
.act-day .section-title { line-height: 1.25; }
.act-list { margin: 0; padding: 0; list-style: none; }
.act-row { display: grid; grid-template-columns: 52px 22px minmax(0, 1fr); gap: 0 14px; align-items: start; }
.act-time { padding-top: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.act-rail { position: relative; align-self: stretch; display: flex; justify-content: center; }
.act-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dotted var(--rule); }
.act-dot { position: relative; margin-top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); }
.act-dot.curator { background: var(--accent); }
.act-dot.collector { background: var(--surface); border: 2px solid var(--ink); }
.act-body { padding: 12px 0 14px; border-bottom: 1px dotted var(--border); min-width: 0; }
.act-row:last-child .act-body { border-bottom: 0; }
.act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.act-title { font-weight: 600; overflow-wrap: anywhere; }
.act-chip { padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-2); }
.act-chip.curator { background: var(--depth-aware); color: var(--accent-deep); }
.act-chip.user { background: var(--ink); color: #fff; }
.act-detail { margin-top: 2px; color: var(--ink-2); overflow-wrap: anywhere; }
.act-foot { margin: 0; color: var(--ink-3); font-size: 13px; }

@media (max-width: 520px) {
  .act-day { padding: 20px 18px 8px; }
  .act-row { grid-template-columns: 42px 16px minmax(0, 1fr); gap: 0 10px; }
  .act-run { align-items: flex-start; margin-left: 0; }
  .act-status { text-align: left; }
}
