/* Components — one system: buttons, cards, list rows, forms, tiles, grid, sheet, toasts, nav, footer.
   Colour roles: primary = structure and navigation, accent = the one call to action per screen,
   platform gold = what was earned (approved cells, khatma ring, rank 1, invite codes, the band hairline). */

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--primary-fill); color: var(--on-primary-fill);
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; }
.btn-accent { background: var(--accent-fill); color: var(--on-accent-fill); border-color: transparent; }
.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-ghost { background: transparent; color: var(--primary-ink); border-color: var(--line); }
.btn-danger { background: var(--err); color: #fff; }
.btn-link { display: inline-flex; align-items: center; gap: var(--sp-2); background: none; border: 0; color: var(--primary-ink); padding: 0; min-height: var(--tap); text-decoration: underline; text-underline-offset: 3px; }
.btn-link > svg { text-decoration: none; }
.btn-block { width: 100%; }
/* "small" is about weight and padding, never about the hit area — a thumb needs the same 44px here */
.btn-sm { min-height: var(--tap); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn-icon { width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; background: transparent; color: var(--primary-ink); border: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 32px; height: 32px; }
@media (hover: hover) {
  .btn:hover { background: var(--primary-dark); color: var(--on-primary-fill); }
  .btn-accent:hover { background: var(--accent-fill); color: var(--on-accent-fill); filter: brightness(0.94); }
  .btn-gold:hover { background: var(--gold-dark); color: #fff; }
  .btn-ghost:hover { background: var(--surface-2); color: var(--primary-dark); }
  .btn-danger:hover { background: #8E1E18; color: #fff; }
  .btn-icon:hover { background: var(--surface-2); color: inherit; }
}

/* pressed feedback (touch): scale instead of a translate so nothing shifts the layout */
.btn, .btn-icon, .cell, .grid-row, .event-chip, .date-chip, .tile, .day, .tab {
  transition: transform var(--dur-fast) var(--ease), background var(--dur), box-shadow var(--dur), opacity var(--dur), border-color var(--dur), color var(--dur);
}
.btn:active, .btn-icon:active { transform: scale(0.97); }
.btn-icon:active { background: var(--surface-2); }
a.list-item:active, button.list-item:active, .grid-row:active, .rank:active, a.tile:active { background: var(--surface-2); }

/* ── floating action button: the one primary "add" per screen ── */
.fab {
  position: fixed; inset-inline-end: var(--sp-4); bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-3)); z-index: 35;
  min-height: var(--fab-h); padding: 0 20px; border: 0; border-radius: var(--r-pill);
  background: var(--accent-fill); color: var(--on-accent-fill); box-shadow: var(--sh-2);
  display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 700; font-size: var(--fs-md);
  text-decoration: none; animation: fab-in 280ms var(--ease-out) both;
}
.fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.fab:active { transform: scale(0.96); }
@keyframes fab-in { from { opacity: 0; transform: translateY(12px) scale(0.9); } }
@media (min-width: 900px) { .fab { bottom: var(--sp-5); inset-inline-end: var(--sp-5); } }

/* ── cards & list rows ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); box-shadow: var(--sh-1); }
.card-title { font-family: var(--font-head); font-size: var(--fs-md); margin: 0 0 var(--sp-2); color: var(--primary-dark); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--tap); margin-bottom: var(--sp-2); }
.card-head .card-title { margin: 0; }
/* the link keeps its 44px hit area, but the upward pull is capped: at -10px the box reached up to
   within 7px of the button above it, and a 7px gap is not something a thumb can resolve */
/* The link fills the head instead of spilling out of it. A negative block margin gave it a 44px box
   that reached into the control above and the first row below — both within a thumb's slop. */
.card-head a { display: inline-flex; align-items: center; align-self: stretch; padding: 0 var(--sp-2); margin-inline: -8px; }
.list-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { min-width: 0; }
.list-item.is-inactive { opacity: 0.6; }
a.list-item { color: inherit; text-decoration: none; }
button.list-item { width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: inherit; }
.list-btn { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: start; color: inherit; font: inherit; }
.list-actions { display: flex; gap: var(--sp-3); }
.list-actions .btn { flex: 1; min-height: var(--tap); }
.list-item.is-leaving { animation: row-out 220ms var(--ease-in) forwards; overflow: hidden; }
@keyframes row-out { to { opacity: 0; transform: translateX(-16px); } }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { a.list-item:hover { background: var(--surface-2); } }

/* round monogram for a person */
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: var(--fs-md); background: var(--surface-2); color: var(--primary-dark); }
.avatar[data-tone="1"] { background: var(--info-bg); color: var(--info); }
.avatar[data-tone="2"] { background: var(--ok-bg); color: var(--ok); }
.avatar[data-tone="3"] { background: var(--warn-bg); color: var(--warn); }
.avatar[data-tone="4"] { background: var(--surface-3); color: var(--gold-ink); }

/* ── page-head band: the screen's own title, with tiles / ring overlapping its lower edge ── */
.page-head {
  position: relative; margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) 0;
  padding: var(--sp-3) var(--sp-4) var(--sp-5);
  background: linear-gradient(170deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--on-primary); border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.page-head::after { content: ""; position: absolute; inset-inline: var(--r-xl); bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.75; }
.page-head.is-overlap { padding-bottom: calc(var(--sp-5) + 36px); }
.page-head.is-overlap + .page-head-body { position: relative; z-index: 1; margin: -36px 0 var(--sp-3); }
.page-head-body.is-inside { margin-top: var(--sp-4); }
.page-head-row { display: flex; align-items: center; gap: var(--sp-2); }
.page-head h1 { color: inherit; font-size: 1.75rem; font-weight: 700; margin: 0; line-height: 1.3; }
.page-sub { margin: 2px 0 0; font-size: var(--fs-sm); color: color-mix(in srgb, var(--on-primary) 78%, transparent); }
@supports not (color: color-mix(in srgb, red 10%, white)) { .page-sub { opacity: 0.8; } }
.page-head .btn-icon, .page-back { color: inherit; margin-inline-start: calc(-1 * var(--sp-2)); }
.page-head .btn { background: var(--surface); color: var(--primary-dark); box-shadow: var(--sh-1); }
.page-head .btn-ghost { background: color-mix(in srgb, var(--on-primary) 14%, transparent); color: inherit; border-color: color-mix(in srgb, var(--on-primary) 30%, transparent); }
.page-head .badge-muted { background: color-mix(in srgb, var(--on-primary) 16%, transparent); color: inherit; }

.page-actions { flex-wrap: nowrap; flex: none; }
.page-head-row { flex-wrap: wrap; }
.page-head-row > .grow { min-width: 55%; }
.page-head.is-cover { text-align: center; padding-bottom: 64px; }
.page-head.is-cover .page-head-row { justify-content: center; }
.cover-logo { width: 112px; height: 112px; margin: -56px auto var(--sp-3); border-radius: 50%; object-fit: cover; background: var(--surface); border: 4px solid var(--surface); box-shadow: 0 0 0 3px var(--gold), 0 12px 32px -12px rgba(15, 61, 51, 0.55); position: relative; z-index: 1; display: block; }
.page-head.is-celebrate::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(60% 80% at 50% 0, color-mix(in srgb, var(--gold) 35%, transparent), transparent 70%); pointer-events: none; }
@media (min-width: 900px) { .page-head { margin-inline: 0; border-radius: var(--r-xl); } }

