/* The staff console (job S6). Every brand on one console, so no brand's look: a quiet light ground for long reading
   at a desk or on an iPad, one blue for actions and links. Colour jobs: blue = an action or a link; amber = a
   refusal or something to check; the grey notice tint = something about the person (signed out, locked), never red.
   Content policy: own origin only, so the system font. Touch floor 44px on every control (iPad is first class). */
:root {
  --bg: #F6F7F9; --card: #FFFFFF; --line: #DADDE3; --line2: #C4C8D0;
  --text: #1B1E24; --muted: #5A606B; --blue: #1F5FD1; --blue-t: #E7EEFB; --ink: #FFFFFF;
  --amber: #8A5A00; --amber-t: #FFF4DC; --notice: #EEF0F3;
  --r: 12px; --touch: 44px;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }

.top { display: flex; justify-content: flex-end; align-items: center; min-height: 60px; gap: 12px;
  padding: 8px max(16px, calc((100% - 1200px) / 2)); padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--card); }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; padding: 24px 0 64px; }
h1 { font-size: clamp(24px, 3.4vw, 32px); line-height: 1.2; font-weight: 750; letter-spacing: -.01em; margin-bottom: 12px; overflow-wrap: anywhere; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 17px; font-weight: 700; margin: 18px 0 6px; }
p + p { margin-top: 10px; }
.muted { color: var(--muted); }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 10px 20px;
  border-radius: 10px; background: var(--blue); color: var(--ink); font: 650 16px/1.2 var(--body); text-decoration: none; border: 0; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: var(--card); color: var(--blue); border: 1.5px solid var(--line2); }
.btn-sm { padding: 8px 14px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; align-items: center; }
.stack { display: grid; gap: 14px; max-width: 420px; margin-top: 18px; }
.field { display: grid; gap: 6px; }
.label { font-weight: 600; }
input { font: 18px/1.3 var(--body); min-height: var(--touch); padding: 10px 12px; border: 1.5px solid var(--line2); border-radius: 10px; background: var(--card); color: var(--text); width: 100%; }
input[name=code] { font-family: var(--mono); letter-spacing: .2em; max-width: 12ch; }
.error { color: var(--amber); background: var(--amber-t); border-left: 4px solid var(--amber); border-radius: 8px; padding: 10px 14px; font-weight: 600; }
.notice { background: var(--notice); border-left: 4px solid var(--muted); border-radius: 8px; padding: 12px 16px; margin: 14px 0; }

/* sign-in: the code to scan, the secret to type, the owner's 8 digits */
.setup { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin: 18px 0; }
.qr { background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); }
.qr svg { display: block; width: 224px; height: 224px; }
.qr figcaption { font-size: 14px; color: var(--muted); max-width: 224px; margin-top: 6px; }
.secret, .fingerprint { font-family: var(--mono); font-size: 22px; letter-spacing: .08em; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; user-select: all; }
.fingerprint { font-size: 34px; font-weight: 700; gap: 20px; }

