/* Onceproof application styles. Values come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--weight-regular) var(--text-md)/var(--lh-normal) var(--font-sans);
  font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
[hidden] { display: none !important; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.caps { text-transform: uppercase; letter-spacing: var(--tracking-caps); font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--text-3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: var(--space-2); }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.grow { flex: 1; min-width: 0; }
.skip { position: absolute; left: -999px; top: var(--space-2); z-index: var(--z-toast); background: var(--surface); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.skip:focus { left: var(--space-2); }

/* ---- icons ---------------------------------------------------------------- */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; } .icon.lg { width: 20px; height: 20px; }

/* ---- shell ----------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.topbar {
  grid-column: 2; display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-5);
  border-bottom: var(--border-width) solid var(--border); background: var(--bg-raised); min-width: 0;
}
.sidebar {
  grid-row: 1 / span 2; background: var(--bg-raised); border-right: var(--border-width) solid var(--border);
  display: flex; flex-direction: column; min-width: 0; position: relative; z-index: var(--z-sidebar);
}
.main { overflow-y: auto; overflow-x: hidden; min-width: 0; }
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-16); }

.brand { display: flex; align-items: center; gap: var(--space-2); height: var(--topbar-h); padding: 0 var(--space-4); font-weight: var(--weight-semibold); letter-spacing: -0.01em; flex: none; }
.brand-mark { width: 22px; height: 22px; flex: none; }
.collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-group-title, .collapsed .nav-count, .collapsed .env-card { display: none; }
.nav { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-2) var(--space-4); }
.nav-group { margin-top: var(--space-4); }
.nav-group-title { padding: 0 var(--space-2) var(--space-1); }
.nav a {
  display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: var(--text-sm); text-decoration: none; transition: background var(--dur-fast);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: var(--weight-medium); box-shadow: inset 0 0 0 1px var(--border); }
.nav a[aria-current="page"] .icon { color: var(--accent-text); }
.nav-count { margin-left: auto; font-size: var(--text-2xs); font-weight: var(--weight-semibold); padding: 0 6px; border-radius: var(--radius-pill); background: var(--danger-bg); color: var(--danger-fg); line-height: 18px; }
.collapsed .nav a { justify-content: center; padding: 0; }
.sidebar-foot { padding: var(--space-2); border-top: var(--border-width) solid var(--border); display: flex; gap: var(--space-1); }
.collapsed .sidebar-foot { flex-direction: column; }
.resizer { position: absolute; top: 0; right: -3px; bottom: 0; width: 6px; cursor: col-resize; }
.resizer:hover, .resizer.active { background: linear-gradient(var(--accent), var(--accent)) center/2px 100% no-repeat; }
.env-card { margin: var(--space-3) var(--space-2) 0; padding: var(--space-2) var(--space-3); border: var(--border-width) dashed var(--border-strong); border-radius: var(--radius-md); font-size: var(--text-xs); color: var(--text-2); }

.crumbs { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--text-3); min-width: 0; }
.crumbs a { color: var(--text-3); } .crumbs span[aria-current] { color: var(--text); font-weight: var(--weight-medium); }
.search-trigger {
  display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 var(--space-2) 0 var(--space-3); min-width: 260px;
  border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-3); cursor: pointer; font-size: var(--text-sm);
}
.search-trigger:hover { border-color: var(--border-strong); }
kbd { font-family: var(--font-sans); font-size: var(--text-2xs); padding: 1px 5px; border: var(--border-width) solid var(--border); border-bottom-width: 2px; border-radius: var(--radius-xs); color: var(--text-3); background: var(--bg-raised); }
.env-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 var(--space-2); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-medium); border: var(--border-width) solid var(--border); background: var(--surface); }
.env-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning-fg); }
.env-pill.live .dot { background: var(--success-fg); }

/* ---- buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); height: 32px; padding: 0 var(--space-3);
  border-radius: var(--radius-md); border: var(--border-width) solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; white-space: nowrap; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 26px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.btn.icon-only { width: 32px; padding: 0; } .btn.sm.icon-only { width: 26px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); }
.btn.primary:hover { background: var(--accent-hover); }
/* consequential decisions: never styled like casual CTAs */
.btn.decide { height: 38px; padding: 0 var(--space-4); border-width: 1.5px; font-weight: var(--weight-semibold); }
.btn.decide.approve { border-color: var(--success-line); color: var(--success-fg); background: var(--success-bg); }
.btn.decide.approve:hover:not(:disabled) { background: var(--success-fg); color: var(--text-inverse); }
.btn.decide.reject { border-color: var(--danger-line); color: var(--danger-fg); background: var(--surface); }
.btn.decide.reject:hover:not(:disabled) { background: var(--danger-bg); }
.btn.kill { border-color: var(--danger-line); color: var(--danger-fg); }
.btn.kill:hover { background: var(--danger-bg); }