/* ── progress ring (M1 hero, S3) ── */
.ring-wrap { position: relative; display: grid; place-items: center; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.page-head .ring-track { stroke: color-mix(in srgb, var(--on-primary) 22%, transparent); }
.ring-fill { fill: none; stroke: var(--gold); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease-out); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: inherit; }
.ring-pct { font-family: var(--font-latin); font-size: 1.75rem; font-weight: 700; line-height: 1; direction: ltr; }
.ring-label { font-size: var(--fs-xs); opacity: 0.85; }
.ring-wrap.is-done .ring-fill { animation: ring-glow 1.4s var(--ease) 900ms 2; }
@keyframes ring-glow { 50% { filter: drop-shadow(0 0 6px var(--gold)); } }
.hero-row { display: flex; align-items: center; gap: var(--sp-4); }
.hero-stats { flex: 1; display: grid; gap: 6px; min-width: 0; }
.hero-stat { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); padding: 6px 12px; border-radius: 12px; background: color-mix(in srgb, var(--on-primary) 12%, transparent); font-size: var(--fs-sm); }
@supports not (color: color-mix(in srgb, red 10%, white)) { .hero-stat { background: rgba(255, 255, 255, 0.14); } }
.hero-stat b { font-family: var(--font-latin); font-size: 1.25rem; direction: ltr; }

/* ── forms ── */
.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--primary-dark); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); font-size: 16px;                              /* 16px prevents the iOS zoom */
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.field [aria-invalid="true"] { border-color: var(--err); }
.field-hint { font-size: var(--fs-xs); color: var(--muted); }
/* the chosen date, said back in the app's own words — see field() in ui/forms.js */
.field-echo { font-size: var(--fs-xs); color: var(--primary-dark); font-weight: 600; margin-top: var(--sp-1); }
.field-echo:empty { display: none; }
.field-error { font-size: var(--fs-xs); color: var(--err); min-height: 1.35em; line-height: 1.5; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(var(--sp-4) - 2px) 22px, calc(var(--sp-4) + 3px) 22px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-inline-start: var(--sp-6); }
.field input[type="date"], .field input[type="time"], .field input[type="datetime-local"] { font-family: var(--font-latin); direction: ltr; text-align: left; }
.check { display: flex; align-items: flex-start; gap: var(--sp-2); min-height: var(--tap); font-size: var(--fs-sm); }
.check input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.input-ltr { direction: ltr; text-align: left; font-family: var(--font-latin); }
/* Any control the user aims at gets the same floor, whether or not it sits inside a .field wrapper.
   A bare filter <select> and a native file input both render around 30px otherwise. */
