/*
 * Access Control - hand-written stylesheet.
 *
 * No build step. This file is committed and served exactly as written -
 * see docs/RUNBOOK.md's "Styling" section for why Tailwind was tried and
 * removed. Organised as: tokens (custom properties, light + dark) -> base
 * element styles -> layout -> reusable components -> per-page bits, roughly
 * in the order a page needs them.
 *
 * Dark is the visual default (see App\Views\themeInitScript() in
 * src/Views/helpers.php, which sets .light on <html> before first paint
 * only when the visitor has switched to light). Tokens are therefore
 * defined once on :root for dark, and overridden under :root.light for the
 * light theme - the opposite of the usual "light is default" convention,
 * so don't be surprised the override block is named ".light", not ".dark".
 */

/* ---------- Design tokens ---------- */

:root {
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.45);

    /* Surfaces */
    --color-bg: #020617;
    --color-bg-wash-1: rgba(99, 102, 241, 0.16);
    --color-bg-wash-2: rgba(139, 92, 246, 0.12);
    --color-surface: #0f172a;
    --color-surface-muted: rgba(30, 41, 59, 0.6);
    --color-surface-hover: #1e293b;

    /* Borders */
    --color-border: #1e293b;
    --color-border-strong: #334155;

    /* Text */
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-text-faint: #64748b;

    /* Links / accent */
    --color-accent: #818cf8;
    --color-accent-hover: #a5b4fc;

    /* TR Colours */
    --tr-primary: rgb(59 130 246);
    --tr-primary-shadow: rgb(27 55 99);

    /* Status colours: each has a soft background, a foreground, and a ring
       (border) - used by badges, icon chips, and alert boxes alike. */
    --status-emerald-bg: rgba(16, 185, 129, 0.1);
    --status-emerald-fg: #34d399;
    --status-emerald-ring: rgba(52, 211, 153, 0.25);

    --status-rose-bg: rgba(244, 63, 94, 0.1);
    --status-rose-fg: #fb7185;
    --status-rose-ring: rgba(251, 113, 133, 0.25);

    --status-amber-bg: rgba(245, 158, 11, 0.1);
    --status-amber-fg: #fbbf24;
    --status-amber-ring: rgba(251, 191, 36, 0.25);

    --status-sky-bg: rgba(14, 165, 233, 0.1);
    --status-sky-fg: #38bdf8;
    --status-sky-ring: rgba(56, 189, 248, 0.25);

    --status-violet-bg: rgba(139, 92, 246, 0.1);
    --status-violet-fg: #a78bfa;
    --status-violet-ring: rgba(167, 139, 250, 0.25);

    --status-orange-bg: rgba(249, 115, 22, 0.1);
    --status-orange-fg: #fb923c;
    --status-orange-ring: rgba(251, 146, 60, 0.25);

    --status-indigo-bg: rgba(99, 102, 241, 0.1);
    --status-indigo-fg: #818cf8;
    --status-indigo-ring: rgba(129, 140, 248, 0.25);

    --status-slate-bg: rgba(100, 116, 139, 0.15);
    --status-slate-fg: #94a3b8;
    --status-slate-ring: rgba(148, 163, 184, 0.2);

    /* Row-hover tint per section colour - deliberately stronger than the
       status backgrounds above (0.10 opacity reads as "no visible change"
       against a dark surface - see the hover hunt in git history/chat if
       this regresses again). */
    --hover-indigo: rgba(99, 102, 241, 0.15);
    --hover-amber: rgba(245, 158, 11, 0.15);
    --hover-sky: rgba(14, 165, 233, 0.15);
    --hover-violet: rgba(139, 92, 246, 0.15);
    --hover-rose: rgba(244, 63, 94, 0.15);
    --hover-emerald: rgba(16, 185, 129, 0.15);
}