.input, .select {
  height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-md); border: var(--border-width) solid var(--border-strong);
  background: var(--surface); font-size: var(--text-sm); min-width: 0;
}
.input:focus, .select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px var(--accent-weak); }
textarea.input { height: auto; padding: var(--space-2) var(--space-3); resize: vertical; font-family: var(--font-mono); font-size: var(--text-xs); }
.field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-2); }
.check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* ---- page header ------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head h1 { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.015em; margin: 0; line-height: var(--lh-tight); }
.page-head p { margin: var(--space-1) 0 0; color: var(--text-3); font-size: var(--text-sm); max-width: 680px; }
h2.section { font-size: var(--text-md); font-weight: var(--weight-semibold); margin: 0; letter-spacing: -0.005em; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-6) 0 var(--space-3); }
.section-head:first-child { margin-top: 0; }

/* ---- surfaces ---------------------------------------------------------------- */
.panel { background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); }
.panel-pad { padding: var(--space-4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: var(--border-width) solid var(--border); }
.divider { height: 1px; background: var(--border); margin: var(--space-4) 0; border: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-5); align-items: start; }

/* ---- metrics strip (compact, information-rich) --------------------------------- */
.metrics { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.metric { padding: var(--space-3) var(--space-4); border-right: var(--border-width) solid var(--border); min-width: 0; text-decoration: none; color: inherit; display: block; }
.metric:last-child { border-right: 0; }
a.metric:hover { background: var(--surface-2); text-decoration: none; }
.metric .label { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.metric .value { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; margin-top: 2px; line-height: var(--lh-tight); font-variant-numeric: tabular-nums; }
.metric .sub { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.metric.t-unknown .value { color: var(--unknown-fg); } .metric.t-danger .value { color: var(--danger-fg); }
.metric.t-pending .value { color: var(--pending-fg); } .metric.t-success .value { color: var(--success-fg); }

/* ---- status: text + icon + shape, never colour alone ---------------------------- */
.status { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 6px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; border: var(--border-width) solid transparent; }
.status .icon { width: 13px; height: 13px; stroke-width: 2; }
.t-success { --fg: var(--success-fg); --bg-s: var(--success-bg); --line: var(--success-line); }
.t-warning { --fg: var(--warning-fg); --bg-s: var(--warning-bg); --line: var(--warning-line); }
.t-danger { --fg: var(--danger-fg); --bg-s: var(--danger-bg); --line: var(--danger-line); }
.t-info { --fg: var(--info-fg); --bg-s: var(--info-bg); --line: var(--info-line); }
.t-unknown { --fg: var(--unknown-fg); --bg-s: var(--unknown-bg); --line: var(--unknown-line); }
.t-pending { --fg: var(--pending-fg); --bg-s: var(--pending-bg); --line: var(--pending-line); }
.t-blocked { --fg: var(--blocked-fg); --bg-s: var(--blocked-bg); --line: var(--blocked-line); }
.t-recover { --fg: var(--recover-fg); --bg-s: var(--recover-bg); --line: var(--recover-line); }
.t-neutral { --fg: var(--neutral-fg); --bg-s: var(--neutral-bg); --line: var(--neutral-line); }
.status { color: var(--fg); background: var(--bg-s); }
.status.t-unknown { border: var(--border-width) dashed var(--line); background: transparent; }   /* signature: unknown is hollow + dashed */
.status.t-blocked { border-color: var(--line); background: transparent; }
.status.lg { height: 30px; padding: 0 12px 0 9px; font-size: var(--text-sm); }
.status.lg .icon { width: 16px; height: 16px; }
.risk { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-2); }
.risk-bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.risk-bars i { display: block; width: 3px; border-radius: 1px; background: var(--border-strong); }
.risk-bars i:nth-child(1) { height: 6px; } .risk-bars i:nth-child(2) { height: 9px; } .risk-bars i:nth-child(3) { height: 12px; }
.risk.low .risk-bars i:nth-child(1) { background: var(--text-3); }
.risk.medium .risk-bars i:nth-child(-n+2) { background: var(--warning-fg); }
.risk.high .risk-bars i { background: var(--danger-fg); }
.verif { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--fg, var(--text-2)); }

/* ---- mini path (the signature motif, compact) --------------------------------------- */
.minipath { display: inline-flex; align-items: center; gap: 0; }
.minipath i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: transparent; flex: none; }
.minipath b { width: 8px; height: 0; border-top: 1.5px solid var(--border-strong); flex: none; }
.minipath i.done { background: var(--success-fg); border-color: var(--success-fg); }
.minipath b.done { border-top-color: var(--success-line); }
.minipath i.unknown { border: 1.5px dashed var(--unknown-fg); }
.minipath b.unknown { border-top: 1.5px dashed var(--unknown-line); }
.minipath i.recovered { background: var(--recover-fg); border-color: var(--recover-fg); }
.minipath i.fail { background: var(--danger-fg); border-color: var(--danger-fg); }
.minipath i.blocked { background: var(--blocked-fg); border-color: var(--blocked-fg); border-radius: 1px; }
.minipath i.wait { border-color: var(--pending-fg); }

