/* ==========================================================================
   PillarProof — institutional risk platform design language.
   Deliberate typography, hairline structure, dense legible data.
   Not a card grid. Not a SaaS template.
   ========================================================================== */

:root {
  /* Ground: deep neutral with a trace of warmth, never pure black. */
  --ground:        #0a0b0d;
  --surface:       #101216;
  --surface-2:     #14171c;
  --surface-3:     #181c22;
  --raised:        #1c2027;

  /* Hairlines carry the structure instead of shadows and rounded cards. */
  --rule:          #22262e;
  --rule-strong:   #2e343e;
  --rule-faint:    #191d23;

  /* Bone-white through to quiet grey. */
  --ink:           #e9e5dd;
  --ink-2:         #b3b7bf;
  --ink-3:         #7d848f;
  --ink-4:         #5a616b;

  /* Brass — used sparingly, for the institution's own voice. */
  --brass:         #b08d3f;
  --brass-bright:  #d4ae5a;
  --brass-dim:     #6d5726;

  /* Protocol status vocabulary. Muted, serious, never candy. */
  --st-pass:       #4e8060;
  --st-info:       #5e7f9e;
  --st-review:     #b08d3f;
  --st-warning:    #c17f36;
  --st-critical:   #b04242;
  --st-na:         #4e545e;
  --st-insuff:     #7f6f96;

  --danger:        #b04242;
  --ok:            #4e8060;

  --font-display: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --rail: 236px;
  --pad: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(176, 141, 63, 0.28); }

/* Scrollbars: thin, quiet, part of the instrument. */
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--rule-strong); border: 3px solid var(--ground); border-radius: 6px; }
*::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------------------
   Type primitives
   -------------------------------------------------------------------------- */

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.011em; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: -0.011em; }
h1 { font-size: 25px; line-height: 1.22; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-4);
}
.mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.prose { font-family: var(--font-display); font-size: 14.5px; line-height: 1.62; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   Frame: fixed rail + scrolling work surface
   -------------------------------------------------------------------------- */

.frame { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--rule-faint); }
.brand-mark { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-family: var(--font-display); font-size: 17px; letter-spacing: -0.02em; color: var(--ink); }
.brand-pillars {
  margin-top: 7px; display: flex; gap: 9px;
  font-size: 9px; font-weight: 600; letter-spacing: 0.16em; color: var(--ink-4);
}
.brand-pillars span { position: relative; }
.brand-pillars span + span::before {
  content: ''; position: absolute; left: -6px; top: 4px; width: 1px; height: 7px; background: var(--rule-strong);
}

.org-switch { padding: 12px 14px; border-bottom: 1px solid var(--rule-faint); }
.org-switch select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--rule);
  padding: 8px 9px; font-size: 12.5px; color: var(--ink); cursor: pointer;
  appearance: none; border-radius: 2px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-4) 50%), linear-gradient(135deg, var(--ink-4) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 11px) 14px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.org-switch select:focus { outline: none; border-color: var(--brass-dim); }
.org-role { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; }

.nav { flex: 1; overflow-y: auto; padding: 14px 0 24px; }
.nav-group { margin-bottom: 4px; }
.nav-group-label { padding: 12px 20px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px 7px 19px; cursor: pointer;
  border-left: 2px solid transparent;
  color: var(--ink-2); font-size: 13.5px;
  transition: color 120ms ease, background 120ms ease;
}
.nav-item:hover { color: var(--ink); background: var(--surface-2); }
.nav-item.active { color: var(--ink); border-left-color: var(--brass); background: var(--surface-2); }
.nav-item .count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--brass); }
.nav-item .count.alert { color: var(--st-warning); }

.rail-foot { padding: 14px 20px; border-top: 1px solid var(--rule-faint); }
.artifact-chip { display: block; }
.artifact-chip .pin {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  margin-top: 3px; display: block; word-break: break-all;
}
.state-flag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 9px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--st-review);
}
.state-flag::before { content: ''; width: 5px; height: 5px; background: var(--st-review); border-radius: 50%; }

/* --------------------------------------------------------------------------
   Work surface
   -------------------------------------------------------------------------- */