:root.light {
    --color-bg: #f8fafc;
    --color-bg-wash-1: rgba(199, 210, 254, 0.55);
    --color-bg-wash-2: rgba(221, 214, 254, 0.45);
    --color-surface: #ffffff;
    --color-surface-muted: rgba(248, 250, 252, 0.8);
    --color-surface-hover: #f8fafc;

    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;

    --color-text: #0f172a;
    --color-text-secondary: #334155;
    --color-text-muted: #64748b;
    --color-text-faint: #94a3b8;

    --color-accent: #4f46e5;
    --color-accent-hover: #6366f1;

    --status-emerald-bg: #ecfdf5;
    --status-emerald-fg: #047857;
    --status-emerald-ring: rgba(5, 150, 105, 0.2);

    --status-rose-bg: #fff1f2;
    --status-rose-fg: #be123c;
    --status-rose-ring: rgba(225, 29, 72, 0.2);

    --status-amber-bg: #fffbeb;
    --status-amber-fg: #b45309;
    --status-amber-ring: rgba(217, 119, 6, 0.2);

    --status-sky-bg: #f0f9ff;
    --status-sky-fg: #0369a1;
    --status-sky-ring: rgba(2, 132, 199, 0.2);

    --status-violet-bg: #f5f3ff;
    --status-violet-fg: #6d28d9;
    --status-violet-ring: rgba(124, 58, 237, 0.2);

    --status-orange-bg: #fff7ed;
    --status-orange-fg: #c2410c;
    --status-orange-ring: rgba(234, 88, 12, 0.2);

    --status-indigo-bg: #eef2ff;
    --status-indigo-fg: #4338ca;
    --status-indigo-ring: rgba(79, 70, 229, 0.2);

    --status-slate-bg: #f1f5f9;
    --status-slate-fg: #475569;
    --status-slate-ring: rgba(100, 116, 139, 0.2);

    --hover-indigo: #eef2ff;
    --hover-amber: #fffbeb;
    --hover-sky: #f0f9ff;
    --hover-violet: #f5f3ff;
    --hover-rose: #fff1f2;
    --hover-emerald: #ecfdf5;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
}

/* ---------- Reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    background-image:
        radial-gradient(640px circle at 8% -8%, var(--color-bg-wash-1), transparent 60%),
        radial-gradient(560px circle at 108% 12%, var(--color-bg-wash-2), transparent 60%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

a { color: inherit; text-decoration: none; }

table { border-collapse: collapse; width: 100%; }

button, input, select { font: inherit; color: inherit; }

img, svg { display: block; max-width: 100%; }

::selection { background: var(--color-accent); color: #fff; }

/* ---------- Layout ---------- */

.page-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: 2rem; }

.stack-sm > * + * { margin-top: 1rem; }

.container-narrow { max-width: 32rem; margin: 0 auto; }
.container-medium { max-width: 42rem; margin: 0 auto; }

.list-reset { list-style: none; margin: 0; padding: 0; }
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
}
.token-disabled { color: var(--status-rose-fg); }

.row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Same as .row, but bottom-aligned - for a .field (label + input stacked)
   sitting next to a button, where .row's align-items: center would centre
   the button against the label+input block as a whole, not the input. */
.row--align-end {
    display: flex;
    align-items: flex-end;
    gap: 0.625rem;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---------- Headings & text ---------- */

.heading-sm { font-size: 1rem; font-weight: 600; color: var(--color-text); margin-bottom: 0.25rem; }
.page-title { font-size: 1.125rem; font-weight: 600; color: var(--color-text); }
.subtext { font-size: 0.875rem; color: var(--color-text-muted); margin-top: 0.125rem; margin-bottom: 0.75rem; }
.subtext--tight { margin-bottom: 0; }
.count-alert { font-weight: 600; color: var(--status-rose-fg); }

/* ---------- Header / footer ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--color-border);
    background: color-mix(in srgb, var(--color-surface) 85%, transparent);
    backdrop-filter: blur(10px);
}

.site-header__inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 600;
    color: var(--color-text);
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    width: 2.25rem;
    border-radius: var(--radius-xl);
    background: var(--tr-primary);
    color: #fff;
    box-shadow: var(--tr-primary-shadow);
    transition: box-shadow 0.15s ease;
}

.brand:hover .brand-mark { box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45); }

/* A real school logo needs none of the chip styling that gives the
   placeholder padlock icon its visual weight - just the image itself. */
.brand-mark--logo {
    background: none;
    box-shadow: none;
}

.brand:hover .brand-mark--logo { box-shadow: none; }

.brand-logo {
    height: 100%;
    width: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.brand-mark--lg {
    height: 3.5rem;
    width: 3.5rem;
    border-radius: var(--radius-2xl);
}

.brand-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

.site-footer {
    flex-shrink: 0;
    min-height: 5vh;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--color-border);
}

.site-footer p {
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-faint);
}

