/* Abraj Admin. Layout: a fixed navy side rail with dense working panels. Colours come from design/tokens.json. */
@font-face { font-family: "Abraj Display"; src: url("../fonts/display-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Abraj Body"; src: url("../fonts/body-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Abraj Body"; src: url("../fonts/body-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #f5f2ec;
  --panel: #ffffff;
  --panel-alt: #fbf6ef;
  --ink: #1a1d45;
  --ink-2: #45436b;
  --muted: #57547c;
  --line: #1a1d4526;
  --line-strong: #1a1d4559;
  --rail: #10153a;
  --rail-ink: #cfcbe6;
  --rail-active: #181e4a;
  --accent: #8a6417;
  --accent-ink: #ffffff;
  --gold: #d2a35a;
  --primary: #10153a;
  --primary-ink: #fbf7f0;
  --focus: #1f5fd6;
  --ok: #1a7048;
  --ok-tint: #1a704821;
  --warn: #975400;
  --warn-tint: #e9b55233;
  --bad: #b3261e;
  --bad-tint: #b3261e14;
  --plum: #8a2f6b;
  --plum-tint: #8a2f6b1f;
  --info: #2f4fa8;
  --live-bg: #10153a;
  --live-ink: #f2ddb0;
  --past: #6f6c91;
  --code-bg: #f7ecea;
  --shadow: 0 8px 28px #03051a33;
  --body: "Abraj Body", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Abraj Display", "Abraj Body", system-ui, sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e2a;
    --panel: #171c47;
    --panel-alt: #10153a;
    --ink: #fbf7f0;
    --ink-2: #cfcbe6;
    --muted: #a6a2c8;
    --line: #ffffff24;
    --line-strong: #ffffff57;
    --rail: #10153a;
    --rail-ink: #cfcbe6;
    --rail-active: #221f52;
    --accent: #e4bf7c;
    --accent-ink: #10153a;
    --primary: #e4bf7c;
    --primary-ink: #10153a;
    --focus: #8ea7f2;
    --ok: #5fc193;
    --ok-tint: #5fc19326;
    --warn: #e9b552;
    --warn-tint: #e9b55226;
    --bad: #f08394;
    --bad-tint: #f0839420;
    --plum: #e9a3bf;
    --plum-tint: #e9a3bf26;
    --info: #8ea7f2;
    --live-bg: #e4bf7c;
    --live-ink: #10153a;
    --past: #a6a2c8;
    --code-bg: #10153a;
    --shadow: 0 8px 28px #03051ab3;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--body); }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 2px; }
strong, b { font-weight: 700; }
code, pre { font-family: var(--mono); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1:focus, h1:focus-visible, main:focus, main:focus-visible { outline: none; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.tone-ok { color: var(--ok); }
.tone-warn, .tone-warning { color: var(--warn); }
.tone-bad, .tone-critical { color: var(--bad); }
.tone-info { color: var(--info); }

/* Arabic */
.ar { font-family: var(--body); font-size: 18px; line-height: 2; text-align: start; unicode-bidi: isolate; letter-spacing: 0; word-spacing: 0.04em; }
.quoted-ar { font-size: 15px; line-height: 1.9; color: var(--ink-2); padding-inline-end: 8px; border-inline-end: 3px solid var(--line-strong); margin-block: 2px; }
.sign { display: inline-flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.sign-ar { color: var(--muted); font-size: 14.500px; line-height: 1.3; }
.sign-ar-large { font-size: 19px; line-height: 1.4; color: var(--ink-2); }

/* Frame */
.shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--panel); color: var(--ink); padding: 8px 12px; z-index: 10; border-radius: 6px; }
.skip:focus { top: 8px; }
.side { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 6px; padding: 4px 8px 8px; text-decoration: none; }
.brand-name { font: 700 21px/1.2 var(--display); color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--rail-ink); letter-spacing: 0.04em; }
.nav { display: grid; gap: 2px; }
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 4px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; }
.nav a { display: flex; align-items: center; justify-content: space-between; color: var(--rail-ink); text-decoration: none; padding: 8px 10px; border-radius: 6px; border-inline-start: 3px solid transparent; }
.nav a:hover { background: var(--rail-active); color: #fbf7f0; }
.nav a[aria-current="page"] { background: var(--rail-active); color: #fbf7f0; font-weight: 700; border-inline-start-color: var(--gold); }
.side :focus-visible { outline-color: #f2ddb0; }
.nav-count { background: #f2ddb0; color: #10153a; font-size: 11.500px; font-weight: 700; padding: 0 6px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: grid; gap: 4px; padding: 8px; border-top: 1px solid #ffffff24; font-size: 12.500px; }
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { all: unset; color: #f2ddb0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; justify-self: start; }
.main { min-width: 0; padding: 26px 32px 56px; }
.page { display: grid; gap: 18px; max-width: 1240px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
h1 { font: 700 27px/1.3 var(--display); color: var(--ink); text-wrap: balance; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Panels and layout helpers */
.page, .panel, .stack, .stack-lg, .dialog form { grid-template-columns: minmax(0, 1fr); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.panel-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.sub-title { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.stack { display: grid; gap: 10px; min-width: 0; }
.stack-lg { display: grid; gap: 18px; min-width: 0; align-content: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-inline { display: inline-flex; gap: 6px; align-items: center; }
.row-inline.wrap { flex-wrap: wrap; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.two-wide-first { grid-template-columns: minmax(0, 1fr) minmax(0, 1.300fr); }
.form-narrow { max-width: 380px; }
.empty { color: var(--muted); padding: 8px 0; }
.loading { color: var(--muted); padding: 8px 0; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; color: inherit; text-decoration: none; }
.tile-link:hover { border-color: var(--accent); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font: 700 21px/1.3 var(--display); font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 13px; color: var(--ink-2); }
.count-row { display: flex; flex-wrap: wrap; gap: 8px; }
.count-link { text-decoration: none; color: inherit; border-radius: 999px; }
.count-link:hover .badge { border-color: var(--accent); }
.system-check { color: var(--muted); font-size: 13px; }
.system-check .mark { margin-inline-end: 6px; }
.system-check.tone-warn { color: var(--warn); }

/* Dashboard */
.next-step { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; background: var(--rail); color: #fbf7f0; border-radius: 12px; padding: 24px 26px; border-inline-start: 5px solid var(--gold); }
.next-words { display: grid; gap: 4px; flex: 1 1 320px; min-width: 0; }
.next-kicker { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.next-title { font: 700 23px/1.35 var(--display); color: #fbf7f0; }
.next-body { color: #dcd8ef; }
.next-step .btn-primary { background: var(--gold); border-color: var(--gold); color: #10153a; }
.next-urgent { border-inline-start-color: #ef9aa9; }
.btn-large { min-height: 44px; padding: 8px 20px; font-size: 15px; }
.plan { display: grid; gap: 2px; }
.plan-row { display: grid; grid-template-columns: 18px minmax(112px, 150px) minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.plan-row .mark { align-self: center; }
.plan-row:hover { background: var(--panel-alt); }
.plan-when { font-weight: 700; }
.plan-ready .plan-what { color: var(--muted); }
.quiet-line { color: var(--muted); font-size: 14px; }
.more { display: block; }
.more > summary { cursor: pointer; }
.more-body { padding-top: 14px; }
.more-inline > summary { cursor: pointer; color: var(--accent); }
.facts { display: grid; gap: 8px; margin: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.owner-note { color: var(--ink-2); background: var(--panel-alt); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; flex-basis: 100%; }

/* Calendar cards, on phones */
.only-phone { display: none; }
.period-cards { display: grid; gap: 8px; }
.period-card { display: block; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); color: inherit; text-decoration: none; }
.period-now { border-color: var(--accent); border-width: 2px; }
.period-card > summary, .period-link { display: grid; gap: 4px; padding: 11px 13px; min-height: 48px; cursor: pointer; }
.period-name { font-weight: 700; }
.period-counts { display: flex; flex-wrap: wrap; gap: 3px 12px; color: var(--ink-2); }
.period-signs { display: grid; border-top: 1px solid var(--line); }
.period-sign { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: space-between; padding: 9px 13px; min-height: 46px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.period-signs li:last-child .period-sign { border-bottom: 0; }

/* State marks. Each state differs in shape and in colour. */
.mark { width: 14px; height: 14px; flex: none; display: inline-block; vertical-align: -2px; }
.mark .fill { fill: currentColor; }
.mark .line { fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linejoin: round; stroke-linecap: round; }
.mark .dash { stroke-dasharray: 3 2.200; stroke-linecap: butt; }
.mark .cut { fill: none; stroke: var(--panel); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mark-approved { color: var(--ok); }
.mark-live { color: var(--accent); }
.mark-draft { color: var(--warn); }
.mark-rejected { color: var(--plum); }
.mark-missing { color: var(--bad); }
.mark-past { color: var(--past); }
.level-info { color: var(--info); }
.level-warning { color: var(--warn); }
.level-critical, .level-fail { color: var(--bad); }
.level-pass { color: var(--ok); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; line-height: 1.6; background: var(--panel); white-space: nowrap; }
.badge b { font-variant-numeric: tabular-nums; }
.badge-approved { border-color: var(--ok); }
.badge-live { background: var(--live-bg); color: var(--live-ink); border-color: var(--live-bg); }
.badge-live .mark { color: var(--live-ink); }
.badge-draft { border-color: var(--warn); border-style: dashed; }
.badge-rejected { border-color: var(--plum); }
.badge-missing { border-color: var(--bad); border-width: 2px; padding: 0 7px 0 5px; }
.tag { font-size: 11.500px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }

/* Cell treatments shared by the month grid, the matrix and the sign tiles */
.cell-approved { background: var(--ok-tint); }
.cell-live { background: var(--live-bg); color: var(--live-ink); }
.cell-live .mark { color: var(--live-ink); }
.cell-live .mark .cut { stroke: var(--live-bg); }
.cell-draft { outline: 1.500px dashed var(--warn); outline-offset: -2px; background: var(--warn-tint); }
.cell-rejected { background: repeating-linear-gradient(135deg, var(--plum-tint) 0 4px, transparent 4px 8px); outline: 1px solid var(--plum); outline-offset: -1px; }
.cell-missing { outline: 2px solid var(--bad); outline-offset: -2px; background: var(--bad-tint); }
.cell-past { color: var(--past); }
.cell-unknown { color: var(--muted); }

/* Calendar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--panel); justify-self: start; width: fit-content; }
.segmented a { padding: 4px 11px; color: var(--ink); text-decoration: none; font-size: 13px; border-inline-start: 1px solid var(--line); }
.segmented a:first-child { border-inline-start: 0; }
.segmented a:hover { background: var(--panel-alt); }
.segmented a[aria-current="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.segmented a:focus-visible { outline-offset: -3px; }
.cal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-title { font-size: 16px; font-weight: 700; min-width: 170px; text-align: center; font-variant-numeric: tabular-nums; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.day { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 62px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; }
a.day:hover { border-color: var(--accent); }
.day-blank { border: 0; }
.day-num { font-weight: 700; }
.day-today .day-num { background: var(--primary); color: var(--primary-ink); border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.day-warn { position: absolute; top: 5px; right: 7px; font-size: 11.500px; font-weight: 700; color: var(--warn); }
.day-src { position: absolute; bottom: 5px; right: 7px; font-size: 11.500px; font-weight: 700; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; line-height: 1.3; }
.cell-live .day-warn { color: inherit; }

.matrix-wrap { max-height: calc(100vh - 230px); min-height: 280px; }
.matrix { border-collapse: separate; border-spacing: 2px; font-size: 12.500px; font-variant-numeric: tabular-nums; width: 100%; }
.matrix th { font-weight: 400; color: var(--ink-2); text-align: center; padding: 2px 4px; background: var(--panel); }
.matrix thead th { position: sticky; top: 0; z-index: 2; }
.matrix tbody th { position: sticky; left: 0; text-align: left; z-index: 1; }
.matrix th a { color: inherit; }
.matrix .matrix-corner { text-align: left; color: var(--muted); left: 0; z-index: 3; }
.matrix td { padding: 0; text-align: center; min-width: 34px; border-radius: 4px; }
.matrix td a { display: flex; align-items: center; justify-content: center; gap: 3px; height: 24px; color: inherit; text-decoration: none; border-radius: 4px; }
.matrix-src { font-size: 10.500px; font-weight: 700; border: 1px solid currentColor; border-radius: 3px; padding: 0 2px; line-height: 1.2; }
.matrix td a:hover { outline: 1px solid var(--accent); }
.matrix td a:focus-visible { outline-offset: -2px; }
.matrix-count { font-size: 11.500px; font-weight: 700; }
.matrix-year td a { height: 30px; }
.row-today th { font-weight: 700; color: var(--ink); }
.row-today th a { background: var(--primary); color: var(--primary-ink); padding: 0 6px; border-radius: 999px; text-decoration: none; }
.sign-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sign-tile { display: grid; gap: 4px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; color: inherit; text-decoration: none; height: 100%; }
.sign-tile:hover { border-color: var(--accent); }
.sign-tile.cell-live .tile-sub, .sign-tile.cell-live .sign-ar { color: inherit; }

/* Coverage bars. Status colours, labelled in the key and in the table beside them. */
.track-cell { width: 42%; min-width: 180px; }
.track { display: block; width: 100%; height: 14px; }
.track-bg { fill: var(--line); }
.track-scheduled { fill: var(--warn); opacity: 0.45; }
.track-complete { fill: var(--ok); }
.track-gap { fill: var(--bad); }
.track-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.500px; color: var(--ink-2); padding-top: 8px; }
.track-key li { display: inline-flex; gap: 6px; align-items: center; }
.key { display: inline-block; width: 16px; height: 8px; border-radius: 2px; }
.key-complete { background: var(--ok); }
.key-scheduled { background: var(--warn); opacity: 0.45; }
.key-gap { background: var(--bad); width: 3px; height: 12px; }

/* Tables */
.table-wrap { overflow: auto; }
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th { text-align: left; font-weight: 700; font-size: 13px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover { background: var(--panel-alt); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.check-cell { width: 28px; }
.cell-ar { min-width: 280px; }
.cell-ar .ar { font-size: 16px; line-height: 1.85; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alert-list, .issue-list, .event-list { display: grid; gap: 6px; }
.alert-list li, .issue-list li { display: flex; gap: 7px; align-items: flex-start; }
.alert-list .mark, .issue-list .mark { margin-top: 2px; }
.alert-list .muted { margin-inline-start: auto; font-size: 12.500px; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 6px 0; }

/* Forms */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 12px; }
.field { display: grid; gap: 3px; min-width: 0; }
.field label { font-size: 13.500px; font-weight: 700; color: var(--ink-2); }
.field-inline { display: inline-flex; align-items: center; gap: 6px; }
.hint { font-size: 13px; color: var(--muted); }
.input { width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 10px; min-height: 38px; }
.input:hover { border-color: var(--ink-2); }
select.input { width: auto; max-width: 100%; }
.filters select.input { width: 100%; }
textarea.input { resize: vertical; display: block; }
.input-ar { font-size: 18px; line-height: 1.95; }
.input-mono, .input-code { font-family: var(--mono); letter-spacing: 0.08em; }
.check { display: flex; gap: 7px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; }
.count { display: block; text-align: right; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 14px; min-height: 38px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn { justify-self: start; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 700; }
.btn-danger { background: #c62f45; color: #ffffff; border-color: #c62f45; font-weight: 700; }
.btn-danger-quiet { color: var(--bad); border-color: var(--bad); }
.btn-small { min-height: 32px; padding: 3px 11px; font-size: 13.500px; }
.btn-wide { width: 100%; justify-self: stretch; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Notices */
.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-alt); }
.notice .mark { margin-top: 3px; }
.notice-body { display: grid; gap: 4px; min-width: 0; }
.notice-body .btn { justify-self: start; }
.notice-warning { border-color: var(--warn); background: var(--warn-tint); }
.notice-error { border-color: var(--bad); background: var(--bad-tint); }
.pending-label { display: flex; gap: 8px; align-items: flex-start; font-size: 12.500px; font-weight: 700; letter-spacing: 0.03em; color: var(--warn); border: 1.500px dashed var(--warn); border-radius: 8px; padding: 8px 12px; }
.pending-label .mark { margin-top: 3px; }
.pending-sub { display: block; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); }

/* Reading */
.reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 18px; align-items: start; }
.reading-texts { display: grid; gap: 14px; }
.reading-compare { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.reading-panel-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.reading-unapproved { border-color: var(--warn); }
.prose { display: grid; gap: 14px; }
.prose-block { display: grid; gap: 2px; }
.prose-block h3 { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.prose-ar-title { font-size: 14.500px; line-height: 1.4; color: var(--muted); }
.prose-short { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.reading-meta { border-top: 1px solid var(--line); padding-top: 6px; }
.event-list li { padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.event-list li:last-child { border-bottom: 0; }
.check-id { font-size: 11.500px; }
.raw-record { margin-top: 3px; }
.raw-record summary { cursor: pointer; width: fit-content; }
.raw-record .code { margin-top: 4px; }
.code { background: var(--code-bg); border-radius: 6px; padding: 8px 10px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.500px; line-height: 1.6; }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--rail); }
.auth-card { width: min(100%, 480px); background: var(--panel); border-radius: 12px; padding: 22px 24px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.auth-brand { display: flex; gap: 6px; align-items: baseline; }
.auth-brand .brand-name { color: var(--accent); }
.auth-brand .brand-sub { color: var(--muted); }
.auth-foot { font-size: 13px; }
.steps { display: grid; gap: 14px; counter-reset: step; }
.steps > li { counter-increment: step; display: grid; gap: 8px; padding-inline-start: 28px; position: relative; }
.steps > li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.qr-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.qr { width: 188px; height: 188px; flex: none; border-radius: 6px; }
.secret { font-family: var(--mono); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; user-select: all; background: var(--code-bg); padding: 6px 8px; border-radius: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; background: var(--code-bg); border-radius: 6px; padding: 10px 12px; counter-reset: code; }
.codes li { counter-increment: code; display: flex; gap: 8px; align-items: baseline; }
.codes li::before { content: counter(code) "."; color: var(--muted); font-size: 12px; min-width: 18px; text-align: right; }
.codes code { font-size: 14px; overflow-wrap: anywhere; }

/* Dialog and toasts */
.dialog { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); color: var(--ink); padding: 0; width: min(92vw, 460px); box-shadow: var(--shadow); }
.dialog::backdrop { background: #070a1fb3; }
.dialog form { display: grid; gap: 10px; padding: 16px 18px; }
.dialog-title { font-size: 16px; font-weight: 700; }
.dialog-body { display: grid; gap: 6px; color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(92vw, 380px); }
.toast { background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: 7px; border: 1px solid var(--gold); box-shadow: var(--shadow); }
.toast-error { background: #c62f45; color: #ffffff; }

/* Narrower working widths */
@media (max-width: 1180px) {
  .reading-layout { grid-template-columns: minmax(0, 1fr); }
  .two, .two-wide-first { grid-template-columns: minmax(0, 1fr); }
}

/* Phone: the rail becomes a top bar, the side-by-side panels stack, wide tables scroll inside their panel. */
@media (max-width: 760px) {
  .only-desktop { display: none; }
  .only-phone { display: block; }
  .next-step { padding: 18px; }
  .next-title { font-size: 20px; }
  .next-step .btn-large { width: 100%; }
  .plan-row { grid-template-columns: 18px minmax(0, 1fr); gap: 2px 8px; }
  .plan-what { grid-column: 2; }
  .panel { padding: 14px; }
  h1 { font-size: 23px; }
  .ar { font-size: 17px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 8px 12px; gap: 6px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .brand { padding: 0; }
  .nav { order: 3; width: 100%; display: flex; overflow-x: auto; gap: 2px; padding-bottom: 2px; }
  .nav-group, .nav-group + .nav-group { display: contents; margin: 0; }
  /* Wide tables with actions: on a phone each row reads top to bottom, so nothing needs scrolling sideways to reach. */
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table-stack td { border: 0; padding: 3px 0; white-space: normal; overflow-wrap: anywhere; text-align: start; }
  .table-stack td.num { text-align: start; }
  .table-stack td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
  .table-stack td[data-label=""]::before { display: none; }
  .nav-label { display: none; }
  .nav a { white-space: nowrap; gap: 6px; border-inline-start: 0; border-bottom: 2px solid transparent; border-radius: 4px; flex: none; min-height: 40px; }
  .nav a[aria-current="page"] { border-bottom-color: var(--gold); }
  .side-foot { margin: 0; border: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
  .who { max-width: 150px; }
  .main { padding: 16px 12px 40px; }
  .day { min-height: 50px; padding: 3px 4px; }
  .day-warn, .day-src { font-size: 10px; right: 3px; }
  .cal-title { order: -1; width: 100%; text-align: left; }
  .matrix-wrap { max-height: none; }
  .track-cell { min-width: 130px; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 16px; }
  .qr { width: 168px; height: 168px; }
  .btn, .input { min-height: 38px; }
}

@media (forced-colors: active) {
  .cell-approved, .cell-live, .cell-draft, .cell-rejected, .cell-missing { forced-color-adjust: auto; }
  .track-complete, .track-gap, .track-scheduled { fill: CanvasText; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .tile, .nav a { transition: border-color 120ms, background-color 120ms; }
}