.surface { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--pad); height: 56px;
  background: rgba(10, 11, 13, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.crumbs { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; }
.crumbs a { color: var(--ink-3); white-space: nowrap; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }
.crumbs .here { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.page { padding: 30px var(--pad) 80px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { margin-top: 6px; }
.page-lead { margin-top: 9px; max-width: 74ch; }

/* --------------------------------------------------------------------------
   Sections — hairline rules, not cards
   -------------------------------------------------------------------------- */

.section { margin-bottom: 34px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 9px; margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.section-head h2, .section-head h3 { margin-right: auto; }
.section-note { font-size: 12px; color: var(--ink-4); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 2px; }
.panel-head {
  padding: 13px 16px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 12px;
}
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

/* --------------------------------------------------------------------------
   Measures — a serious figure row, not KPI cards
   -------------------------------------------------------------------------- */

.measures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  border: 1px solid var(--rule); border-radius: 2px; background: var(--surface);
}
.measure { padding: 15px 17px; border-right: 1px solid var(--rule-faint); min-width: 0; }
.measure:last-child { border-right: none; }
.measure .v {
  font-family: var(--font-mono); font-size: 23px; font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em; color: var(--ink); margin-top: 6px; display: block; line-height: 1.15;
}
.measure .v.sm { font-size: 15px; letter-spacing: -0.01em; }
.measure .sub { margin-top: 5px; font-size: 11.5px; color: var(--ink-4); }
.measure.accent .v { color: var(--brass-bright); }
.measure.alert .v { color: var(--st-warning); }
.measure.critical .v { color: var(--st-critical); }

/* --------------------------------------------------------------------------
   Status system — thin bars and small caps, never childish badges
   -------------------------------------------------------------------------- */

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.075em; text-transform: uppercase;
  white-space: nowrap;
}
.status::before { content: ''; width: 3px; height: 12px; background: var(--st-na); flex: none; }
.status.PASS { color: #86b598; } .status.PASS::before { background: var(--st-pass); }
.status.INFORMATIONAL { color: #9bb6cd; } .status.INFORMATIONAL::before { background: var(--st-info); }
.status.REVIEW { color: var(--brass-bright); } .status.REVIEW::before { background: var(--st-review); }
.status.WARNING { color: #e0a468; } .status.WARNING::before { background: var(--st-warning); }
.status.CRITICAL { color: #e08585; } .status.CRITICAL::before { background: var(--st-critical); }
.status.NOT_APPLICABLE { color: var(--ink-4); } .status.NOT_APPLICABLE::before { background: var(--st-na); }
.status.INSUFFICIENT_INFORMATION { color: #b4a3c9; } .status.INSUFFICIENT_INFORMATION::before { background: var(--st-insuff); }
.status.ASSESSED { color: #86b598; } .status.ASSESSED::before { background: var(--st-pass); }
.status.REJECTED { color: #e08585; } .status.REJECTED::before { background: var(--st-critical); }

.sev { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.sev.SEVERE, .sev.HIGH { color: #e08585; }
.sev.MODERATE { color: #e0a468; }
.sev.LOW { color: var(--ink-3); }
.sev.NONE { color: var(--ink-4); }

.material-mark {
  display: inline-block; width: 6px; height: 6px; background: var(--st-warning);
  transform: rotate(45deg);
}
.review-mark {
  display: inline-block; width: 7px; height: 7px; border: 1.5px solid var(--brass); border-radius: 50%;
}

.gap-state {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--rule-strong);
  color: var(--ink-3); border-radius: 1px;
}
.gap-state.CONFLICTING { color: #e08585; border-color: #5a3232; }
.gap-state.MISSING { color: #b4a3c9; border-color: #453a52; }
.gap-state.STALE { color: #e0a468; border-color: #5c4326; }
.gap-state.PARTIAL { color: #9bb6cd; border-color: #35485a; }
.gap-state.UNKNOWN { color: var(--ink-3); }
.gap-state.INSUFFICIENT { color: #b4a3c9; border-color: #453a52; }

.verify-flag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px;
  font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--st-insuff);
}
.verify-flag::before { content: ''; width: 5px; height: 5px; border: 1px solid currentColor; transform: rotate(45deg); }
.verify-flag.VERIFIED { color: var(--st-pass); }

/* --------------------------------------------------------------------------
   Tables — the primary instrument
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 2px; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-4); background: var(--surface-2);
  border-bottom: 1px solid var(--rule); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--ink-2); }
table.data thead th .dir { color: var(--brass); margin-left: 4px; }
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--rule-faint); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data tbody tr.open { background: var(--surface-2); }
table.data td.n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; text-align: right; white-space: nowrap; }
table.data td.id { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
table.data td.primary { color: var(--ink); }
table.data .row-note { margin-top: 3px; font-size: 11.5px; color: var(--ink-4); }

.detail-row td { background: var(--surface-2); border-bottom: 1px solid var(--rule) !important; padding: 0 !important; }
.detail-inner { padding: 18px 20px 20px; border-left: 2px solid var(--brass-dim); }

/* --------------------------------------------------------------------------
   Definition grids — provenance and metadata
   -------------------------------------------------------------------------- */

.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--rule-faint); border: 1px solid var(--rule-faint); }
.defs > div { background: var(--surface); padding: 11px 14px; min-width: 0; }
.defs dt { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); margin: 0; }
.defs dd { margin: 5px 0 0; font-size: 13px; color: var(--ink-2); word-break: break-word; }
.defs dd.mono { font-size: 11.5px; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--ink-4); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; padding-top: 2px; }
.kv dd { margin: 0; color: var(--ink-2); word-break: break-word; }

/* --------------------------------------------------------------------------
   Evidence list / trace
   -------------------------------------------------------------------------- */

.trace { border-left: 1px solid var(--rule-strong); padding-left: 16px; margin: 0; list-style: none; }
.trace li { position: relative; padding: 0 0 13px; font-size: 13px; color: var(--ink-2); }
.trace li::before {
  content: ''; position: absolute; left: -20px; top: 7px;
  width: 7px; height: 1px; background: var(--rule-strong);
}
.trace li:last-child { padding-bottom: 0; }
.trace.missing { border-left-color: #453a52; }
.trace.missing li::before { background: #453a52; }
.trace.missing li { color: #b4a3c9; }

/* --------------------------------------------------------------------------
   Timeline — risk over time
   -------------------------------------------------------------------------- */

.timeline { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.tl-step { flex: 1; min-width: 0; padding: 14px 16px; border-right: 1px solid var(--rule-faint); background: var(--surface); cursor: pointer; position: relative; transition: background 120ms ease; }
.tl-step:last-child { border-right: none; }
.tl-step:hover { background: var(--surface-2); }
.tl-step.active { background: var(--surface-2); }
.tl-step::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--st-na); }
.tl-step.PASS::after { background: var(--st-pass); }
.tl-step.REVIEW::after { background: var(--st-review); }
.tl-step.WARNING::after { background: var(--st-warning); }
.tl-step.CRITICAL::after { background: var(--st-critical); }
.tl-step.INSUFFICIENT_INFORMATION::after { background: var(--st-insuff); }
.tl-step.REJECTED::after { background: var(--st-critical); }
.tl-date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.tl-status { margin-top: 8px; }
.tl-meta { margin-top: 7px; font-size: 11.5px; color: var(--ink-4); }

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1px solid var(--rule-strong); background: var(--surface-2);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; border-radius: 2px;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--ink-4); color: var(--ink); background: var(--surface-3); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #14120c; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--brass-bright); border-color: var(--brass-bright); color: #14120c; }
.btn.danger { color: #e08585; border-color: #5a3232; }
.btn.danger:hover:not(:disabled) { background: rgba(176,66,66,0.12); border-color: var(--st-critical); color: #e08585; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); }

.field { margin-bottom: 15px; }
.field > label { display: block; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--rule-strong);
  padding: 8px 11px; font-size: 13px; color: var(--ink); border-radius: 2px;
}
.input:focus { outline: none; border-color: var(--brass-dim); background: var(--surface-3); }
textarea.input { min-height: 78px; resize: vertical; font-family: inherit; line-height: 1.5; }
select.input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-4) 50%), linear-gradient(135deg, var(--ink-4) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 12px) 15px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 32px; }
.field-help { margin-top: 6px; font-size: 11.5px; color: var(--ink-4); line-height: 1.45; }
.field-error { margin-top: 6px; font-size: 12px; color: #e08585; }

.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 2px; overflow: hidden; }
.seg button {
  padding: 6px 13px; background: var(--surface); border: none; border-right: 1px solid var(--rule-faint);
  color: var(--ink-3); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.seg button:last-child { border-right: none; }
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button.on { background: var(--surface-3); color: var(--ink); }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 180px; max-width: 340px;
  background: var(--surface-2); border: 1px solid var(--rule); padding: 7px 11px;
  font-size: 12.5px; border-radius: 2px;
}
.search:focus { outline: none; border-color: var(--brass-dim); }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; overflow-x: auto; }
.tab {
  padding: 10px 15px; font-size: 13px; color: var(--ink-3); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--brass); }
.tab .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.tab.on .n { color: var(--brass); }

/* --------------------------------------------------------------------------
   Notices — designed failure, conflict, stale and permission states
   -------------------------------------------------------------------------- */

.notice {
  border: 1px solid var(--rule-strong); border-left: 2px solid var(--ink-4);
  background: var(--surface); padding: 15px 17px; border-radius: 2px; margin-bottom: 18px;
}
.notice h3 { font-size: 14.5px; margin-bottom: 6px; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }
.notice p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.notice p + p { margin-top: 8px; }
.notice .notice-actions { margin-top: 13px; display: flex; gap: 9px; flex-wrap: wrap; }
.notice.critical { border-left-color: var(--st-critical); }
.notice.critical h3 { color: #e08585; }
.notice.warn { border-left-color: var(--st-warning); }
.notice.warn h3 { color: #e0a468; }
.notice.brass { border-left-color: var(--brass); }
.notice.brass h3 { color: var(--brass-bright); }
.notice.insuff { border-left-color: var(--st-insuff); }
.notice.insuff h3 { color: #b4a3c9; }
.notice code, .notice .mono { background: var(--surface-3); padding: 1px 5px; border-radius: 2px; }

.error-codes { margin-top: 12px; border-top: 1px solid var(--rule-faint); padding-top: 12px; }
.error-code-row { display: flex; gap: 12px; padding: 6px 0; font-size: 12.5px; align-items: baseline; }
.error-code-row .code {
  font-family: var(--font-mono); font-size: 11px; color: #e08585;
  border: 1px solid #4a2c2c; padding: 1px 6px; border-radius: 1px; white-space: nowrap; flex: none;
}
.error-code-row .msg { color: var(--ink-2); }
.error-code-row .path { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

/* Empty and loading states, deliberately designed. */
.empty { padding: 46px 30px; text-align: center; border: 1px dashed var(--rule-strong); border-radius: 2px; background: var(--surface); }
.empty h3 { color: var(--ink-2); margin-bottom: 8px; }
.empty p { margin: 0 auto; max-width: 44ch; font-size: 13px; color: var(--ink-4); line-height: 1.6; }
.empty .empty-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 2px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-line { height: 11px; margin-bottom: 9px; }
.sk-row { height: 38px; margin-bottom: 2px; }

.loading-note { display: flex; align-items: center; gap: 10px; color: var(--ink-4); font-size: 12.5px; padding: 14px 0; }
.spinner { width: 12px; height: 12px; border: 1.5px solid var(--rule-strong); border-top-color: var(--brass); border-radius: 50%; animation: spin 720ms linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Split workspace: register + inspector
   -------------------------------------------------------------------------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 22px; align-items: start; }
.inspector { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto; }
.inspector .panel + .panel { margin-top: 16px; }

.doc-pane { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 2px; padding: 18px 20px; }
.doc-pane .doc-title { font-family: var(--font-display); font-size: 15px; margin-bottom: 4px; }
.doc-pane .doc-meta { font-size: 11.5px; color: var(--ink-4); }
.doc-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule-faint); font-size: 13px; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; max-height: 300px; overflow-y: auto; }
.doc-placeholder { margin-top: 14px; padding: 22px; border: 1px dashed var(--rule-strong); text-align: center; font-size: 12px; color: var(--ink-4); }

/* Provenance chain */
.chain { list-style: none; margin: 0; padding: 0; }
.chain li { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--rule-faint); font-size: 12.5px; }
.chain li:last-child { border-bottom: none; }
.chain .stage { flex: none; width: 92px; color: var(--ink-4); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 2px; }
.chain .what { color: var(--ink-2); min-width: 0; }
.chain .when { margin-left: auto; flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

/* Digest display */
.digest { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule-faint); }
.digest:last-child { border-bottom: none; }
.digest .dl { flex: none; width: 96px; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.digest .dv { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); word-break: break-all; line-height: 1.45; }

details.tech { border: 1px solid var(--rule); border-radius: 2px; background: var(--surface); }
details.tech > summary {
  padding: 12px 16px; cursor: pointer; font-size: 12.5px; color: var(--ink-3);
  list-style: none; display: flex; align-items: center; gap: 9px;
}
details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before { content: '+'; font-family: var(--font-mono); color: var(--ink-4); }
details.tech[open] > summary::before { content: '−'; }
details.tech > summary:hover { color: var(--ink); }
details.tech .tech-body { padding: 0 16px 16px; border-top: 1px solid var(--rule-faint); padding-top: 14px; }

/* Bars for status distribution */
.dist { display: flex; height: 5px; border-radius: 1px; overflow: hidden; background: var(--surface-3); }
.dist span { display: block; height: 100%; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 11px; font-size: 11.5px; color: var(--ink-3); }
.dist-legend .li { display: flex; align-items: center; gap: 6px; }
.dist-legend .sw { width: 8px; height: 8px; flex: none; }

/* Toast */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--raised); border: 1px solid var(--rule-strong); border-left: 2px solid var(--brass);
  padding: 12px 16px; border-radius: 2px; font-size: 12.5px; max-width: 380px;
  animation: rise 200ms cubic-bezier(0.2, 0.7, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.toast.err { border-left-color: var(--st-critical); }
.toast.ok { border-left-color: var(--st-pass); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modal */
.scrim { position: fixed; inset: 0; background: rgba(6, 7, 9, 0.76); z-index: 150; display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow-y: auto; animation: fade 140ms ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 2px; animation: rise 180ms cubic-bezier(0.2,0.7,0.3,1); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--rule); display: flex; gap: 10px; justify-content: flex-end; }

/* Sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.gate-inner { width: 100%; max-width: 468px; }
.gate-mark { font-family: var(--font-display); font-size: 30px; letter-spacing: -0.025em; }
.gate-pillars { margin-top: 12px; display: flex; gap: 16px; font-size: 10px; font-weight: 600; letter-spacing: 0.2em; color: var(--ink-4); }
.gate-body { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--rule); }
.gate-foot { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--rule-faint); font-size: 11.5px; color: var(--ink-4); line-height: 1.6; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.stack-6 > * + * { margin-top: 6px; }
.stack-10 > * + * { margin-top: 10px; }
.stack-16 > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.nowrap { white-space: nowrap; }
.tr { text-align: right; }

/* --------------------------------------------------------------------------
   Mobile — designed for the field, not a shrunk desktop
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .inspector { position: static; max-height: none; }
}

@media (max-width: 860px) {
  :root { --pad: 16px; }
  .frame { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 100;
    transform: translateX(-100%); transition: transform 220ms cubic-bezier(0.2,0.7,0.3,1);
    box-shadow: 0 0 60px rgba(0,0,0,0.6);
  }
  body.rail-open .rail { transform: none; }
  body.rail-open::after { content: ''; position: fixed; inset: 0; background: rgba(6,7,9,0.66); z-index: 90; }
  .rail-toggle { display: inline-flex !important; }
  .topbar { height: 52px; }
  .page { padding: 20px var(--pad) 60px; }
  h1 { font-size: 21px; }

  /* Field-first: tables become records, not scrollbars. */
  table.data.stackable thead { display: none; }
  table.data.stackable tbody tr { display: block; border-bottom: 1px solid var(--rule); padding: 13px 14px; }
  table.data.stackable tbody tr.detail-row { padding: 0; }
  table.data.stackable tbody td { display: flex; gap: 12px; padding: 4px 0; border: none; align-items: baseline; }
  table.data.stackable tbody td::before {
    content: attr(data-l); flex: none; width: 104px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-4);
  }
  table.data.stackable tbody td.n { text-align: left; }
  .measures { grid-template-columns: repeat(2, 1fr); }
  .measure { border-bottom: 1px solid var(--rule-faint); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { padding-top: 10px; }
  .timeline { flex-direction: column; }
  .tl-step { border-right: none; border-bottom: 1px solid var(--rule-faint); }
  .modal { max-width: none; }
  .scrim { padding: 20px 12px; }
}

.rail-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
