/* RiftStack hub pages: tokens and shared styles (from docs/design/screens-4a/mock/mock.css). */
:root {
  --navy: #13355A;          /* RiftStack: actions and links (logo sheet) */
  --ink: #16202B;
  --ink-2: #4A5562;
  --line: #D5DAE1;
  --paper: #FFFFFF;
  --ground: #F4F5F7;
  --wait: #B45309;          /* waiting on a decision */
  --stop: #B42318;          /* stopped or refused */
  --done: #0F6B3F;          /* done */
  --org-accent: #13355A;    /* the header rule; a page sets the organization's accent on the header itself */
  --tier-1: 12px; --tier-2: 24px; --tier-3: 40px;
  --ui: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--ui); font-size: 17px; line-height: 1.5; }
a { color: var(--navy); text-underline-offset: 3px; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 600; margin: 0; }
p { margin: 0; }
.small { font-size: 13px; color: var(--ink-2); }

/* Header: the same on the hub and in every app. */
.rs-header { background: var(--paper); border-bottom: 3px solid var(--org-accent); }
.rs-header__in { max-width: 1040px; margin: 0 auto; padding: 0 var(--tier-2); height: 60px; display: flex; align-items: center; gap: var(--tier-2); }
.rs-org { display: flex; align-items: center; gap: var(--tier-1); text-decoration: none; color: var(--ink); font-weight: 600; }
.rs-logo { display: block; height: 32px; width: auto; max-width: 240px; object-fit: contain; }
.rs-name { font-weight: 600; }
.rs-app { font-weight: 600; padding-left: var(--tier-2); border-left: 1px solid var(--line); }
.rs-nav { margin-left: auto; display: flex; align-items: center; gap: var(--tier-2); font-size: 13px; }
.rs-nav .who { color: var(--ink-2); }
.rs-nav button { font: inherit; color: var(--navy); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: var(--tier-3) var(--tier-2); display: flex; flex-direction: column; gap: var(--tier-3); }
section { display: flex; flex-direction: column; gap: var(--tier-2); }