/* Icon-only button, e.g. the theme toggle and the logout link. */
.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2.25rem;
    width: 2.25rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-button:hover { background: var(--color-surface-hover); color: var(--color-text); }

.icon-button svg { height: 1rem; width: 1rem; }

.theme-toggle .icon-sun { display: none; }
:root.light .theme-toggle .icon-sun { display: block; }
:root.light .theme-toggle .icon-moon { display: none; }

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.logout-link:hover { background: var(--color-surface-hover); color: var(--color-text); }

/* ---------- Cards & sections ---------- */

.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.card--padded { padding: 1.5rem; }

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.section-heading h1, .section-heading h2 { font-size: 1rem; font-weight: 600; color: var(--color-text); }

.icon-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.75rem;
    width: 1.75rem;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.icon-chip--lg { height: 3rem; width: 3rem; border-radius: var(--radius-lg); }

.icon-chip svg { height: 1rem; width: 1rem; }
.icon-chip--lg svg { height: 1.5rem; width: 1.5rem; }

/* One .icon-chip--{colour}/.badge--{colour} pair per status colour. */
.icon-chip--indigo, .badge--indigo { background: var(--status-indigo-bg); color: var(--status-indigo-fg); }
.icon-chip--emerald, .badge--emerald { background: var(--status-emerald-bg); color: var(--status-emerald-fg); }
.icon-chip--rose, .badge--rose { background: var(--status-rose-bg); color: var(--status-rose-fg); }
.icon-chip--amber, .badge--amber { background: var(--status-amber-bg); color: var(--status-amber-fg); }
.icon-chip--sky, .badge--sky { background: var(--status-sky-bg); color: var(--status-sky-fg); }
.icon-chip--violet, .badge--violet { background: var(--status-violet-bg); color: var(--status-violet-fg); }
.icon-chip--orange, .badge--orange { background: var(--status-orange-bg); color: var(--status-orange-fg); }
.icon-chip--slate, .badge--slate { background: var(--status-slate-bg); color: var(--status-slate-fg); }

/* ---------- Status badge (pill) ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: inset 0 0 0 1px transparent;
}

.badge--indigo { box-shadow: inset 0 0 0 1px var(--status-indigo-ring); }
.badge--emerald { box-shadow: inset 0 0 0 1px var(--status-emerald-ring); }
.badge--rose { box-shadow: inset 0 0 0 1px var(--status-rose-ring); }
.badge--amber { box-shadow: inset 0 0 0 1px var(--status-amber-ring); }
.badge--sky { box-shadow: inset 0 0 0 1px var(--status-sky-ring); }
.badge--violet { box-shadow: inset 0 0 0 1px var(--status-violet-ring); }
.badge--orange { box-shadow: inset 0 0 0 1px var(--status-orange-ring); }
.badge--slate { box-shadow: inset 0 0 0 1px var(--status-slate-ring); }

.badge--pill-tag {
    padding: 0.0625rem 0.375rem;
    font-size: 0.6875rem;
    border-radius: var(--radius-full);
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
}

.badge-dot {
    height: 0.375rem;
    width: 0.375rem;
    border-radius: 50%;
}
.badge-dot--emerald { background: var(--status-emerald-fg); }
.badge-dot--rose { background: var(--status-rose-fg); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: filter 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn--sm { padding: 0.375rem 0.75rem; }

.btn--primary {
    background: var(--tr-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover { filter: brightness(1.1); box-shadow: var(--shadow-md); }
.btn--primary:active { transform: scale(0.99); }

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-sm);
}
.btn--secondary:hover { background: var(--color-surface-hover); }

.btn--danger {
    background: var(--status-rose-bg);
    color: var(--status-rose-fg);
}
.btn--danger:hover { filter: brightness(1.15); }

.btn--block { width: 100%; }
.btn-row { display: flex; gap: 0.75rem; }
.btn-row > .btn { flex: 1; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 24rem; overflow-y: auto; }

/* A day-of-week check/cross cell - see templates/timers/index.phtml's Time
   Periods table. The "h-4 w-4" passed to icon() is a leftover from the
   Tailwind era (see RUNBOOK.md's "Styling" section) - it's inert now, and
   every other icon() call site only ends up sized because it happens to sit
   inside .icon-chip/.icon-button, which size their own <svg> directly; a
   bare icon() with no such wrapper renders at the browser's unstyled SVG
   default (huge) unless sized here explicitly. */