/* ---- tables ---------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); overflow: auto; position: relative; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); table-layout: fixed; }
table.data th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-raised); text-align: left; font-weight: var(--weight-medium); color: var(--text-3);
  font-size: var(--text-xs); height: 34px; padding: 0 var(--space-3); border-bottom: var(--border-width) solid var(--border); white-space: nowrap; user-select: none;
}
table.data th .th-inner { display: flex; align-items: center; gap: 4px; position: relative; }
table.data th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table.data th button.sort:focus-visible { outline: 2px solid var(--focus); }
table.data th .col-resize { position: absolute; right: -12px; top: -8px; bottom: -8px; width: 8px; cursor: col-resize; }
table.data td { height: var(--row-h); padding: 0 var(--space-3); border-bottom: var(--border-width) solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; transition: background var(--dur-fast); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr.active td { background: var(--accent-weak); }
table.data tbody tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--line, var(--danger-line)); }
table.data td.right, table.data th.right { text-align: right; }
table.data th.right .th-inner { justify-content: flex-end; }
.cell-2 { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cell-2 .sub { font-size: var(--text-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-top: var(--border-width) solid var(--border); font-size: var(--text-xs); color: var(--text-3); }
.cards { display: none; }

/* ---- filter bar ---------------------------------------------------------------- */
.filterbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.filterbar .input.search { min-width: 240px; flex: 1; max-width: 380px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--space-2); border-radius: var(--radius-md); border: var(--border-width) dashed var(--border-strong); background: transparent; font-size: var(--text-xs); color: var(--text-2); cursor: pointer; }
.chip.on { border-style: solid; background: var(--surface); color: var(--text); }
.chip .val { color: var(--accent-text); font-weight: var(--weight-medium); }
.popover { position: absolute; z-index: var(--z-drawer); min-width: 220px; background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: var(--space-1); }
.popover .opt { display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.popover .opt:hover { background: var(--surface-2); }
.popover .opt input { accent-color: var(--accent); }
.popover .pop-foot { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-2); border-top: var(--border-width) solid var(--border); margin-top: var(--space-1); }