.btn { font: inherit; font-weight: 600; min-height: 44px; padding: 0 20px; border-radius: 6px; border: 1px solid var(--navy); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn--main { background: var(--navy); color: #fff; }
.btn--plain { background: var(--paper); color: var(--navy); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible { outline: 3px solid #5B8DC9; outline-offset: 2px; }

/* The one thing waiting. */
.waiting { background: var(--paper); border-left: 4px solid var(--wait); padding: var(--tier-2); display: flex; align-items: center; gap: var(--tier-2); }
.waiting__text { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.waiting__lead { font-size: 22px; line-height: 1.3; font-weight: 600; }

/* Apps: a list, not tiles. */
.apps { list-style: none; margin: 0; padding: 0; background: var(--paper); }
.apps li { display: flex; align-items: center; gap: var(--tier-2); padding: var(--tier-2); border-top: 1px solid var(--line); }
.apps li:first-child { border-top: 0; }
.apps .what { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.apps .name { font-size: 22px; line-height: 1.3; font-weight: 600; }
.stopped { color: var(--stop); font-weight: 600; }

/* Facts of one request. */
.facts { margin: 0; background: var(--paper); display: grid; grid-template-columns: 180px 1fr; }
.facts dt, .facts dd { margin: 0; padding: var(--tier-1) var(--tier-2); border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-2); }
.facts dt:first-of-type, .facts dd:first-of-type { border-top: 0; }
.facts strong { font-weight: 600; }
.actions { display: flex; gap: var(--tier-1); align-items: center; }

/* Sign-in. */
.door { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--tier-3); padding: var(--tier-3) var(--tier-2); }
.door__card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: var(--tier-2); }
.door__card .rs-logo { align-self: flex-start; height: 44px; max-width: 300px; }
.door__card .rs-name { font-size: 22px; line-height: 1.3; }
.door__card .btn { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input { font: inherit; min-height: 44px; padding: 0 12px; border: 1px solid #8A94A1; border-radius: 6px; background: var(--paper); color: var(--ink); }
.or { border-top: 1px solid var(--line); padding-top: var(--tier-2); display: flex; flex-direction: column; gap: var(--tier-1); }
.by { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.by img { width: 16px; height: 16px; }
.lockup { display: block; align-self: flex-start; height: 44px; width: auto; }
footer.by { max-width: 760px; margin: 0 auto; padding: 0 var(--tier-2) var(--tier-3); }

/* Confirm it's you, and sign-in methods. */
.textbtn { font: inherit; font-size: 13px; color: var(--navy); background: none; border: 0; padding: 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.door__card .textbtn { align-self: flex-start; font-size: 17px; }
.field .code { font-size: 22px; letter-spacing: 0.2em; font-variant-numeric: tabular-nums; max-width: 220px; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--paper); }
.rows li { display: flex; align-items: center; gap: var(--tier-2); padding: var(--tier-1) var(--tier-2); border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .what { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rows .name { font-weight: 600; }
.rows .do { display: flex; gap: var(--tier-2); }
.setup { background: var(--paper); padding: var(--tier-2); display: flex; gap: var(--tier-2); align-items: flex-start; }
.setup__steps { flex: 1; display: flex; flex-direction: column; gap: var(--tier-1); }
/* The hub's QR image on a white margin; the code's modules stay square. */
.qr { display: block; width: 168px; height: 168px; flex: none; background: var(--paper); border: 10px solid var(--paper); outline: 1px solid var(--line); image-rendering: pixelated; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px; overflow-wrap: anywhere; }
.inline { display: flex; gap: var(--tier-1); align-items: flex-end; flex-wrap: wrap; }
/* The launcher's one-line offer and its dismiss. */
.offer { display: flex; align-items: center; gap: var(--tier-1); flex-wrap: wrap; }

/* Long names and addresses wrap inside their box, even on a phone. */
h1, h2, .apps .what, .rows .what, .setup__steps, .waiting__text, .facts dd { min-width: 0; overflow-wrap: anywhere; }

/* Status lines: what just happened, in place. */
/* An empty line takes no room but stays in place, so what is written to it is announced. */
.message:empty { position: absolute; }
.message--stop { color: var(--stop); font-weight: 600; }
.message--done { color: var(--done); font-weight: 600; }

/* Requests: only what waits on the person carries the mark. */
.apps li.is-waiting { border-left: 4px solid var(--wait); }
.mark-waiting { color: var(--wait); font-weight: 600; font-size: 13px; }

@media (max-width: 600px) {
  .rs-nav .who { display: none; }
  .rs-app { display: none; }
  .waiting, .apps li { flex-direction: column; align-items: flex-start; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { border-top: 0; padding-top: 0; }
  h1 { font-size: 22px; }
  .rows li, .setup { flex-direction: column; align-items: flex-start; }
  .rows li { gap: 0; }
}

/* Admin screens (2026-11-19). Operator only. */
.manage .rs-header__in, .manage .admin-nav__in, .manage main, .manage footer.by { max-width: 1040px; }
.admin-nav { background: var(--paper); border-bottom: 1px solid var(--line); }
.admin-nav__in { max-width: 1040px; margin: 0 auto; padding: 0 var(--tier-2); min-height: 52px; display: flex; align-items: center; gap: var(--tier-2); flex-wrap: wrap; }
.admin-nav a { color: var(--ink); text-decoration: none; padding: 14px 0; border-bottom: 3px solid transparent; }
.admin-nav a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--navy); }
.admin-nav a.btn { padding: 0 14px; border: 1px solid var(--stop); color: var(--stop); }
.table .t { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.admin-nav .stopctl { margin-left: auto; display: flex; align-items: center; gap: var(--tier-1); }
.btn--stop { background: var(--paper); color: var(--stop); border-color: var(--stop); }
.btn--small { min-height: 36px; padding: 0 14px; }
.paused { color: var(--stop); font-weight: 600; }

.table { width: 100%; border-collapse: collapse; background: var(--paper); }
.table th, .table td { text-align: left; padding: var(--tier-1) var(--tier-2); border-top: 1px solid var(--line); vertical-align: top; }
.table thead th { border-top: 0; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.table .who { display: flex; flex-direction: column; }
.table a { font-weight: 600; }
.failed, .refused { color: var(--stop); font-weight: 600; }
.quiet { color: var(--ink-2); }
.scroll { overflow-x: auto; }

.filters { display: flex; gap: var(--tier-1); flex-wrap: wrap; align-items: flex-end; }
.field select, .field textarea { font: inherit; min-height: 44px; padding: 0 12px; border: 1px solid #8A94A1; border-radius: 6px; background: var(--paper); color: var(--ink); }
.field textarea { padding: 10px 12px; min-height: 88px; width: 100%; }
.field--wide { flex: 1; min-width: 220px; }
.form { background: var(--paper); padding: var(--tier-2); display: flex; flex-direction: column; gap: var(--tier-2); }
.form .rowf { display: flex; gap: var(--tier-1); flex-wrap: wrap; align-items: flex-end; }
.form textarea.key { min-height: 180px; }

/* A run's timeline. */
.steps { list-style: none; margin: 0; padding: 0; background: var(--paper); }
.steps li { display: grid; grid-template-columns: 120px 1fr auto; gap: 4px var(--tier-2); padding: var(--tier-1) var(--tier-2); border-top: 1px solid var(--line); border-left: 4px solid transparent; }
.steps li:first-child { border-top: 0; }
.steps .state { color: var(--ink-2); }
.steps .name { font-weight: 600; }
.steps .at { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.steps .why { grid-column: 2 / -1; }
.steps li.is-failed { border: 2px solid var(--stop); border-left-width: 4px; }
.steps li.is-failed .state { color: var(--stop); font-weight: 600; }
.steps li.is-notreached .name { font-weight: 400; color: var(--ink-2); }
details.said { grid-column: 2 / -1; }
details.said summary { color: var(--navy); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details.said pre { margin: 0; padding: var(--tier-1); background: var(--ground); white-space: pre-wrap; overflow-wrap: anywhere; }
details.said code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* Access grid. */
.grid select { font: inherit; min-height: 40px; padding: 0 8px; border: 1px solid #8A94A1; border-radius: 6px; background: var(--paper); color: var(--ink); }
.choices { list-style: none; margin: 0; padding: 0; background: var(--paper); }
.choices li { border-top: 1px solid var(--line); }
.choices li:first-child { border-top: 0; }
.choices label { display: grid; grid-template-columns: 28px 1fr; gap: 0 var(--tier-1); padding: var(--tier-1) var(--tier-2); cursor: pointer; min-height: 44px; }
.choices input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--navy); }
.choices .name { font-weight: 600; }
.choices .small { grid-column: 2; }
.note { background: var(--paper); border-left: 4px solid var(--line); padding: var(--tier-1) var(--tier-2); }

@media (max-width: 600px) {
  .steps li { grid-template-columns: 1fr auto; }
  .steps .state { grid-column: 1 / -1; }
  .steps .why, details.said { grid-column: 1 / -1; }
  .admin-nav .stopctl { margin-left: 0; width: 100%; padding-bottom: var(--tier-1); }
  .table th, .table td { padding: var(--tier-1); }
}

/* The attempts table on a phone: one block per attempt, how it ended kept in view. */
@media (max-width: 600px) {
  .runs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .runs tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "what amount" "end end" "who when" "client client"; gap: 2px var(--tier-1); padding: var(--tier-1) var(--tier-2); border-top: 1px solid var(--line); }
  .runs tbody tr:first-child { border-top: 0; }
  .runs td { border: 0; padding: 0; }
  .runs td:nth-child(1) { grid-area: when; text-align: right; }
  .runs td:nth-child(2) { grid-area: who; }
  .runs td:nth-child(3) { grid-area: what; }
  .runs td:nth-child(4) { grid-area: client; }
  .runs td:nth-child(5) { grid-area: amount; }
  .runs td:nth-child(6) { grid-area: end; }
  .runs td:nth-child(1), .runs td:nth-child(2), .runs td:nth-child(4) { font-size: 13px; color: var(--ink-2); }
}

/* The attempts table on a wider screen: Who stays on one line. */
@media (min-width: 601px) {
  .runs td:nth-child(2) { white-space: nowrap; }
}

/* Logos in a table stay small; a form row of fields can line up at the top. */
.table img { max-width: 120px; height: auto; max-height: 28px; }
.form .rowf--top { align-items: flex-start; }

/* Tables on a phone (`.stack`, every admin table but the attempts): one
   block per row, each value under its column's name, action cells last and
   full width. The access grid stacks the same way, one block per app. */
@media (max-width: 600px) {
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stack, .stack tbody, .stack tr, .stack td { display: block; width: 100%; }
  .stack tr { padding: var(--tier-1) 0; border-top: 1px solid var(--line); }
  .stack tbody tr:first-child { border-top: 0; }
  .stack td { border: 0; padding: 2px var(--tier-2); }
  .stack td::before { content: attr(data-label); display: block; font-size: 13px; color: var(--ink-2); }
  .stack td[data-label=""]::before { content: none; }
  .stack .num { text-align: left; }
  .stack td.act { padding-top: var(--tier-1); }
}