select, input[type="file"] { min-height: var(--tap); font-size: 16px; }
select:not(.field select) {
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: inherit; max-width: 100%;
}
input[type="file"] {
  width: 100%; max-width: 100%; padding: 9px var(--sp-3);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); font-size: var(--fs-sm); color: var(--muted);
}
input[type="file"]::file-selector-button {
  min-height: 34px; margin-inline-end: var(--sp-3); padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--primary-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.file-input { min-height: 0; }              /* the visually-hidden pattern keeps its own 1px box */
.form-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-2); }
/* the password field is LTR inside an RTL page, so the affix uses physical sides */
.input-wrap { position: relative; display: flex; }
.input-wrap input { padding-right: 48px; }
.input-wrap .btn-icon { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.field .color-row input[type="color"] { width: 56px; min-width: 56px; height: 48px; flex: none; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.field .color-row input[type="text"] { flex: 1 1 auto; width: auto; }
.color-row { display: flex; align-items: center; gap: var(--sp-3); }
.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

/* ── switch (toggle) ── */
.switch-row { padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); cursor: pointer; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; transition: background var(--dur); }
.switch-track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform 200ms var(--ease-out), width var(--dur-fast); }
.switch:active .switch-track::after { width: 24px; }
.switch-input:checked + .switch-track { background: var(--primary); }
.switch-input:checked + .switch-track::after { transform: translateX(-18px); }
[dir="ltr"] .switch-input:checked + .switch-track::after { transform: translateX(18px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid var(--primary); outline-offset: 2px; }
.switch-input:disabled + .switch-track { opacity: 0.45; }
.switch-label { flex: 1; font-weight: 600; font-size: var(--fs-sm); }

/* ── code card (invite codes are platform artefacts → gold) ── */
.code-card { text-align: center; border: 2px dashed var(--gold); border-radius: var(--r-md); padding: var(--sp-4); background: var(--surface); }
.code-value { font-family: var(--font-latin); font-size: 1.9rem; letter-spacing: 0.25em; font-weight: 700; direction: ltr; color: var(--primary-dark); user-select: all; }
/* the address is read and copied, not admired: quieter than the invite code, and it must wrap on a phone */
.link-card { text-align: center; border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); background: var(--surface-2); margin-top: var(--sp-3); }
.link-value { font-family: var(--font-latin); font-size: var(--fs-sm); font-weight: 600; direction: ltr; color: var(--primary-dark); user-select: all; overflow-wrap: anywhere; margin: var(--sp-1) 0 var(--sp-2); }

/* ── stat tiles ── */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-1); color: inherit; text-decoration: none; }
.tile::before { content: ""; position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--primary); }
.tile-value { display: inline-block; direction: ltr; unicode-bidi: isolate; font-family: var(--font-latin); font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.tile-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); line-height: 1.4; }
.tile-sub { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.tile.is-gold::before { background: var(--gold); }
.tile.is-gold .tile-value { color: var(--gold-ink); }
.tile.is-accent::before { background: var(--accent-line); }
.tile.is-accent .tile-value { color: var(--accent-ink); }
a.tile .tile-chev { position: absolute; inset-inline-end: var(--sp-3); top: var(--sp-3); color: var(--line-strong); }
.tiles > .tile { animation: view-in 260ms var(--ease-out) both; }
.tiles > .tile:nth-child(2) { animation-delay: 50ms; }
.tiles > .tile:nth-child(3) { animation-delay: 100ms; }
.tiles > .tile:nth-child(4) { animation-delay: 150ms; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* ── notice (export reminder, hints) ── */
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid transparent; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, white); }
.notice-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, currentColor 14%, white); }
.notice .grow { min-width: 0; }

.project-card { display: flex; gap: var(--sp-3); align-items: flex-start; }