/* ---- attention list ---------------------------------------------------------------- */
.attn { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: var(--border-width) solid var(--border); text-decoration: none; color: inherit; }
.attn:last-child { border-bottom: 0; }
.attn:hover { background: var(--surface-2); text-decoration: none; }
.attn .why { font-size: var(--text-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .why .muted { font-size: var(--text-xs); }

/* ---- lifecycle (flagship) ----------------------------------------------------------- */
.lifecycle { list-style: none; margin: 0; padding: 0; position: relative; }
.stage { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); position: relative; }
.stage::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: -2px; border-left: 2px solid var(--rail, var(--border-strong)); }
.stage:last-child::before { display: none; }
.stage.s-done { --rail: var(--success-line); }
.stage.s-unknown { --rail: var(--unknown-line); }
.stage.s-unknown::before, .stage.s-pending::before, .stage.s-todo::before { border-left-style: dashed; }
.stage.s-recovered { --rail: var(--recover-line); }
.stage.s-fail, .stage.s-blocked { --rail: var(--border); }
.node { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); position: relative; z-index: 1; }
.node .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.s-done .node { border-color: var(--success-fg); background: var(--success-fg); color: var(--text-inverse); }
.s-current .node { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-weak); }
.s-unknown .node { border: 2px dashed var(--unknown-fg); color: var(--unknown-fg); background: var(--unknown-bg); }
.s-unknown.s-live .node { animation: pulse 2.4s var(--ease-out) infinite; }
.s-recovered .node { border-color: var(--recover-fg); background: var(--recover-fg); color: var(--text-inverse); }
.s-fail .node { border-color: var(--danger-fg); background: var(--danger-fg); color: var(--text-inverse); }
.s-blocked .node { border-color: var(--blocked-fg); background: var(--blocked-bg); color: var(--blocked-fg); border-radius: 7px; }
.s-pending .node { border-color: var(--pending-fg); color: var(--pending-fg); background: var(--pending-bg); }
.s-skip .node { border-style: dotted; opacity: .6; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--unknown-bg); } 50% { box-shadow: 0 0 0 7px var(--unknown-bg); } }
.stage-body { padding: 2px 0 var(--space-4); min-width: 0; }
.stage-head { display: flex; align-items: center; gap: var(--space-2); min-height: 26px; flex-wrap: wrap; }
.stage-name { font-weight: var(--weight-semibold); font-size: var(--text-sm); letter-spacing: 0.01em; }
.stage-meta { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); display: flex; gap: var(--space-3); }
.stage-summary { font-size: var(--text-sm); color: var(--text-2); margin-top: 1px; }
.stage-toggle { all: unset; cursor: pointer; display: block; width: 100%; border-radius: var(--radius-sm); }
.stage-toggle:hover .stage-name { color: var(--accent-text); }
.stage-detail { margin-top: var(--space-2); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--bg-raised); padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.stage-detail[hidden] { display: none; }
.evt { display: grid; grid-template-columns: 92px 150px minmax(0, 1fr); gap: var(--space-2); padding: 4px 0; border-bottom: var(--border-width) dashed var(--border); align-items: baseline; }
.evt:last-child { border-bottom: 0; }
.branch-note { font-size: var(--text-xs); color: var(--text-3); margin: -8px 0 var(--space-2) 40px; }

/* ---- flagship header ------------------------------------------------------------ */
.tx-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: start; margin-bottom: var(--space-5); }
.tx-id { display: flex; align-items: center; gap: var(--space-2); color: var(--text-3); font-size: var(--text-sm); }
.tx-amount { font-size: var(--text-3xl); font-weight: var(--weight-semibold); letter-spacing: -0.03em; line-height: 1.1; margin: var(--space-1) 0; font-variant-numeric: tabular-nums; }
.tx-kind { font-size: var(--text-md); color: var(--text-2); }
.state-callout { border-radius: var(--radius-lg); padding: var(--space-4); border: var(--border-width) solid var(--line); background: var(--bg-s); color: var(--text); margin-bottom: var(--space-4); }
.state-callout.t-unknown { border-style: dashed; border-width: 1.5px; }
.state-callout h3 { margin: 0 0 var(--space-1); font-size: var(--text-lg); display: flex; align-items: center; gap: var(--space-2); color: var(--fg); letter-spacing: -0.01em; }
.state-callout p { margin: 0; color: var(--text-2); font-size: var(--text-sm); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3) var(--space-5); margin-top: var(--space-3); }
.fact .k { font-size: var(--text-xs); color: var(--text-3); margin-bottom: 2px; }
.fact .v { font-size: var(--text-sm); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px var(--space-3); font-size: var(--text-sm); }
.kv > dt { color: var(--text-3); } .kv > dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.context-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; margin-bottom: var(--space-5); }
.context-grid > div { padding: var(--space-3) var(--space-4); border-right: var(--border-width) solid var(--border); min-width: 0; }
.context-grid > div:last-child { border-right: 0; }
.context-grid .v { font-size: var(--text-sm); margin-top: 4px; overflow-wrap: anywhere; }