/* the queue */
.group { margin: 26px 0; }
.rows { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rows th { text-align: left; font-size: 13px; font-weight: 650; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rows td { padding: 6px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.rows tbody tr:first-child td { border-top: 0; }
.person a { display: flex; align-items: center; min-height: var(--touch); font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.person .email, .who { display: block; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.rows td:not(.person) { padding-top: 16px; }
.rows time { white-space: nowrap; }
/* Narrower than a desk (portrait iPad mini, split view): each row becomes a card, every field still on it. */
@media (max-width: 760px) {
  .rows thead { display: none; }
  .rows, .rows tbody, .rows tr, .rows td { display: block; width: 100%; }
  .rows tr { padding: 8px 0; border-top: 1px solid var(--line); }
  .rows tbody tr:first-child { border-top: 0; }
  .rows td, .rows td:not(.person) { border: 0; padding: 2px 14px; }
}

/* one application */
.back a { display: inline-flex; align-items: center; min-height: var(--touch); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--notice); font-size: 14px; font-weight: 600; }
.chip[data-state] { background: var(--blue-t); color: #123E8C; }
.part { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin: 16px 0; }
.kvs { display: grid; gap: 8px; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px; } }
.record { font: 13px/1.45 var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.hash { font: 13px var(--mono); overflow-wrap: anywhere; }
.signing { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.signing:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section { border-top: 1px solid var(--line); margin-top: 14px; }
.form-section:first-of-type { border-top: 0; margin-top: 0; }
.section-note { color: var(--muted); font-size: 14px; }
.q { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.q[data-missing] { border-left: 4px solid var(--amber); padding-left: 10px; background: var(--amber-t); }
.q-num { font-weight: 700; margin-right: 4px; }
.q-label { color: var(--muted); font-size: 14px; }
.q-answer { font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; }
.grid { border-collapse: collapse; margin-top: 4px; font-weight: 400; }
.grid th, .grid td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.history td { font-size: 14px; }
.notes { list-style: none; display: grid; gap: 10px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* what staff can do (job S7). One panel per open action, above the record: its line before, its button, and only then
   its box (an action with words) and its one confirm (an action that emails a customer or can't be taken back). A
   refusal sits under the button it answers, amber; what the server took is said once at the top, in the notice tint. */
.acts { display: grid; gap: 0; padding-top: 6px; padding-bottom: 6px; }
.act { padding: 14px 0; border-top: 1px solid var(--line); }
.act:first-child { border-top: 0; }
.act .actions { margin-top: 10px; }
.act .field { margin-top: 10px; max-width: 720px; }
.act .error, .edit .error { margin-top: 10px; }
.confirm { margin-top: 10px; padding: 12px 14px; border: 1.5px solid var(--blue); border-radius: 10px; background: var(--blue-t); max-width: 720px; }
.confirm p { font-weight: 650; }
.confirm .actions { margin-top: 10px; }
textarea { font: 17px/1.4 var(--body); min-height: 96px; padding: 10px 12px; border: 1.5px solid var(--line2); border-radius: 10px; background: var(--card); color: var(--text); width: 100%; resize: vertical; }
.chip-flag, .flag { background: var(--amber-t); color: var(--amber); }
.flag { display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 650; font-size: 14px; margin-bottom: 8px; }
.q-missing { color: var(--amber); font-size: 14px; font-weight: 600; margin-top: 4px; }
.qa { border-top: 1px solid var(--line); padding-top: 10px; }
.qa:first-child { border-top: 0; padding-top: 0; }
.qa > .note-text { font-weight: 600; margin-bottom: 8px; }
/* the editor on each answer, while the server allows a save */
.edit { margin-top: 8px; display: grid; gap: 0; max-width: 720px; }
.edit .actions { margin-top: 8px; }
.yesno { display: flex; gap: 10px; flex-wrap: wrap; }
.choice[aria-checked="true"] { background: var(--blue); color: var(--ink); border-color: var(--blue); }
.table-edit { display: grid; gap: 10px; }
.rows-edit { display: grid; gap: 10px; }
.row-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.row-edit .cells { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.current { margin-top: 8px; padding: 8px 12px; border-left: 4px solid var(--amber); background: var(--card); font-weight: 600; overflow-wrap: anywhere; }
.btn[aria-disabled="true"] { opacity: .5; cursor: default; }
/* the two that can't be taken back (reopen, withdraw): last, under a heavier rule, apart from the routine ones */
.act:not(.act-final) + .act-final { border-top: 3px solid var(--line2); margin-top: 8px; }

/* Job S11: emails not sent (job K19). On the application: its own part above what staff can do, under the amber rule of
   something to check, one entry per email. On the queue: an amber flag under the person, the same family as the
   reopened flag. The N/A line under an answer is a quiet note, not a warning. */
.part-check { border-left: 4px solid var(--amber); }
.mails { list-style: none; display: grid; gap: 0; margin-top: 12px; }
.mail { border-top: 1px solid var(--line); padding: 12px 0; }
.mail:last-child { padding-bottom: 0; }
.mail-kind { font-weight: 700; margin-bottom: 8px; overflow-wrap: anywhere; }
.mail-next { margin-top: 8px; font-weight: 600; }
.mail[data-mail-final="true"] .mail-next { color: var(--amber); }
.mail-flag { margin: 2px 0 6px; }
/* job S19: a hold for the team. On the queue row, an amber flag under the state, the reopened flag's family. On the
   application's page, its part (amber rule) above what staff can do; each answer given to the question on a line. */
.hold-flag { display: block; width: fit-content; margin: 6px 0 0; }
.hold-answers { margin: 10px 0 0; padding-left: 22px; }
.hold-answers li { margin: 4px 0; }
.q-stated { color: var(--muted); font-size: 14px; margin-top: 4px; }