/* ── progress grid (SPEC 6.5) — the emotional centre of the app ── */
.grid-group { margin-bottom: var(--sp-4); scroll-margin-top: calc(var(--sticky-top) + 60px); }
.grid-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); margin: 0 0 var(--sp-2); color: var(--primary-dark); }
.grid-caption { font-family: var(--font-head); font-size: var(--fs-md); color: var(--primary-dark); margin: 0 0 var(--sp-2); }
.grid { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
/* Five across on a phone, six from a wide phone up. Six columns at 360px left the cells 44px wide with
   nothing but the gutter between them, and a run of approved units read as a single gold bar; dropping a
   column buys the gutter its width back without taking the cell below the 44px tap target. */
.grid-juz, .grid-hizb { grid-template-columns: repeat(5, 1fr); }
@media (min-width: 420px) { .grid-juz, .grid-hizb { grid-template-columns: repeat(6, 1fr); } }
.cell {
  position: relative; aspect-ratio: 1; min-height: var(--tap); padding: 0;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
  font-family: var(--font-latin); font-size: 1.0625rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 0 rgba(31, 42, 38, 0.06); -webkit-touch-callout: none;
}
.cell:not(:disabled):active { transform: scale(0.92); box-shadow: none; }
.cell:disabled { cursor: default; }
/* the glow stays under the cell instead of bleeding sideways: adjacent approved cells must read as
   separate units, and a spilling shadow filled the gap and welded them into one block */
.cell.is-approved { background: linear-gradient(160deg, var(--gold-light) 0%, var(--gold) 100%); border-color: var(--gold-dark); color: #3B2A08; box-shadow: 0 2px 4px -2px rgba(160, 120, 48, 0.5); }
.cell.is-reported { border: 2px solid var(--accent-line); background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent-ink); }
.cell.is-rejected { border: 2px solid var(--err); background: var(--err-bg); color: var(--err); }
.cell.is-cancelled { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.cell-mark { position: absolute; top: 3px; inset-inline-end: 3px; width: 11px; height: 11px; stroke-width: 3; }
.grid-page .cell, .grid-rub .cell { font-size: var(--fs-sm); border-radius: 10px; }
.cell.is-changed { animation: cell-pop 420ms var(--ease-spring); }
.cell.is-approved.is-changed { animation: cell-pop 420ms var(--ease-spring), cell-ring 600ms var(--ease) 80ms; }
@keyframes cell-pop { 0% { transform: scale(0.85); } 55% { transform: scale(1.12); } 100% { transform: none; } }
@keyframes cell-ring { from { box-shadow: 0 0 0 0 var(--gold); } to { box-shadow: 0 0 0 10px transparent; } }
@media (hover: hover) { .cell:not(:disabled):hover { border-color: var(--line-strong); } }
.grid-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.grid-row { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: start; width: 100%; }
.grid-row-n { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-family: var(--font-latin); font-weight: 700; color: var(--muted); }
.grid-row.is-approved .grid-row-n { background: var(--gold); color: #3B2A08; }
.grid-row.is-reported .grid-row-n { background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent-ink); }
.grid-group { content-visibility: auto; contain-intrinsic-size: auto 320px; }
.grid-row-name { flex: 1; font-weight: 600; }
.grid-row-state { font-size: var(--fs-xs); color: var(--muted); }
.grid-row.is-approved .grid-row-state { color: var(--gold-ink); font-weight: 700; }
.grid-row.is-reported .grid-row-state { color: var(--accent-ink); }
.grid-row.is-rejected .grid-row-state { color: var(--err); }
.grid-row.is-cancelled { color: var(--muted); text-decoration: line-through; }
.legend { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: var(--sp-4); font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-2) 0 var(--sp-3); scrollbar-width: none; }
.legend::-webkit-scrollbar { display: none; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend .cell { width: 18px; min-height: 18px; aspect-ratio: auto; border-radius: 6px; font-size: 0; box-shadow: none; }
.legend-item b { font-family: var(--font-latin); color: var(--ink); }
.juz-index { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--sp-3); }
.juz-index::-webkit-scrollbar { display: none; }
.juz-index a { flex: none; min-width: 40px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); border: 1px solid var(--line); font-family: var(--font-latin); font-weight: 700; font-size: var(--fs-sm); color: var(--primary-ink); text-decoration: none; }

/* unit sheet (S3/M1 cell) */
.unit-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-bottom: 12px; flex-wrap: wrap; }

/* ── badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--ink); line-height: 1.6; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-gold { background: color-mix(in srgb, var(--gold) 22%, white); color: var(--gold-ink); }
.badge-accent { background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent-ink); }
@supports not (color: color-mix(in srgb, red 10%, white)) {
  .badge-gold { background: var(--surface-3); color: var(--gold-ink); }
  .badge-accent { background: var(--surface-2); color: var(--accent-ink); }
}
.tag-student { color: var(--c-student); }
.tag-group { color: var(--c-group); }
.tag-date { color: var(--c-date); }
.tag-system { color: var(--c-system); }

/* ── banners (read-only, quota, offline) ── */
.banner-slot { position: sticky; top: 0; z-index: 25; }
.banner { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); font-weight: 600; }
.banner-warn { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, white); }
.banner-err { background: var(--err-bg); color: var(--err); border-bottom: 1px solid color-mix(in srgb, var(--err) 25%, white); }
.banner-info { background: var(--info-bg); color: var(--info); border-bottom: 1px solid color-mix(in srgb, var(--info) 25%, white); }