/* ---- expected vs observed ------------------------------------------------------ */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); align-items: stretch; }
.compare .side { border: var(--border-width) solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); background: var(--bg-raised); }
.compare .arrow { display: grid; place-items: center; color: var(--text-3); }
.cmp-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 18px; gap: var(--space-2); padding: 5px 0; font-size: var(--text-sm); border-bottom: var(--border-width) dashed var(--border); align-items: center; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row .k { color: var(--text-3); font-size: var(--text-xs); }
.cmp-row.bad .v { color: var(--danger-fg); font-weight: var(--weight-semibold); }
.cmp-row.ok .mark { color: var(--success-fg); } .cmp-row.bad .mark { color: var(--danger-fg); } .cmp-row.na .mark { color: var(--unknown-fg); }
.verdict { margin-top: var(--space-3); display: flex; align-items: center; gap: var(--space-2); }

/* ---- evidence inspector -------------------------------------------------------- */
details.ev { border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); margin-bottom: var(--space-2); }
details.ev > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
details.ev > summary::-webkit-details-marker { display: none; }
details.ev > summary .chev { transition: transform var(--dur-base) var(--ease-out); color: var(--text-3); }
details.ev[open] > summary .chev { transform: rotate(90deg); }
details.ev > .ev-body { padding: 0 var(--space-3) var(--space-3); }
pre.code { margin: 0; padding: var(--space-3); background: var(--bg-raised); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); font: var(--text-xs)/1.55 var(--font-mono); overflow: auto; max-height: 360px; white-space: pre; tab-size: 2; }
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; top: var(--space-2); right: var(--space-2); }
.copy { all: unset; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--radius-xs); color: var(--text-3); }
.copy:hover { background: var(--surface-2); color: var(--text); }
.copy:focus-visible { outline: 2px solid var(--focus); }

/* ---- receipt ---------------------------------------------------------------- */
.receipt { border: var(--border-width) solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.receipt-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-raised); border-bottom: var(--border-width) dashed var(--border-strong); }
.receipt-body { padding: var(--space-4); }
.seal { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-semibold); }

/* ---- review ---------------------------------------------------------------- */
.decision { border: var(--border-width) solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; margin-bottom: var(--space-4); }
.decision-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: var(--border-width) solid var(--border); background: var(--bg-raised); flex-wrap: wrap; }
.decision-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-5); padding: var(--space-4); }
.decision-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: var(--border-width) solid var(--border); flex-wrap: wrap; }
ul.reasons { margin: var(--space-1) 0 0; padding-left: 18px; font-size: var(--text-sm); }
ul.reasons li { margin: 2px 0; }
.binding { font-size: var(--text-xs); color: var(--text-3); }

/* ---- policies ---------------------------------------------------------------- */
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); }
.rule { border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3) var(--space-4); }
.rule .when, .rule .then { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--space-2); font-size: var(--text-sm); padding: 3px 0; }
.rule .kw { font-size: var(--text-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-caps); color: var(--text-3); padding-top: 3px; }