.day-mark--yes, .day-mark--no { display: inline-flex; }
.day-mark--yes svg, .day-mark--no svg { height: 0.75rem; width: 0.75rem; }
.day-mark--yes { color: var(--status-emerald-fg); }
.day-mark--no { color: var(--color-text-faint); }

table.data {
    font-size: 0.875rem;
}

table.data thead {
    background: var(--color-surface-muted);
}

table.data.sticky-head thead { position: sticky; top: 0; backdrop-filter: blur(4px); }

table.data th {
    padding: 0.625rem 1rem;
    text-align: left;
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
}

table.data th.center { text-align: center; }

table.data td {
    padding: 0.5rem 1rem;
    border-top: 1px solid color-mix(in srgb, var(--color-border) 60%, transparent);
    color: var(--color-text-secondary);
}

table.data tbody tr { transition: background-color 0.15s ease; }

table.data .cell-strong { font-weight: 500; color: var(--color-text); }
table.data .cell-muted { color: var(--color-text-muted); }
table.data .cell-nowrap { white-space: nowrap; }
table.data .cell-indent { padding-left: 2rem; }

table.data .group-row td {
    background: var(--color-surface-muted);
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* One .row-hover--{colour} per section, applied to <tr>. */
.row-hover--indigo:hover { background: var(--hover-indigo); }
.row-hover--amber:hover { background: var(--hover-amber); }
.row-hover--sky:hover { background: var(--hover-sky); }
.row-hover--violet:hover { background: var(--hover-violet); }
.row-hover--rose:hover { background: var(--hover-rose); }
.row-hover--emerald:hover { background: var(--hover-emerald); }

/* A <tr> whose whole area navigates via an onclick handler (see
   templates/dashboard.phtml) - the row's own link still carries the real
   href, this is purely the pointer-cursor affordance for the rest of it. */
.row-clickable { cursor: pointer; }

/* Left-edge accent on the inputs/outputs table (templates/dashboard.phtml):
   green for an input, red for an output. */
.io-input { box-shadow: inset 1px 0 0 var(--status-sky-fg); }
.io-output { box-shadow: inset 1px 0 0 var(--status-rose-fg); }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: var(--color-text-faint);
    text-align: center;
}
.empty-state svg { height: 1.5rem; width: 1.5rem; }
.empty-state span { font-size: 0.875rem; }

td.empty-cell { padding: 0; }
td.empty-cell .empty-state { padding: 2.5rem 1rem; }

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.pagination-link, .pagination-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    text-decoration: none;
}

.pagination-link:hover, .pagination-jump:hover { background: var(--color-surface-hover); }

.pagination-link--active {
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
}
.pagination-link--active:hover { background: var(--color-accent); }

.pagination-jump--disabled {
    color: var(--color-text-faint);
    pointer-events: none;
}

/* ---------- Forms ---------- */