/* ── toasts (aria-live) ── */
.toast-region { position: fixed; inset-inline: 0; bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-3)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4); pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--ink); color: #fff; box-shadow: var(--sh-2); font-size: var(--fs-sm); animation: toast-in 260ms var(--ease-out); }
.toast-ok { background: var(--ok); }
.toast-err { background: var(--err); }
.toast-warn { background: var(--warn); }
.toast .btn-link { color: #fff; min-height: 32px; }
.toast .btn-icon { width: 44px; height: 44px; margin: -8px -8px -8px 0; color: inherit; }
.toast.is-out { animation: toast-out 200ms var(--ease-in) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (min-width: 900px) { .toast-region { bottom: var(--sp-5); } }

/* ── bottom sheet (dialog) ── */
.sheet { border: 0; padding: 0; width: 100%; max-width: 640px; margin: auto auto 0; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); box-shadow: var(--sh-2); max-height: 92dvh; overflow: auto; overscroll-behavior: contain; animation: sheet-up 320ms var(--ease-out) both; }
.sheet::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.sheet.is-closing { animation: sheet-down 200ms var(--ease-in) forwards; }
.sheet.is-closing::backdrop { animation: fade-out 200ms cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes sheet-up { from { transform: translateY(100%); opacity: 0.6; } }
@keyframes sheet-down { to { transform: translateY(100%); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 10px auto 2px; touch-action: none; }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; gap: var(--sp-3); padding: 8px 20px 4px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: var(--fs-lg); outline: none; }
.sheet-head .btn-icon { background: var(--surface-2); color: var(--muted); width: var(--tap); height: var(--tap); }
.sheet-body { padding: 8px 20px var(--sp-4); outline: none; }
/* a sheet with no sticky footer ends at the screen edge, so its last control would sit under the
   iPhone home indicator — :last-child is exactly "there is no .sheet-foot after me" */
.sheet-body:last-child { padding-bottom: calc(var(--sp-4) + var(--safe-b)); }
.sheet-foot { position: sticky; bottom: 0; z-index: 2; display: flex; gap: var(--sp-3); margin: 0; padding: 12px 20px calc(12px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.sheet-secondary { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.sheet[aria-busy="true"] .sheet-body { opacity: 0.55; pointer-events: none; transition: opacity var(--dur); }
.sheet .toast-region { position: fixed; inset-inline: 0; bottom: calc(var(--sp-3) + var(--safe-b)); z-index: 3; }
.sheet a.list-item[aria-current="page"] { background: var(--surface-2); color: var(--primary-dark); font-weight: 600; border-radius: var(--r-sm); }
@media (min-width: 900px) {
  .sheet { margin: auto; border-radius: var(--r-lg); animation-name: pop-in; }
  @keyframes pop-in { from { transform: scale(0.96); opacity: 0; } }
  .sheet-handle { display: none; }
}

/* ── table (responsive: horizontal scroll) ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table th, .table td { padding: var(--sp-2) var(--sp-3); text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.table th { background: var(--surface-2); font-family: var(--font-head); font-weight: 600; font-size: var(--fs-sm); color: var(--primary-dark); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-cancelled td { color: var(--muted); text-decoration: line-through; }

/* ── progress bar ── */
.progress { height: 12px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: inherit; transition: width 400ms var(--ease); }
.progress-label { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-top: var(--sp-1); }

/* ── empty / error states ── */
.state { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.state.is-inline { padding: var(--sp-4) var(--sp-3); }
.state-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--gold-ink); }
.state-icon .icon { width: 30px; height: 30px; }
.state h2 { color: var(--primary-dark); margin: 0; font-size: var(--fs-lg); }
.state p { margin: 0; max-width: 40ch; }

/* ── hero page (404, no access, suspended, root) ── */
.hero { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sp-4); padding: var(--sp-5); }
.hero-symbol { width: 120px; height: 108px; }
.hero h1 { margin: 0; }
.hero p { max-width: 44ch; color: var(--muted); margin: 0; }

/* ── the in-app guide: one section open at a time, so a long text stays navigable on a phone ── */
.help-section { padding: 0; overflow: hidden; }
.help-summary {
  display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; list-style: none;
  min-height: var(--tap); padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-head); font-size: var(--fs-md); color: var(--primary-dark);
}
.help-summary::-webkit-details-marker { display: none; }
.help-summary:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.help-chev { transition: transform var(--dur) var(--ease); color: var(--muted); }
.help-section[open] .help-chev { transform: rotate(180deg); }
.help-section[open] .help-summary { border-bottom: 1px solid var(--line); }
.help-body { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
.help-body p { margin: 0; line-height: 1.9; }
.help-list, .help-steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: var(--sp-2); line-height: 1.85; }
.help-steps li::marker { font-family: var(--font-latin); font-weight: 700; color: var(--primary); }
.help-list li::marker { color: var(--line-strong); }
.help-note {
  display: flex; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-sm);
  background: var(--gold-soft, var(--surface-2)); border-inline-start: 3px solid var(--gold);
  font-size: var(--fs-sm); line-height: 1.8;
}
.help-note .icon { flex: none; color: var(--gold-ink); margin-top: 3px; }
.help-rows { display: flex; flex-direction: column; }
.help-row { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.help-row:last-child { border-bottom: 0; }
.help-row b { color: var(--primary-dark); }
.help-row span { color: var(--muted); }
@media (max-width: 380px) { .help-row { grid-template-columns: 1fr; gap: 2px; } }

/* ── bottom nav / side nav ── */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(31, 42, 38, 0.35);
}
.nav-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tap); padding: var(--sp-1) 0; margin: 0; border: 0; border-radius: 0;
  background: none; -webkit-appearance: none; appearance: none;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-decoration: none;
  cursor: pointer; transition: color var(--dur) var(--ease);
}
.nav-item span { white-space: nowrap; line-height: 1.2; }
.nav-item .icon { width: 24px; height: 24px; padding: 4px 18px; box-sizing: content-box; border-radius: var(--r-pill); transition: background var(--dur), transform var(--dur-fast) var(--ease); }
.nav-item:active .icon { transform: scale(0.9); }
.nav-item[aria-current="page"] { color: var(--primary-dark); }
.nav-item[aria-current="page"] .icon { background: color-mix(in srgb, var(--primary) 14%, white); stroke-width: 2.3; animation: nav-pop 260ms var(--ease-out); }
@supports not (color: color-mix(in srgb, red 10%, white)) { .nav-item[aria-current="page"] .icon { background: var(--surface-2); } }
@keyframes nav-pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.08); } 100% { transform: none; } }
.nav-badge { position: absolute; top: 2px; inset-inline-start: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--nav-badge); color: #fff; font: 700 11px/18px var(--font-latin); direction: ltr; }
@media (max-width: 360px) { .nav-item { font-size: 12px; } }
@media (min-width: 900px) {
  .bottom-nav { inset-inline-start: 0; inset-inline-end: auto; top: 0; bottom: 0; width: 240px; height: auto; grid-auto-flow: row; grid-auto-rows: max-content; align-content: start; padding: var(--sp-5) var(--sp-3); gap: var(--sp-1); border-top: 0; border-inline-end: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); box-shadow: none; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); padding: 0 var(--sp-3); border-radius: var(--r-sm); font-size: var(--fs-sm); }
  .nav-item .icon { padding: 0; }
  .nav-item[aria-current="page"] { background: var(--surface-2); }
  .nav-item[aria-current="page"] .icon { background: none; animation: none; }
}