/* ---- overlays ---------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-modal); opacity: 0; transition: opacity var(--dur-base); }
.scrim.show { opacity: 1; }
.modal { position: fixed; z-index: calc(var(--z-modal) + 1); left: 50%; top: 12vh; transform: translate(-50%, 8px); opacity: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base); max-height: 80vh; display: flex; flex-direction: column; }
.modal.show { transform: translate(-50%, 0); opacity: 1; }
.modal-head { padding: var(--space-4) var(--space-4) var(--space-2); }
.modal-head h2 { margin: 0; font-size: var(--text-lg); }
.modal-body { padding: var(--space-2) var(--space-4) var(--space-4); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: var(--border-width) solid var(--border); }
.drawer { position: fixed; z-index: var(--z-drawer); top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: var(--border-width) solid var(--border); box-shadow: var(--shadow-3);
  transform: translateX(100%); transition: transform var(--dur-slow) var(--ease-out); display: flex; flex-direction: column; }
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: var(--border-width) solid var(--border); }
.drawer-body { padding: var(--space-4); overflow-y: auto; }

.palette { position: fixed; z-index: var(--z-palette); left: 50%; top: 14vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: var(--border-width) solid var(--border); background: transparent; height: 48px; padding: 0 var(--space-4); font-size: var(--text-lg); outline: none; }
.palette-list { max-height: 380px; overflow-y: auto; padding: var(--space-1); }
.palette-group { padding: var(--space-2) var(--space-3) var(--space-1); }
.palette-item { display: flex; align-items: center; gap: var(--space-3); padding: 8px var(--space-3); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); }
.palette-item[aria-selected="true"] { background: var(--accent-weak); }
.palette-item .hint { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); }
.palette-foot { display: flex; gap: var(--space-4); padding: var(--space-2) var(--space-3); border-top: var(--border-width) solid var(--border); font-size: var(--text-xs); color: var(--text-3); }

.toasts { position: fixed; z-index: var(--z-toast); bottom: var(--space-5); right: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.toast { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--text); color: var(--text-inverse); border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-2); animation: toast-in var(--dur-slow) var(--ease-out); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }

.state-msg { padding: var(--space-10) var(--space-4); text-align: center; color: var(--text-3); font-size: var(--text-sm); }
.state-msg h3 { color: var(--text); font-size: var(--text-md); margin: var(--space-2) 0 var(--space-1); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--radius-sm); height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.note { font-size: var(--text-xs); color: var(--text-3); }
.callout { display: flex; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--text-sm); color: var(--text-2); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--surface-2); font-size: var(--text-2xs); color: var(--text-2); font-weight: var(--weight-medium); }
.login { max-width: 400px; margin: 14vh auto; }
.segmented { display: inline-flex; border: var(--border-width) solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); height: 28px; padding: 0 var(--space-3); font-size: var(--text-xs); cursor: pointer; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); font-weight: var(--weight-medium); }
.tabs { display: flex; gap: var(--space-1); border-bottom: var(--border-width) solid var(--border); margin-bottom: var(--space-4); overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: var(--weight-medium); }
.tabs button:focus-visible { outline: 2px solid var(--focus); }

/* ---- responsive ---------------------------------------------------------------- */
@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric:nth-child(4n) { border-right: 0; }
  .metric:nth-child(-n+4) { border-bottom: var(--border-width) solid var(--border); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .topbar { grid-column: 1; padding: 0 var(--space-3); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); box-shadow: var(--shadow-3); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.collapsed .brand-name, .shell.collapsed .nav-label, .shell.collapsed .nav-group-title, .shell.collapsed .nav-count, .shell.collapsed .env-card { display: revert; }
  .shell.collapsed .nav a { justify-content: flex-start; padding: 0 var(--space-2); }
  .resizer, .collapse-btn { display: none; }
  .search-trigger { min-width: 0; flex: 0 0 auto; width: 36px; padding: 0; justify-content: center; }
  .search-trigger .label, .search-trigger kbd { display: none; }
  .crumbs { overflow: hidden; white-space: nowrap; }
  .crumbs > :not(:last-child) { display: none; }
  .crumbs > :last-child { overflow: hidden; text-overflow: ellipsis; }
  .page { padding: var(--space-4) var(--space-3) var(--space-12); }
  .context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-grid > div:nth-child(2) { border-right: 0; }
  .context-grid > div:nth-child(-n+2) { border-bottom: var(--border-width) solid var(--border); }
  .grid-2, .grid-3, .decision-body { grid-template-columns: minmax(0, 1fr); }
  .attn { grid-template-columns: minmax(0, 1fr) auto; }
  .attn .attn-state { grid-column: 1 / -1; }
}
@media (min-width: 901px) { .menu-btn { display: none; } }
@media (max-width: 640px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-bottom: var(--border-width) solid var(--border); }
  .metric:nth-child(2n) { border-right: 0; }
  .table-wrap.responsive table { display: none; }
  .table-wrap.responsive .cards { display: block; }
  .mcard { display: block; padding: var(--space-3); border-bottom: var(--border-width) solid var(--border); color: inherit; text-decoration: none; }
  .mcard:last-child { border-bottom: 0; }
  .mcard .top { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; }
  .mcard .amt { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .compare .arrow { transform: rotate(90deg); height: 32px; }
  .tx-head { grid-template-columns: minmax(0, 1fr); }
  .tx-amount { font-size: var(--text-2xl); }
  .evt { grid-template-columns: 80px minmax(0, 1fr); }
  .evt > :nth-child(2) { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv > dd { margin-bottom: var(--space-2); }
  .filterbar .input.search { max-width: none; min-width: 100%; }
  .toasts { left: var(--space-3); right: var(--space-3); }
}
@media print { .sidebar, .topbar, .btn, .copy { display: none !important; } .shell { display: block; } .main { overflow: visible; } }

/* live refresh indicator (transaction detail while the engine is still working) */
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-3); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success-fg); }
@media (prefers-reduced-motion: no-preference) { .live-dot::before { animation: live-blink 1.6s ease-in-out infinite; } }
@keyframes live-blink { 50% { opacity: .25; } }