.field { display: block; }
.field + .field { margin-top: 1.25rem; }

.field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field input[type="datetime-local"],
.field select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.875rem;
}

.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* A row of "Monday"/"Tuesday"/... checkboxes - see templates/time-periods/form.phtml. */
.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ---------- Alerts ---------- */

.alert {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.alert--danger {
    background: var(--status-rose-bg);
    color: var(--status-rose-fg);
    border-color: var(--status-rose-ring);
}

/* ---------- Links ---------- */

.link {
    display: inline-block;
    color: var(--color-accent);
    font-weight: 500;
    transition: color 0.15s ease;
}
.link:hover { color: var(--color-accent-hover); }

/* ---------- Not-yet-migrated placeholders ---------- */

.link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-accent); }
.link-card span:first-child { font-weight: 500; color: var(--color-text); }
.link-card .link-arrow { color: var(--color-accent); }

.link-card--disabled {
    border-style: dashed;
    background: color-mix(in srgb, var(--color-surface) 60%, transparent);
}
.link-card--disabled span:first-child { color: var(--color-text-faint); }

.grid-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-cards--3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Dashboard hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    padding-left: 2rem;
}

.hero-accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.375rem;
}
.hero-accent--emerald { background: var(--status-emerald-fg); }
.hero-accent--rose { background: var(--status-rose-fg); }

.hero-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hero-label { font-size: 0.875rem; font-weight: 500; color: var(--color-text-muted); }
.hero-value { margin-top: 0.125rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text); }

/* ---------- Auth (standalone pages) ---------- */

.auth-page {
    position: relative;
    display: flex;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
}

.auth-page .theme-toggle { position: absolute; top: 1rem; right: 1rem; }

.auth-card {
    width: 100%;
    max-width: 24rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    background: color-mix(in srgb, var(--color-surface) 90%, transparent);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.auth-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-card-header h1 { margin-top: 1.25rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text); }
.auth-card-header p { margin-top: 0.25rem; font-size: 0.875rem; color: var(--color-text-muted); }

.google-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.google-btn:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
.google-btn:active { transform: scale(0.99); }
.google-btn svg { height: 1.25rem; width: 1.25rem; flex-shrink: 0; }

.auth-footnote {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-faint);
}

.auth-alert { margin-top: 1.5rem; }

/* ---------- Error pages ---------- */

.error-page {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.error-page--centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 5rem 1.5rem;
}

.error-code { font-size: 0.875rem; font-weight: 600; }
.error-code--rose { color: var(--status-rose-fg); }
.error-code--indigo { color: var(--color-accent); }

.error-page h1 { margin-top: 0.5rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text); }
.error-page p.error-message { margin-top: 0.5rem; font-size: 0.875rem; color: var(--color-text-muted); }

.error-page code {
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    padding: 0.125rem 0.375rem;
    color: var(--color-text-secondary);
}

.error-trace {
    margin-top: 1.5rem;
    border-radius: var(--radius-lg);
    background: #000;
    padding: 1rem;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.75rem;
    color: var(--color-text);
}
.error-trace p { margin-bottom: 0.375rem; }
.error-trace .trace-label { color: var(--color-text-faint); }
.error-trace pre {
    margin-top: 0.75rem;
    max-height: 24rem;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--color-text-secondary);
}

.error-page .btn { margin-top: 1.5rem; }

/* ---------- Users show page ---------- */

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    width: 2.5rem;
    border-radius: var(--radius-lg);
    background: var(--tr-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: var(--tr-primary-shadow);
}

/* ---------- Sync page (standalone, not through the layout) ---------- */

.sync-page { min-height: 100%; padding: 2.5rem 1rem; }
.sync-page .page-main { max-width: 42rem; padding: 0; }
.sync-status { margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 600; }
.sync-output {
    max-height: 24rem;
    overflow: auto;
    white-space: pre-wrap;
    border-radius: var(--radius-lg);
    background: #000;
    padding: 1rem;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.75rem;
    color: var(--color-text);
}