/* ── Vertex footer — identical to the SolidFlow "POWERED BY" badge (SPEC 7.5) ── */
.footer { text-align: center; padding: 30px 20px calc(40px + var(--nav-h) + var(--safe-b)); margin-top: 3rem; position: relative; z-index: 10; border-top: 1px solid rgba(0, 0, 0, 0.05); background: transparent; }
.vertex-label { font-family: var(--font-latin); font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; direction: ltr; }
.vertex-logo-container { display: block; cursor: pointer; width: max-content; margin: 0 auto; }
.vertex-logo-container img { height: 64px; width: auto; display: block; margin: 0 auto; filter: grayscale(100%) opacity(0.7); transition: filter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.vertex-logo-container:hover img, .vertex-logo-container:focus-visible img { filter: grayscale(0%) opacity(1); transform: scale(1.05); }
/* the reveal-on-hover badge is a desktop gesture; on a phone it only meant the badge was grey forever */
@media (hover: none) { .vertex-logo-container img { filter: none; } }
.vertex-slogan { font-size: 12px; color: var(--muted); margin-top: 12px; font-weight: 500; letter-spacing: 0.5px; text-align: center; }
/* the row stays visually compact, but each link carries a 44px-tall hit area so a thumb can reach it */
.footer-links { margin-top: 2px; display: flex; justify-content: center; gap: var(--sp-3); flex-wrap: wrap; font-size: 12px; }
.footer-links a { color: var(--muted); font-family: var(--font-latin); display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--sp-2); }
@media (min-width: 900px) { .footer { padding-bottom: 40px; } }

/* ── misc ── */
.divider { border: 0; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.kbd-hint { font-size: var(--fs-xs); color: var(--muted); }
.logo-round { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); background: var(--surface); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); text-align: start; }
.kv:last-of-type { border-bottom: 0; }
.mono { font-weight: 700; user-select: all; overflow-wrap: anywhere; }
.filter-bar { position: sticky; top: var(--sticky-top); z-index: 15; display: flex; gap: var(--sp-2); padding: var(--sp-2) 0; background: var(--bg); }
.filter-bar .field { flex: 1; margin: 0; }
/* a filter with few answers is a row of chips, not a dropdown (ui/forms.js chipFilter) */
.chip-filter { margin-bottom: 0; padding-bottom: 0; min-width: 0; flex: 1; }
.chip-filter .tab { padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.chip-filter .tab[aria-checked="true"] { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }

/* ── public pages (P1–P3) ── */
.brand { text-align: center; padding: var(--sp-4) 0 var(--sp-5); }
.logo-lg { width: 112px; height: 112px; }
.brand-name { margin: var(--sp-3) 0 var(--sp-1); }
.brand-tagline { color: var(--muted); margin: 0 auto var(--sp-4); max-width: 44ch; }
.date-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; min-height: 52px; padding: 4px 6px; border-radius: 14px; background: var(--surface-2); color: var(--primary-dark); line-height: 1.15; }
.date-chip b { font-family: var(--font-latin); font-size: 1.25rem; }
.date-chip span { font-size: var(--fs-xs); color: var(--muted); }
.date-chip.is-soon { background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent-ink); }
.rank { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.rank:last-child { border-bottom: 0; }
.rank-n { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-latin); font-weight: 700; color: var(--muted); background: var(--surface-2); font-size: var(--fs-sm); }
.rank.is-top .rank-n { color: var(--gold-ink); background: color-mix(in srgb, var(--gold) 26%, white); }
/* The date range is too long for one phone row next to three controls: it wrapped and shoved the
   arrows to opposite edges. It takes its own line, and the controls sit together underneath. */