/* contextual loading line */
.loading-label { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-2); margin-bottom: 4px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--info-fg); }
@media (prefers-reduced-motion: no-preference) { .pulse-dot { animation: live-blink 1.2s ease-in-out infinite; } }

/* notifications */
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--danger-fg); color: var(--text-inverse); font-size: 10px; font-weight: var(--weight-semibold); line-height: 16px; text-align: center; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; gap: 10px; align-items: flex-start; padding: 10px 4px; border-bottom: var(--border-width) solid var(--border); color: var(--text); text-decoration: none; }
.notif:hover { background: var(--surface-2); }
.notif:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.notif b { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.notif .note { display: block; margin-top: 2px; }
.notif-ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--fg); background: var(--bg-s); border: 1px solid var(--line); }

/* structured search suggestions and active filter pills */
.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; font-size: var(--text-xs); color: var(--text-3); }
.suggest button { all: unset; cursor: pointer; font-family: var(--font-mono); font-size: 12px; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.suggest button:hover, .suggest button:focus-visible { border-color: var(--border-strong); color: var(--text); outline: none; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 9px; border-radius: var(--radius-pill); background: var(--accent-weak); color: var(--accent-text); font-size: 12px; }
.pill .k { font-family: var(--font-mono); opacity: .8; }
.pill button { all: unset; cursor: pointer; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; }
.pill button:hover, .pill button:focus-visible { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* charts */
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; font-size: var(--text-sm); }
.chart-plot { position: relative; border-bottom: var(--border-width) solid var(--border); }
.chart-plot svg { display: block; }
.chart-max { position: absolute; top: -2px; right: 0; font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart-x span { flex: 1; text-align: center; white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: var(--text-xs); color: var(--text-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-empty { height: 110px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: var(--radius-md); }
@media (max-width: 1200px) { .charts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 640px) { .charts { grid-template-columns: minmax(0, 1fr); } }

/* health line: the first answer on Overview */
.health { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--bg-s); color: var(--text); font-size: var(--text-sm); }
.health .ic { color: var(--fg); display: inline-flex; }
.health a { margin-left: auto; white-space: nowrap; }

/* integration catalog */
.int-list { list-style: none; margin: 0; padding: 0; }
.int-list li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: var(--border-width) solid var(--border); font-size: var(--text-sm); }
.int-list li:first-child { border-top: 0; }
.int-list li .note { display: block; }
.int-list li.muted { color: var(--text-3); }

/* ---- billing ------------------------------------------------------------------------------------- */
.choose { max-width: 1040px; margin: 6vh auto; padding: 0 var(--space-4); }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.plan-card h2 { font-size: var(--text-lg); margin: 0; }
.plan-card ul, .plan-limits { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 6px; align-content: start; font-size: var(--text-sm); color: var(--text-2); flex: 1; }
.plan-card li, .plan-limits li { display: flex; gap: 6px; align-items: flex-start; }
.plan-card li .icon, .plan-limits li .icon { color: var(--success-fg); flex: none; margin-top: 2px; }
.plan-card .btn { justify-content: center; }
.plan-card > .status { align-self: flex-start; }
.plan-badge { position: absolute; top: -10px; right: var(--space-4); font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 1px 8px; border-radius: var(--radius-pill); background: var(--accent); color: var(--text-inverse); }
.plan-price { margin: 4px 0 0; display: flex; align-items: baseline; gap: 4px; }
.plan-price b { font-size: 30px; letter-spacing: -0.02em; line-height: 1; }
.plan-price span { color: var(--text-3); font-size: var(--text-sm); }
.meter { height: 10px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; border: var(--border-width) solid var(--border); }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.near i { background: var(--warning-fg); }
.meter.over i { background: var(--danger-fg); }
@media (max-width: 860px) { .plan-grid { grid-template-columns: 1fr; } }
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--text-sm); }
.ob-steps li { display: flex; align-items: center; gap: 10px; }
.ob-steps li.done span:not(.ob-dot) { color: var(--text-3); text-decoration: line-through; }
.ob-steps li.next a { font-weight: var(--weight-semibold); }
.ob-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.ob-steps li.done .ob-dot { background: var(--success-fg); border-color: var(--success-fg); color: var(--text-inverse); }
.ob-steps li.next .ob-dot { border-color: var(--accent); }