/* ---------- Small helpers ---------- */

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-center { text-align: center; }
.text-sm { font-size: 0.8125rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-6 { margin-bottom: 1.5rem; }
.italic { font-style: italic; }
.font-mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.font-semibold { font-weight: 600; }

/* ---------- Kiosk (standalone pages, templates/kiosk/*) ---------- */

.kiosk-page {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.kiosk-card {
    width: 100%;
    max-width: 40rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    background: color-mix(in srgb, var(--color-surface) 90%, transparent);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    text-align: center;
}

.kiosk-brand { display: flex; justify-content: center; margin-bottom: 1.5rem; color: var(--color-accent); }
.kiosk-brand svg { height: 2rem; width: 2rem; }
.kiosk-brand--logo .brand-logo { height: 2.5rem; width: auto; }

.kiosk-loading { font-size: 1rem; color: var(--color-text-muted); }

.kiosk-heading { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text); }
.kiosk-subheading { margin-top: 0.75rem; font-size: 1.125rem; color: var(--color-text-secondary); }

.kiosk-safeguarding-note {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: var(--color-surface-muted);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.kiosk-pupil-actions { margin-top: 2rem; }
.kiosk-pupil-actions-label {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-faint);
}

.kiosk-form { margin-top: 1.5rem; text-align: left; }
.kiosk-form-actions { margin-top: 1.25rem; }

.kiosk-text-input {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.125rem;
    resize: none;
}
.kiosk-text-input:focus { outline: none; border-color: var(--color-accent); }

.kiosk-policy-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1.125rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-muted);
    text-align: left;
    font-size: 1rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}
.kiosk-policy-item input[type="checkbox"] { flex-shrink: 0; margin-top: 0.125rem; height: 1.75rem; width: 1.75rem; }

.kiosk-statement { margin-top: 1.5rem; text-align: left; }
.kiosk-statement p { font-size: 0.9375rem; color: var(--color-text-secondary); }
.kiosk-statement p + p { margin-top: 0.75rem; }

.kiosk-back-link { margin-top: 1.5rem; }

.kiosk-picker-grid { margin-top: 1.5rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.kiosk-picker-grid .btn { flex: 0 0 auto; min-width: 4.5rem; }

.btn-row > .inline-form { flex: 1; }

/* Touch-target sizing for the kiosk specifically (a badge terminal/tablet,
   tapped rather than clicked with a mouse - see docs/RUNBOOK.md) - bigger
   than the .btn/.link-card defaults used elsewhere in this file for the
   staff-facing, mouse-driven dashboard, and scoped to .kiosk-page so that
   desktop UI doesn't grow along with it. Targets roughly the 44-48px
   minimum both Apple's and Material's touch guidelines recommend. */
.kiosk-page .btn {
    min-height: 3.25rem;
    padding: 0.875rem 1.25rem;
    font-size: 1.0625rem;
    border-radius: var(--radius-lg);
}
.kiosk-page .btn--sm { min-height: 2.75rem; padding: 0.625rem 1rem; }

.kiosk-page .link-card {
    padding: 1.25rem 1.5rem;
    font-size: 1.0625rem;
}
.inline-form { display: inline; }

/* /api-docs - Swagger UI (vendored, see public/assets/vendor/swagger-ui/).
   Swagger UI only ships a light theme, with its own hardcoded colours, so
   its panel stays light in both of this app's themes rather than reading
   from the tokens above - the one deliberate exception to that rule here.
   The second rule undoes the base element resets above (svg/img as block,
   zeroed heading margins, inherited link colour) inside the panel only,
   via `revert`, so Swagger UI's own class rules win and its inline icons
   and spacing render the way they were designed to. */
.api-docs {
    padding: 0.5rem 1rem 1.5rem;
    background: #fff;
    color: #3b4151;
    color-scheme: light;
    overflow-x: auto;
}
.api-docs :is(img, svg) { display: revert; }
.api-docs :is(h1, h2, h3, p) { margin: revert; }
.api-docs a { color: revert; text-decoration: revert; }