.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.week-nav .grow { order: -1; flex: 1 0 100%; text-align: center; font-weight: 600; font-size: var(--fs-sm); }
.week-nav .btn { margin-inline-start: auto; }
@media (min-width: 560px) {
  .week-nav .grow { order: 0; flex: 1; }
  .week-nav .btn { margin-inline-start: 0; }
}
/* Seven days cannot be both 44px wide and 8px apart on a 360px screen — 7×44 + 6×8 needs 356 of the 328
   there are. The gutter wins: two day cells 2px apart read as one strip, and a day cell is 72px tall, so
   the thumb has more to aim at than the width alone says. */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: var(--sp-4); }
.day { min-height: 72px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 2px; font-size: var(--fs-xs); min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.day.is-today { border-color: var(--primary-line); box-shadow: inset 0 0 0 1px var(--primary-line); }
.day.is-past { background: var(--surface-2); }
.day.is-past .day-n { color: var(--muted); }
.day.is-selected { border-color: var(--accent-line); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.day-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.day-n { font-family: var(--font-latin); font-weight: 700; font-size: 1rem; color: var(--primary-dark); }
.day-dots { display: flex; gap: 3px; margin-top: auto; min-height: 6px; }
.day-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); display: block; }
.day-dot.is-lecture { background: var(--gold); }
.day.has-events { cursor: pointer; }
.day.has-events:active { transform: scale(0.96); }
/* the row the week board jumped to, so the eye lands where the tap sent it */
.is-flash { animation: row-flash 1100ms var(--ease-out); }
@keyframes row-flash { 0%, 40% { background: var(--surface-3); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .is-flash { animation: none; box-shadow: inset 0 0 0 2px var(--primary-line); } }
.day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary-line); }
.day-dot.is-lecture { background: var(--gold-dark); }
.event-chip { display: block; width: 100%; margin-top: 4px; padding: 7px 6px; min-height: 32px; border: 0; border-radius: 6px; background: var(--primary); color: var(--on-primary); font-size: var(--fs-xs); font-family: inherit; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.event-chip.is-lecture { background: var(--gold); color: var(--on-gold); }
/* Below 600px a day column is about 43px wide, so a per-event chip inside it cannot be a real target.
   The dots carry the at-a-glance information and the full-width row in the list below is what you tap. */
.event-chip { display: none; }
@media (min-width: 600px) {
  .event-chip { display: block; }
  .day-dots { display: none; }
}

.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.event-image img, .post-image img { width: 100%; height: auto; border-radius: var(--r-md); display: block; margin-top: var(--sp-3); }
.post-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.post-head h2 { margin: 0; font-size: var(--fs-md); flex: 1 1 auto; }
.post-body { margin: var(--sp-2) 0 0; }
.post.is-hilite { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.reg { margin-top: var(--sp-3); }

/* ── queue card (S4) ── */
.queue-item { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
.queue-main { display: flex; align-items: flex-start; gap: var(--sp-3); }
.queue-unit { font-weight: 700; font-size: var(--fs-md); color: var(--primary-dark); }
.queue-student { text-decoration: none; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; min-height: var(--tap); }

/* ── staff lists + image picker (S5/S6/S7/S9) ── */
.image-preview { max-width: 100%; max-height: 220px; border-radius: var(--r-md); border: 1px solid var(--line); object-fit: contain; background: var(--surface-2); }
.image-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

/* ── tabs (S10) ── */
.tabs { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2); margin-bottom: var(--sp-3); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: var(--tap); padding: 0 var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }
/* the jump-to-section row rides with the reader; it is her position marker as much as her shortcut */
.section-nav { position: sticky; top: var(--sticky-top); z-index: 5; margin: 0 calc(-1 * var(--sp-4)) var(--sp-3); padding: var(--sp-2) var(--sp-4); background: var(--bg); box-shadow: 0 6px 12px -10px rgba(31, 42, 38, 0.5); }
.section-nav .tab { font-size: var(--fs-xs); padding: 0 var(--sp-3); display: inline-flex; align-items: center; text-decoration: none; }
.section-nav .tab[aria-current="location"] { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }

/* ── accordion (long settings forms) ── */
.acc { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); overflow: hidden; }
.acc + .acc { margin-top: var(--sp-3); }
.acc > summary { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: 0 var(--sp-4); font-family: var(--font-head); font-weight: 600; color: var(--primary-dark); cursor: pointer; list-style: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .icon { margin-inline-start: auto; transition: transform var(--dur) var(--ease); }
.acc[open] > summary { border-bottom: 1px solid var(--line); }
.acc[open] > summary .icon { transform: rotate(180deg); }
.acc-body { padding: var(--sp-4); }

/* ── reports + certificate (S10) ── */
.report-head { text-align: center; margin-bottom: var(--sp-4); }
.report-brand { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.report-brand img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.report-project { font-family: var(--font-head); font-size: var(--fs-md); color: var(--primary-dark); }
.report h2 { margin: 0 0 var(--sp-1); }
.print-week { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); }
.print-day { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); }
.print-day-head { font-family: var(--font-head); color: var(--primary-dark); margin-bottom: var(--sp-1); }
.print-event { padding: 2px 0; }
.certificate { background: #FFFDF7; padding: var(--sp-3); }
.cert-frame { border: 3px double var(--gold); padding: var(--sp-5) var(--sp-4); text-align: center; border-radius: var(--r-sm); position: relative; }
.cert-frame::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--gold-light); border-radius: 4px; pointer-events: none; }
.cert-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto var(--sp-2); border: 3px solid var(--gold); }
.cert-project { font-family: var(--font-head); color: var(--primary-dark); font-size: var(--fs-md); }
.cert-bismillah { font-family: var(--font-splash); font-size: var(--fs-lg); color: var(--primary-dark); margin: var(--sp-3) 0; }
.cert-title { font-family: var(--font-head); font-size: var(--fs-2xl); color: var(--gold-ink); margin: var(--sp-2) 0 var(--sp-3); }
.cert-text { font-family: var(--font-splash); font-size: var(--fs-md); line-height: 1.9; margin: 0 auto var(--sp-2); max-width: 44ch; }
.cert-name { font-family: var(--font-head); font-size: var(--fs-xl); color: var(--primary-ink); margin: var(--sp-3) 0; padding: var(--sp-2) var(--sp-4); border-bottom: 2px solid var(--gold); display: inline-block; }
.cert-dua { font-family: var(--font-splash); color: var(--muted); margin: var(--sp-3) 0; }
.cert-dates { display: flex; justify-content: center; gap: var(--sp-5); font-size: var(--fs-sm); color: var(--muted); flex-wrap: wrap; }
.cert-sign { display: flex; justify-content: space-around; gap: var(--sp-5); margin-top: var(--sp-6); }
.cert-line { width: 140px; border-bottom: 1px solid var(--ink); margin: 0 auto var(--sp-1); height: 36px; }
.cert-foot { display: flex; justify-content: space-between; margin-top: var(--sp-5); font-size: var(--fs-xs); color: var(--muted); }

/* ── readiness pass: layout details the design lens caught on the phone ── */
/* staff event row: text first, actions on their own line */
.ev-row { flex-wrap: wrap; }
.ev-row .ev-actions { flex-basis: 100%; display: flex; gap: var(--sp-2); justify-content: flex-end; align-items: center; }
/* a meta line made of segments that never break inside themselves */
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.meta-row .seg { white-space: nowrap; }
/* a note under a record is a sentence, not more meta */
.rec-note { color: var(--muted); font-style: italic; margin-top: 2px; }
/* the chevron on a clickable tile sits centred on the start edge, not in a corner */
.tile-chev { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tile { padding-inline-start: 26px; }
/* a date next to a title is information, not a link */
.tag-date { color: var(--muted); }
/* the corner grip of a textarea is desktop furniture; height still adjusts */
textarea { resize: vertical; }
/* a page with a floating button keeps room for it under the last line, so it never covers the footer */
.main:has(.fab) { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 112px); }
/* chip rows inside a card run to the card's edge, and fade instead of chopping a chip in half */
.card .tabs { margin-inline: calc(-1 * var(--sp-4)); padding-inline: var(--sp-4); mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
/* confirm and prompt dialogs wear the app's own clothes, not SweetAlert's defaults */
.swal2-popup { border-radius: var(--r-lg) !important; font-family: inherit !important; }
.swal2-title { font-family: var(--font-head) !important; color: var(--primary-dark) !important; font-size: var(--fs-lg) !important; }
.swal2-html-container { text-align: start !important; color: var(--ink) !important; }
.swal2-styled.swal2-confirm { background: var(--primary-fill) !important; color: var(--on-primary-fill) !important; border-radius: var(--r-pill) !important; box-shadow: none !important; min-height: var(--tap); padding-inline: var(--sp-5) !important; font-weight: 600; }
.swal2-styled.swal2-cancel { background: transparent !important; color: var(--primary-ink) !important; border: 1.5px solid var(--line-strong) !important; border-radius: var(--r-pill) !important; box-shadow: none !important; min-height: var(--tap); padding-inline: var(--sp-5) !important; font-weight: 600; }
.swal2-styled:focus-visible { box-shadow: var(--ring) !important; }
.swal2-icon.swal2-question, .swal2-icon.swal2-warning { border-color: var(--primary-line) !important; color: var(--primary-ink) !important; }
.swal2-input, .swal2-textarea { border: 1.5px solid var(--line-strong) !important; border-radius: 14px !important; text-align: start !important; font-size: 16px !important; box-shadow: none !important; }
.swal2-input:focus, .swal2-textarea:focus { border-color: var(--primary) !important; box-shadow: var(--ring) !important; }
