/* =========================================================================
   Vox Angelorum · Choir Attendance — "Calm" design language
   Neutral by default. Colour only carries meaning:
     blue  = present / healthy        red = absent / needs attention
     grey  = excused / neutral        black = actions and structure
   Light theme is the default; dark is opt-in via [data-bs-theme="dark"].
   ========================================================================= */

:root, [data-bs-theme="light"] {
    --bg: #f6f6f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --sunken: #f1f1f3;
    --hover: #f4f4f5;
    --line: #e7e7ea;
    --line-strong: #d6d6db;
    --track: #ececef;

    --ink: #0a0a0b;
    --text: #18181b;
    --text-2: #3f3f46;
    --muted: #71717a;
    --faint: #a1a1aa;

    /* The only accent: blue means "present / good". */
    --brand: #2563eb;
    --brand-ink: #1d4ed8;
    --brand-rgb: 37, 99, 235;
    --brand-soft: #eff4ff;
    --brand-line: #c7d7fe;

    /* Red means "absent / needs attention". */
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-line: #fecaca;

    --excused-solid: #71717a;

    /* Primary actions are ink, not colour. */
    --action: #0a0a0b;
    --action-hover: #27272a;
    --on-action: #ffffff;

    --glass-strong: rgba(255, 255, 255, .9);

    --shadow-xs: 0 1px 2px rgba(10, 10, 11, .04);
    --shadow: 0 1px 2px rgba(10, 10, 11, .04), 0 1px 1px rgba(10, 10, 11, .02);
    --shadow-md: 0 4px 16px -6px rgba(10, 10, 11, .10), 0 1px 2px rgba(10, 10, 11, .04);
    --shadow-lg: 0 24px 64px -16px rgba(10, 10, 11, .22), 0 2px 6px rgba(10, 10, 11, .05);
    --blur: blur(16px) saturate(160%);
    --r-xl: 18px;
    --r-lg: 14px;
    --r: 10px;
    --side-w: 248px;
    --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-body-font-family: var(--font);
    --bs-body-font-size: .9rem;
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--text);
    --bs-link-color-rgb: 24, 24, 27;
    --bs-link-hover-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--r);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--hover);
    color-scheme: light;
}

[data-bs-theme="dark"] {
    --bg: #09090b;
    --surface: #131316;
    --surface-2: #17171a;
    --sunken: #1f1f23;
    --hover: #1f1f23;
    --line: #26262b;
    --line-strong: #34343a;
    --track: #27272c;

    --ink: #fafafa;
    --text: #f4f4f5;
    --text-2: #d4d4d8;
    --muted: #a1a1aa;
    --faint: #71717a;

    --brand: #5b8cff;
    --brand-ink: #8db0ff;
    --brand-rgb: 91, 140, 255;
    --brand-soft: #16213b;
    --brand-line: #24396b;

    --danger: #f26b6b;
    --danger-soft: #2a1314;
    --danger-line: #5c2224;

    --excused-solid: #a1a1aa;

    --action: #fafafa;
    --action-hover: #e4e4e7;
    --on-action: #09090b;

    --glass-strong: rgba(19, 19, 22, .92);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 6px 20px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 70px -16px rgba(0, 0, 0, .75);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--text);
    --bs-link-color-rgb: 244, 244, 245;
    --bs-link-hover-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--hover);
    color-scheme: dark;
}

/* ===== Base ============================================================= */
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); letter-spacing: -.011em; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font); color: var(--ink); letter-spacing: -.03em; font-weight: 650; }
.text-muted, .form-text { color: var(--muted) !important; }
.text-2 { color: var(--text-2); }
.text-brand { color: var(--muted) !important; }
.fw-650 { font-weight: 650; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
::selection { background: rgba(var(--brand-rgb), .18); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.grad-text { color: var(--muted); }

/* Calm background: one soft highlight, no colour. */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--bg); }
.backdrop::before { content: ""; position: absolute; inset: 0; background: radial-gradient(1200px 500px at 50% -200px, var(--surface), transparent 70%); }
.backdrop i { display: none; }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.page > * { animation: rise .35s cubic-bezier(.2, .7, .2, 1) both; }
.page > *:nth-child(2) { animation-delay: .03s; }
.page > *:nth-child(3) { animation-delay: .06s; }
.page > *:nth-child(4) { animation-delay: .09s; }
.page > *:nth-child(n+5) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Page transitions (supported browsers); sidebar and tab bar stay put. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
.side { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }
.appbar { view-transition-name: appbar; }

/* ===== Shell ============================================================ */
.shell { display: flex; min-height: 100vh; }

.side {
    position: sticky; top: 0; height: 100vh; width: var(--side-w); flex-shrink: 0;
    display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line);
    transition: width .25s cubic-bezier(.2, .8, .2, 1);
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding-right: .65rem; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.1rem 1rem; color: var(--ink); min-width: 0; }
.brand .lbl { min-width: 0; white-space: nowrap; }
.brand-name { font-weight: 650; font-size: .98rem; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
.brand-tag { font-size: .72rem; color: var(--muted); }
.side-toggle { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--faint); transition: background .15s, color .15s, transform .25s; }
.side-toggle:hover { background: var(--hover); color: var(--ink); }

.side-search {
    display: flex; align-items: center; gap: .55rem; margin: 0 .75rem .6rem; padding: .48rem .65rem; border-radius: 9px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: .84rem; text-align: left; transition: border-color .15s, color .15s;
}
.side-search:hover { border-color: var(--line-strong); color: var(--text-2); }
.side-search .lbl:not(.kbd) { flex: 1; }

.side-nav { flex: 1; overflow-y: auto; padding: .2rem .75rem 1rem; }
.side-label { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 1.1rem .65rem .45rem; }
.side-link {
    display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; margin: 1px 0;
    border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: .88rem; transition: background .15s, color .15s;
}
.side-link i { font-size: 1rem; width: 1.15rem; text-align: center; color: var(--muted); }
.side-link .lbl, .side-search .lbl, .side-label .lbl { white-space: nowrap; }
.side-link:hover { background: var(--hover); color: var(--ink); }
.side-link.active { background: var(--sunken); color: var(--ink); font-weight: 600; }
.side-link.active i { color: var(--ink); }

.side-foot { padding: .65rem .75rem .8rem; border-top: 1px solid var(--line); }
.side-lang { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .2rem .2rem .6rem; }
.side-lang > span { display: inline-flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--muted); }
.me-card {
    width: 100%; display: flex; align-items: center; gap: .6rem; padding: .45rem; border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--text); text-align: left; transition: background .15s, border-color .15s;
}
.me-card:hover, .me-card[aria-expanded="true"] { background: var(--hover); border-color: var(--line); }
.me-card .who { min-width: 0; flex: 1; line-height: 1.25; }
.me-card .who b { display: block; font-weight: 600; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .who span { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 992px) {
    .side-collapsed .side { width: 72px; }
    .side-collapsed .side .lbl { display: none !important; }
    .side-collapsed .side-top { flex-direction: column; gap: .4rem; padding: 0 0 .4rem; }
    .side-collapsed .side-top .brand { padding: 1.1rem 0 0; justify-content: center; }
    .side-collapsed .side-toggle { transform: rotate(180deg); }
    .side-collapsed .side-search { justify-content: center; margin: 0 .75rem .5rem; padding: .55rem 0; }
    .side-collapsed .side-link { justify-content: center; padding: .6rem 0; }
    .side-collapsed .side-label { height: 1px; padding: 0; margin: .9rem .3rem; background: var(--line); }
    .side-collapsed .side-lang { justify-content: center; padding: .2rem 0 .6rem; }
    .side-collapsed .side-lang .lang-pills { flex-direction: column; }
    .side-collapsed .me-card { justify-content: center; padding: .45rem 0; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.appbar {
    position: sticky; top: 0; z-index: 1030; height: 58px; padding: 0 .6rem 0 .9rem;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--line);
}
.appbar .brand { padding: 0; }

.page { width: 100%; max-width: 1240px; padding: 2rem 2.25rem 3rem; }
@media (max-width: 991.98px) { .page { padding: 1.25rem 1rem calc(88px + env(safe-area-inset-bottom)); } }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; justify-content: space-around;
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-top: 1px solid var(--line);
}
.tab { flex: 1; max-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .3rem 0; color: var(--faint); font-size: .66rem; font-weight: 500; }
.tab i { font-size: 1.2rem; line-height: 1; }
.tab.active { color: var(--ink); font-weight: 600; }

/* ===== Page header ====================================================== */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.75rem; }
.page-head h1 { font-size: 1.85rem; margin: 0; line-height: 1.15; }
.page-head .lede { color: var(--muted); margin: .35rem 0 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) {
    .page-head h1 { font-size: 1.45rem; }
    .page-head .actions { width: 100%; }
    .page-head .actions > * { flex: 1; }
}
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs i { font-size: .6rem; color: var(--faint); }
.date-chip { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .55rem; font-size: .8rem; color: var(--muted); }

/* ===== Panels =========================================================== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: .98rem; margin: 0; letter-spacing: -.02em; }
.panel-head .hint { font-size: .78rem; color: var(--muted); }
.panel-head a.more { font-size: .8rem; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: .25rem; }
.panel-head a.more::after { content: "→"; transition: transform .15s; }
.panel-head a.more:hover { color: var(--ink); }
.panel-head a.more:hover::after { transform: translateX(2px); }
.panel-body { padding: 1.25rem; }
.panel-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 1199.98px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 1.1rem 1.2rem; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.kpi-label { font-size: .8rem; font-weight: 500; color: var(--muted); }
.kpi-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: .95rem; background: var(--sunken); color: var(--text-2); }
.kpi-icon.i-absent { color: var(--danger); background: var(--danger-soft); }
.kpi-value { font-size: 2rem; font-weight: 650; letter-spacing: -.04em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.kpi-split { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
@media (max-width: 575.98px) { .kpi { padding: .95rem 1rem; } .kpi-value { font-size: 1.6rem; } .kpi-icon { display: none; } }

.delta-row { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; margin-top: .5rem; }
.delta { display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .45rem; border-radius: 6px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.delta.up { background: var(--brand-soft); color: var(--brand); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--sunken); color: var(--text-2); }
.delta-row .kpi-sub { margin: 0; }

/* Ring chart: <div class="ring tone-good" style="--p:87"><span>87%</span></div> */
.ring { --size: 68px; --thick: 6px; --ring-c: var(--ink); position: relative; width: var(--size); height: var(--size); flex-shrink: 0; display: grid; place-items: center; }
.ring::before, .ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px)); mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px)); }
.ring::before { background: var(--track); }
.ring::after { background: conic-gradient(var(--ring-c) calc(var(--p, 0) * 1%), transparent 0); }
.ring > span { position: relative; font-weight: 650; font-size: .9rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.ring-sm { --size: 50px; --thick: 5px; }
.ring-sm > span { font-size: .74rem; }
.ring.tone-good { --ring-c: var(--brand); }
.ring.tone-warn { --ring-c: var(--ink); }
.ring.tone-bad { --ring-c: var(--danger); }
.ring.tone-none { --ring-c: transparent; }

.part-rings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 576px) and (max-width: 1199.98px) { .part-rings { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.part-ring { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .5rem; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.part-ring b { font-weight: 600; font-size: .86rem; }
.part-ring small { color: var(--muted); font-size: .72rem; display: block; margin-top: -.35rem; }

/* Hero (next event): an ink card, the one strong surface on the page. */
.hero {
    position: relative; overflow: hidden; padding: 1.5rem 1.6rem; margin-bottom: 1.25rem;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem;
    background: #0a0a0b; color: #fafafa; border: 1px solid #0a0a0b; box-shadow: var(--shadow-md);
}
[data-bs-theme="dark"] .hero { background: #1b1b1f; border-color: var(--line-strong); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px 200px at 100% 0%, rgba(255,255,255,.08), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: #a1a1aa; }
.hero-title { font-size: 1.6rem; font-weight: 650; letter-spacing: -.035em; margin: .3rem 0 .55rem; color: #fafafa; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; color: var(--muted); font-size: .85rem; }
.hero-meta i { margin-right: .3rem; }
.hero .hero-meta { color: #a1a1aa; }
.hero .badge-x { background: rgba(255,255,255,.08); color: #e4e4e7; }
.hero .btn-primary { --bs-btn-bg: #fafafa; --bs-btn-color: #0a0a0b; --bs-btn-border-color: #fafafa; --bs-btn-hover-bg: #ffffff; --bs-btn-hover-color: #0a0a0b; --bs-btn-hover-border-color: #fff; --bs-btn-active-bg: #e4e4e7; --bs-btn-active-color: #0a0a0b; }
.hero-side { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.hero-ring { display: flex; align-items: center; gap: .65rem; padding: .4rem .85rem .4rem .45rem; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.hero-ring b { display: block; font-size: 1rem; line-height: 1.1; color: #fafafa; font-variant-numeric: tabular-nums; }
.hero-ring small { color: #a1a1aa; font-size: .72rem; }
.hero-ring .ring > span { color: #fafafa; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.hero .hero-live { color: #93b4ff; }
.hero .hero-live::before { background: #5b8cff; }
@media (max-width: 575.98px) { .hero { padding: 1.25rem; } .hero-title { font-size: 1.35rem; } .hero-side, .hero-actions, .hero-ring { width: 100%; } .hero-actions .btn { flex: 1; } }

/* ===== Buttons ========================================================== */
.btn {
    --bs-btn-font-weight: 550; --bs-btn-padding-x: .95rem; --bs-btn-padding-y: .5rem; --bs-btn-font-size: .86rem;
    --bs-btn-border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-lg { --bs-btn-padding-y: .68rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: .92rem; --bs-btn-border-radius: 10px; }
.btn-sm { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: 8px; }
.btn-primary {
    --bs-btn-color: var(--on-action); --bs-btn-bg: var(--action); --bs-btn-border-color: var(--action);
    --bs-btn-hover-color: var(--on-action); --bs-btn-hover-bg: var(--action-hover); --bs-btn-hover-border-color: var(--action-hover);
    --bs-btn-active-color: var(--on-action); --bs-btn-active-bg: var(--action-hover); --bs-btn-active-border-color: var(--action-hover);
    --bs-btn-disabled-color: var(--on-action); --bs-btn-disabled-bg: var(--action); --bs-btn-disabled-border-color: var(--action);
    box-shadow: var(--shadow-xs);
}
.btn-outline {
    --bs-btn-bg: var(--surface); --bs-btn-color: var(--text); --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-active-bg: var(--sunken); --bs-btn-active-border-color: var(--line-strong); --bs-btn-active-color: var(--ink);
    box-shadow: var(--shadow-xs);
}
.btn-ghost { --bs-btn-color: var(--text-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-active-bg: var(--sunken); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; }
.btn-danger-soft { --bs-btn-color: var(--danger); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--danger-soft); --bs-btn-hover-color: var(--danger); --bs-btn-hover-border-color: var(--danger-line); }
.btn-glass { --bs-btn-color: #fafafa; --bs-btn-bg: transparent; --bs-btn-border-color: rgba(255,255,255,.22); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255,255,255,.08); --bs-btn-hover-border-color: rgba(255,255,255,.35); --bs-btn-active-color: #fff; --bs-btn-active-bg: rgba(255,255,255,.12); }
.btn-icon { --bs-btn-padding-x: 0; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-close { opacity: .45; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }

/* ===== Forms ============================================================ */
.form-label { font-size: .82rem; font-weight: 550; color: var(--text-2); margin-bottom: .4rem; }
.form-control, .form-select {
    font-size: .9rem; padding: .55rem .8rem; border-radius: 9px;
    background-color: var(--surface); border: 1px solid var(--line-strong); color: var(--text); box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--faint); }
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10, 10, 11, .08); background-color: var(--surface); color: var(--text); }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .1); }
.form-control-sm, .form-select-sm { padding: .38rem .7rem; font-size: .82rem; border-radius: 8px; }
.form-check-input { border-color: var(--line-strong); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
[data-bs-theme="dark"] .form-check-input:checked[type=checkbox] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2309090b' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
[data-bs-theme="dark"] .form-check-input:checked[type=radio] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%2309090b'/%3e%3c/svg%3e"); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(10, 10, 11, .1); border-color: var(--ink); }
.form-switch .form-check-input { width: 2.2em; height: 1.2em; }
.field-error, .field-validation-error { display: block; font-size: .78rem; color: var(--danger); margin-top: .3rem; }
.input-validation-error { border-color: var(--danger) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none !important; }
.flash.validation-summary-errors { flex-direction: column; gap: .25rem; }

.form-section { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem 2.5rem; padding: 1.5rem 1.25rem; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section h3 { font-size: .95rem; margin: 0 0 .3rem; letter-spacing: -.02em; }
.form-section p { font-size: .82rem; color: var(--muted); margin: 0; }
@media (max-width: 991.98px) { .form-section { grid-template-columns: 1fr; gap: 1rem; } }
.form-narrow { max-width: 920px; }

.search { position: relative; }
.search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .form-control { padding-left: 2.3rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 240px; max-width: 360px; }
.toolbar .form-select { width: auto; }
@media (max-width: 575.98px) { .toolbar .search { max-width: none; } .toolbar .form-select { flex: 1; } }

/* Choice cards */
.choice { display: flex; gap: .7rem; padding: .85rem .95rem; height: 100%; cursor: pointer; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: var(--faint); }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice b { display: block; font-weight: 600; font-size: .86rem; }
.choice span { display: block; font-size: .78rem; color: var(--muted); }
.choice .form-check-input { margin-top: .15rem; flex-shrink: 0; }

/* ===== Tabs & pills ===================================================== */
.tabs { display: flex; gap: 1.25rem; padding: 0 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .85rem 0 .75rem; color: var(--muted); font-weight: 500; font-size: .86rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill {
    display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .75rem; border-radius: 999px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
    font-size: .8rem; font-weight: 500; cursor: pointer; user-select: none; transition: background .15s, color .15s, border-color .15s;
}
.pill:hover { background: var(--hover); color: var(--ink); }
.pill.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill i { opacity: .7; }

/* ===== Badges: neutral; colour only for Present (blue) and Absent (red) */
.badge-x {
    display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 6px;
    font-size: .73rem; font-weight: 550; line-height: 1.5; white-space: nowrap;
    background: var(--sunken); color: var(--text-2);
}
.badge-x i { font-size: .72rem; opacity: .8; }
.badge-present { background: var(--brand-soft); color: var(--brand); }
.badge-absent { background: var(--danger-soft); color: var(--danger); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-present { background: var(--brand); }
.dot-excused { background: var(--excused-solid); }
.dot-absent { background: var(--danger); }
.dot-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }

/* ===== Avatars & logo (neutral) ======================================== */
.avatar {
    width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
    font-size: .72rem; font-weight: 600; letter-spacing: .02em; color: var(--text-2);
    background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
}
.avatar-sm { width: 30px; height: 30px; font-size: .66rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; color: var(--ink); }
.avatar-sq { border-radius: 8px; }
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }

.logo-badge { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: inset 0 0 0 1px var(--line), var(--shadow-xs); }
.logo-badge img { width: 86%; height: 86%; object-fit: contain; }
.logo-sm { width: 34px; height: 34px; }
.logo-lg { width: 56px; height: 56px; }

/* ===== Lists & tables =================================================== */
.list-row { display: flex; align-items: center; gap: .9rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); color: inherit; transition: background .15s; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); color: inherit; }
a.list-row:hover .chev { color: var(--ink); transform: translateX(2px); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 550; color: var(--ink); }
.list-row .meta { font-size: .8rem; color: var(--muted); }
.list-row .chev { color: var(--faint); transition: transform .15s, color .15s; }
.panel > .list-row:last-child { border-radius: 0 0 var(--r-xl) var(--r-xl); }
.list-group-label { padding: .5rem 1.25rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin: 0; font-size: .87rem; }
.table > :not(caption) > * > * { padding: .8rem 1.25rem; border-color: var(--line); }
.table thead th { background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 550; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--surface-2); --bs-table-color-state: var(--text); }
tr[data-href] { cursor: pointer; }

.date-tile { width: 48px; flex-shrink: 0; text-align: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.date-tile .dw { font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: .2rem 0 0; color: var(--muted); }
.date-tile .dd { font-size: 1.15rem; font-weight: 650; letter-spacing: -.03em; padding: 0 0 .25rem; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.date-tile.today { background: var(--ink); border-color: var(--ink); }
.date-tile.today .dw { color: var(--faint); }
.date-tile.today .dd { color: var(--bg); }
.cancelled .title { text-decoration: line-through; color: var(--muted); }

/* Bars */
.bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar-thin { height: 4px; }
.bar .s-present { background: var(--brand); }
.bar .s-excused { background: var(--excused-solid); opacity: .5; }
.bar .s-absent { background: var(--danger); }
.bar > span + span { margin-left: 2px; }
.bar .tone-good { background: var(--brand); }
.bar .tone-warn { background: var(--ink); }
.bar .tone-bad { background: var(--danger); }
.rate { display: flex; align-items: center; gap: .6rem; min-width: 140px; }
.rate .bar { flex: 1; }
.rate b { font-size: .82rem; width: 2.8em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ===== Roll call ======================================================== */
.roll-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.roll-stat { padding: 1rem 1.25rem; border-right: 1px solid var(--line); }
.roll-stat:nth-child(4) { border-right: 0; }
.roll-stat .lbl { display: flex; align-items: center; gap: .45rem; font-size: .76rem; color: var(--muted); }
.roll-stat .num { font-size: 1.6rem; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .15rem; color: var(--ink); }
.roll-progress { grid-column: 1 / -1; height: 3px; border-radius: 0; }
.roll-progress > span { transition: width .35s cubic-bezier(.2, .8, .2, 1); margin: 0 !important; }
@media (max-width: 575.98px) { .roll-stat { padding: .7rem .75rem; } .roll-stat .num { font-size: 1.25rem; } .roll-stat .lbl { font-size: .66rem; gap: .3rem; } }

.roll-tools {
    position: sticky; top: 0; z-index: 1020; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    padding: .8rem 1.25rem; border-bottom: 1px solid var(--line);
    background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
@media (max-width: 991.98px) { .roll-tools { top: 58px; } }
.roll-tools .search { flex: 1 1 200px; }

.roll-section { padding: 1rem 1.25rem 1.25rem; border-bottom: 1px solid var(--line); }
.roll-section:last-child { border-bottom: 0; }
.roll-section-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.roll-section-head .n { font-size: .76rem; color: var(--muted); font-weight: 500; }
.roll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .7rem; }

.roll-card { position: relative; padding: .8rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.roll-card.unmarked { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); }
.roll-card.is-present { border-color: var(--brand-line); }
.roll-card.is-excused { border-color: var(--line-strong); }
.roll-card.is-absent { border-color: var(--danger-line); }
.roll-card .head { display: flex; align-items: center; gap: .65rem; }
.roll-card .name { font-weight: 550; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roll-card .name:hover { text-decoration: underline; }
.roll-card .sub { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roll-card .sub.excuse { color: var(--text-2); font-weight: 550; }
.roll-card .note-input { margin-top: .6rem; }
.roll-card.pop { animation: pop .5s ease; }
@keyframes pop { 30% { box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .18); } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-top: .7rem; padding: 2px; border-radius: 10px; background: var(--sunken); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
    display: flex; align-items: center; justify-content: center; gap: .35rem; height: 36px; border-radius: 8px; cursor: pointer;
    color: var(--muted); font-size: .8rem; font-weight: 550; user-select: none; transition: background .15s, color .15s, box-shadow .15s;
}
.seg label i { font-size: .8rem; }
.seg label:hover { color: var(--ink); }
.seg input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 1px; }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line-strong); }
.seg input.s-present:checked + label { background: var(--brand); color: #fff; box-shadow: none; }
.seg input.s-absent:checked + label { background: var(--danger); color: #fff; box-shadow: none; }
[data-bs-theme="dark"] .seg input.s-present:checked + label, [data-bs-theme="dark"] .seg input.s-absent:checked + label { color: #09090b; }
@media (max-width: 420px) { .seg label { font-size: .72rem; gap: .25rem; } }

.reason { margin-top: .6rem; padding: .6rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); animation: rise .2s both; }
.reason-label { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .45rem; }
.reason-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.reason-chips input { position: absolute; opacity: 0; pointer-events: none; }
.reason-chips label {
    display: inline-flex; align-items: center; gap: .3rem; padding: .28rem .6rem; border-radius: 999px; cursor: pointer; user-select: none;
    font-size: .76rem; font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); transition: background .15s, color .15s, border-color .15s;
}
.reason-chips label:hover { border-color: var(--faint); }
.reason-chips input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 1px; }
.reason-chips input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.reason-detail { margin-top: .5rem; }
.roll-card.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important; animation: shake .35s; }
.roll-card.invalid .reason { border-color: var(--danger-line); background: var(--danger-soft); }
.roll-card.invalid .reason-label { color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.qr-tag { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .58rem; color: var(--bg); background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }

.save-bar {
    position: sticky; bottom: 1rem; z-index: 1020; margin-top: 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .6rem .6rem .6rem 1.1rem; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
}
.save-bar .msg { font-size: .85rem; opacity: .85; }
.save-bar .btn-primary { --bs-btn-bg: var(--bg); --bs-btn-color: var(--ink); --bs-btn-border-color: var(--bg); --bs-btn-hover-bg: var(--surface); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--surface); }
@media (max-width: 991.98px) { .save-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ===== Messages ========================================================= */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; margin: 0 auto .9rem; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--sunken); color: var(--text-2); }
.empty h3 { font-size: .98rem; margin-bottom: .3rem; }
.empty p { font-size: .85rem; margin: 0 auto; max-width: 360px; }

.flash { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem 1rem; margin-bottom: 1.25rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: .87rem; color: var(--text-2); box-shadow: var(--shadow-xs); }
.flash i { font-size: 1rem; margin-top: .05rem; color: var(--ink); }
.flash .btn-close { margin-left: auto; font-size: .65rem; }
.flash-err { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.flash-err i { color: var(--danger); }

.toasts { position: fixed; top: 18px; right: 18px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: min(400px, calc(100vw - 24px)); }
.toast-x {
    position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: .6rem; padding: .8rem .95rem; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: .86rem; font-weight: 500; color: var(--text);
    animation: toastIn .3s cubic-bezier(.2, .8, .2, 1) both;
}
.toast-x i { font-size: 1rem; color: var(--ink); }
.toast-x.err i { color: var(--danger); }
.toast-x .btn-close { margin-left: auto; font-size: .6rem; flex-shrink: 0; }
.toast-x[data-autohide]::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--ink); opacity: .2; transform-origin: left; animation: toastTimer 4.5s linear forwards; }
.toast-x.hide { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
@keyframes toastTimer { to { transform: scaleX(0); } }
@media (max-width: 991.98px) { .toasts { top: 68px; left: 12px; right: 12px; max-width: none; } }

.live-dot { display: inline-flex; align-items: center; gap: .4rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); flex-shrink: 0; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb), .5); } 70% { box-shadow: 0 0 0 7px rgba(var(--brand-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb), 0); } }
.flash .live-dot { margin-top: .1rem; }

.dropdown-menu {
    --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-color: var(--text-2);
    --bs-dropdown-link-hover-bg: var(--hover); --bs-dropdown-link-hover-color: var(--ink); --bs-dropdown-link-active-bg: var(--sunken);
    --bs-dropdown-link-active-color: var(--ink); --bs-dropdown-font-size: .86rem; --bs-dropdown-divider-bg: var(--line);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: .35rem; min-width: 236px;
}
.dropdown-item { border-radius: 8px; padding: .5rem .6rem; font-weight: 500; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { color: var(--muted); width: 1rem; }
.dropdown-item .form-switch { margin: 0 0 0 auto; padding: 0; min-height: 0; }
.dropdown-item .form-switch .form-check-input { margin: 0; pointer-events: none; float: none; }
.dropdown-header { font-size: .76rem; color: var(--muted); padding: .5rem .6rem .35rem; }
.dropdown-header b { display: block; color: var(--ink); font-size: .88rem; font-weight: 600; }

.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.3rem; padding: 0 .35rem; border-radius: 5px; font: 500 .66rem/1 var(--mono); color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); }

.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 1.1rem; padding: 1.4rem 1.5rem; }
.profile h1 { font-size: 1.55rem; margin: 0 0 .35rem; }
.profile .info { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; color: var(--muted); font-size: .85rem; }
.profile .info i { margin-right: .3rem; }

/* ===== Language switch ================================================== */
.lang-switch { display: grid; gap: 2px; }
.lang-opt { display: flex; align-items: center; gap: .6rem; padding: .42rem .5rem; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: .86rem; }
.lang-opt b { display: inline-grid; place-items: center; width: 26px; height: 19px; border-radius: 5px; font-size: .62rem; letter-spacing: .04em; background: var(--sunken); color: var(--muted); }
.lang-opt:hover { background: var(--hover); color: var(--ink); }
.lang-opt.active { color: var(--ink); font-weight: 600; }
.lang-opt.active b { background: var(--ink); color: var(--bg); }
.lang-opt.active::after { content: "\F26E"; font-family: "bootstrap-icons"; margin-left: auto; }
.lang-pills { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); }
.lang-pills a { padding: .16rem .55rem; border-radius: 6px; font-size: .7rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.lang-pills a:hover { color: var(--ink); }
.lang-pills a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }

/* ===== Quick search (command palette) =================================== */
.palette { position: fixed; inset: 0; z-index: 1100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 11, .32); opacity: 0; transition: opacity .15s; }
.palette-box {
    position: relative; width: 100%; max-width: 600px; max-height: 70vh; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
    transform: translateY(-6px) scale(.985); opacity: 0; transition: transform .16s cubic-bezier(.2, .8, .2, 1), opacity .14s;
}
.palette.show .palette-backdrop { opacity: 1; }
.palette.show .palette-box { transform: none; opacity: 1; }
.palette-input { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); }
.palette-input > i { font-size: 1.05rem; color: var(--muted); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1rem; }
.palette-input input::placeholder { color: var(--faint); }
.palette-input .kbd { cursor: pointer; }
.palette-list { overflow-y: auto; padding: .35rem; }
.palette-group { padding: .6rem .7rem .3rem; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.palette-item { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 8px; color: var(--text); }
.palette-item.active { background: var(--sunken); }
.palette-item .p-ic { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--sunken); color: var(--text-2); }
.palette-item.active .p-ic { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.palette-item .p-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.palette-item .p-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .p-meta { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .p-enter { color: var(--muted); opacity: 0; }
.palette-item.active .p-enter { opacity: 1; }
.palette-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2.25rem 1rem; color: var(--muted); }
.palette-foot { display: flex; gap: 1rem; padding: .6rem 1.1rem; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); background: var(--surface-2); }
.palette-foot span { display: inline-flex; align-items: center; gap: .3rem; }
@media (max-width: 575.98px) { .palette { padding-top: 5vh; } .palette-foot { display: none; } }
html.palette-open { overflow: hidden; }

/* ===== Dashboard bento & trend chart ==================================== */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem; }
.bento > * { min-width: 0; }
.bento-chart { grid-column: span 8; display: flex; flex-direction: column; }
.bento-chart > .panel-body { flex: 1; display: flex; align-items: center; }
.bento-chart > .panel-body > * { width: 100%; }
.bento-parts { grid-column: span 4; }
.bento-upcoming { grid-column: span 7; }
.bento-attention { grid-column: span 5; grid-row: span 2; align-self: start; }
.bento-recent { grid-column: span 7; }
@media (max-width: 1199.98px) { .bento-chart, .bento-parts, .bento-upcoming, .bento-attention, .bento-recent { grid-column: 1 / -1; grid-row: auto; } }
.bento-parts .part-rings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 576px) and (max-width: 1199.98px) { .bento-parts .part-rings { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.trend { width: 100%; height: auto; display: block; overflow: visible; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--faint); font: 500 10.5px var(--font); }
.trend .avg { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 4; }
.trend .line { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 1s .1s cubic-bezier(.2, .8, .2, 1) forwards; }
.trend .fill-top { stop-color: var(--brand); stop-opacity: .12; }
.trend .fill-bottom { stop-color: var(--brand); stop-opacity: 0; }
.trend .area { animation: fadeIn .6s .4s both; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.trend .pt { cursor: pointer; }
.trend .hit { fill: transparent; }
.trend .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; animation: fadeIn .3s both; animation-delay: calc(.5s + var(--i) * 35ms); transition: r .12s; }
.trend .dot.tone-bad { stroke: var(--danger); }
.trend .val { fill: var(--ink); font: 650 11px var(--font); opacity: 0; transition: opacity .12s; pointer-events: none; }
.trend .pt:hover .dot, .trend .pt:focus .dot { r: 5.5; }
.trend .pt:hover .val, .trend .pt:focus .val { opacity: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .76rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { display: inline-block; width: 16px; height: 2px; border-radius: 2px; }
.swatch.line { background: var(--brand); }
.swatch.avg { background: repeating-linear-gradient(90deg, var(--faint) 0 3px, transparent 3px 6px); }
@media (prefers-reduced-motion: reduce) { .trend .line { stroke-dashoffset: 0; } }

/* ===== QR check-in: presenter screen ===================================== */
.checkin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1099.98px) { .checkin-grid { grid-template-columns: 1fr; } }
.qr-stage { padding: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; text-align: center; }
.qr-head { display: flex; align-items: center; gap: .85rem; text-align: left; align-self: stretch; }
.qr-title { font-size: 1.35rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.2; color: var(--ink); }
.qr-box { width: min(100%, 420px); aspect-ratio: 1; display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 16px; border: 1px solid var(--line); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-box.flip { animation: fadeIn .35s ease; }
.qr-timer { display: flex; align-items: center; gap: .8rem; width: min(100%, 420px); }
.qr-timer .bar .tone-accent { background: var(--ink); }
.qr-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.25rem; font-size: .85rem; color: var(--text-2); }
.qr-steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: .4rem; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: .68rem; }
.qr-stage:fullscreen { justify-content: center; background: var(--bg); border-radius: 0; }
.qr-stage:fullscreen .qr-box { width: min(70vh, 80vw); }
.qr-stage:fullscreen .qr-title { font-size: 2.2rem; }
.qr-stage:fullscreen .qr-head { justify-content: center; align-self: center; }
.list-row.fresh { animation: freshIn .8s ease; }
@keyframes freshIn { from { background: var(--brand-soft); } }

/* ===== Public check-in page (phone) ====================================== */
.public { width: 100%; max-width: 500px; margin: 0 auto; padding: 1.25rem 1rem calc(7rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .9rem; }
.pub-brand { display: flex; align-items: center; gap: .7rem; padding: .25rem .25rem .5rem; }
.glass { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pub-event { padding: 1.3rem 1.2rem; border-radius: var(--r-xl); text-align: center; }
.pub-event h1 { font-size: 1.5rem; margin: .6rem 0 .45rem; }
.pub-event .hero-meta { justify-content: center; }
.pub-card { padding: 1.4rem 1.2rem; border-radius: var(--r-xl); overflow: hidden; }
.pub-card h2 { font-size: 1.25rem; }
.pub-icon { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; background: var(--sunken); color: var(--ink); }
.pub-name { font-size: 1.4rem; font-weight: 650; letter-spacing: -.03em; margin: .25rem 0 .5rem; color: var(--ink); }
.who-list { border-top: 1px solid var(--line); }
.who-item { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .75rem 1.1rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 550; font-size: .95rem; transition: background .12s; }
.who-item:hover { background: var(--surface-2); }
.who-item .tick { color: var(--ink); font-size: 1.15rem; opacity: 0; transform: scale(.6); transition: all .15s; }
.who-item.selected { background: var(--sunken); }
.who-item.selected .tick { opacity: 1; transform: none; }
.pub-submit { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)); background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-top: 1px solid var(--line); }
.pub-submit .btn { max-width: 468px; margin: 0 auto; display: flex; }
.success-mark { width: 84px; height: 84px; margin: .25rem auto 1rem; }
.success-mark svg { width: 100%; height: 100%; }
.success-mark circle { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s .1s ease forwards; }
.success-mark path { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .55s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .success-mark circle, .success-mark path { stroke-dashoffset: 0; } }

/* ===== Sign in =========================================================== */
.auth-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth {
    width: 100%; max-width: 960px; min-height: 560px; border-radius: 20px; overflow: hidden;
    display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
    animation: rise .4s cubic-bezier(.2, .7, .2, 1) both;
}
.auth-art {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    margin: 8px; padding: 2rem; border-radius: 14px; color: #fafafa; background: #0a0a0b;
}
.auth-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(500px 300px at 100% 0%, rgba(255,255,255,.09), transparent 70%); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art .staff { position: absolute; left: -10%; right: -10%; top: 42%; opacity: .12; z-index: 0; transform: rotate(-6deg); }
.auth-art .staff span { display: block; height: 1px; background: #fff; margin: 15px 0; }
.auth-art h2 { color: #fafafa; font-size: 1.85rem; line-height: 1.15; max-width: 360px; }
.auth-art p { color: #a1a1aa; max-width: 360px; margin: 0; }
.auth-art .chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.1rem; }
.auth-art .chips span { padding: .25rem .6rem; border-radius: 6px; font-size: .74rem; font-weight: 500; color: #d4d4d8; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.auth-form { position: relative; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2.25rem; }
.auth-box { width: 100%; max-width: 340px; }
.auth-box h1 { font-size: 1.65rem; margin-bottom: .35rem; }
.auth-lang { position: absolute; top: 1.1rem; right: 1.1rem; }
@media (max-width: 767.98px) {
    .auth { grid-template-columns: 1fr; max-width: 420px; min-height: 0; }
    .auth-art { display: none; }
    .auth-form { padding: 2rem 1.5rem; }
}

/* Legend for ring colours */
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1rem; margin-top: 1rem; font-size: .75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.key { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 2.5px currentColor; }
.key-good { color: var(--brand); }
.key-warn { color: var(--ink); }
.key-bad { color: var(--danger); }

/* =========================================================================
   ACCENT LAYER — calm base, a deliberate touch of colour
   blue   = brand: actions, navigation, selection, charts
   green  = present / healthy (85%+)
   amber  = excused / watch (70–84%)
   red    = absent / needs attention (below 70%)
   soft tints identify voice parts and event types
   ========================================================================= */
:root, [data-bs-theme="light"] {
    --brand: #2563eb; --brand-2: #4f46e5; --brand-soft: #eef3ff; --brand-line: #c9d8fd;
    --ok: #16a34a;   --ok-soft: #ecfdf3;   --ok-line: #bbf7d0;
    --warn: #d97706; --warn-soft: #fffbeb; --warn-line: #fde68a;
    --excused-solid: var(--warn);
    --action: #2563eb; --action-hover: #1d4ed8; --on-action: #ffffff;
    --hero: linear-gradient(120deg, #0f1d4a 0%, #1e3a8a 45%, #2f4fd6 100%);
    --t-blue: #2563eb;  --t-blue-bg: #eef3ff;
    --t-teal: #0d9488;  --t-teal-bg: #ecfdf8;
    --t-violet: #7c3aed; --t-violet-bg: #f3efff;
    --t-rose: #e11d48;  --t-rose-bg: #fff0f3;
    --t-orange: #ea580c; --t-orange-bg: #fff4ec;
    --t-sky: #0284c7;   --t-sky-bg: #edf7ff;
}
[data-bs-theme="dark"] {
    --brand: #6d95ff; --brand-2: #8b7dff; --brand-soft: #172447; --brand-line: #2a3f7a;
    --ok: #4ade80;   --ok-soft: #10281a;   --ok-line: #1e4d31;
    --warn: #fbbf24; --warn-soft: #2b2108; --warn-line: #5a430f;
    --action: #3d6bff; --action-hover: #5a82ff; --on-action: #ffffff;
    --hero: linear-gradient(120deg, #0d1736 0%, #18307a 50%, #2a46c4 100%);
    --t-blue: #8fb0ff;  --t-blue-bg: #172447;
    --t-teal: #5eead4;  --t-teal-bg: #0d2a27;
    --t-violet: #c4b5fd; --t-violet-bg: #221a40;
    --t-rose: #fda4af;  --t-rose-bg: #331820;
    --t-orange: #fdba74; --t-orange-bg: #33200f;
    --t-sky: #7dd3fc;   --t-sky-bg: #0f2638;
}

/* Background: a soft blue wash at the top */
.backdrop::before { background:
    radial-gradient(900px 420px at 15% -120px, rgba(37, 99, 235, .10), transparent 70%),
    radial-gradient(800px 380px at 90% -160px, rgba(124, 58, 237, .07), transparent 70%); }
[data-bs-theme="dark"] .backdrop::before { background:
    radial-gradient(900px 420px at 15% -120px, rgba(61, 107, 255, .16), transparent 70%),
    radial-gradient(800px 380px at 90% -160px, rgba(139, 125, 255, .10), transparent 70%); }

/* Actions & selection in brand blue */
.btn-primary { background-image: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0)); box-shadow: 0 1px 2px rgba(37, 99, 235, .25), 0 4px 12px -4px rgba(37, 99, 235, .45); }
.side-link.active { background: var(--brand-soft); color: var(--brand); }
.side-link.active i { color: var(--brand); }
.tab.active { color: var(--brand); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
[data-bs-theme="dark"] .form-check-input:checked[type=checkbox] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
[data-bs-theme="dark"] .form-check-input:checked[type=radio] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e"); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15); }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.date-tile.today { background: var(--brand); border-color: var(--brand); }
.date-tile.today .dw { color: rgba(255,255,255,.75); }
.date-tile.today .dd { color: #fff; }
.grad-text { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lang-pills a.active { color: var(--brand); }
.lang-opt.active b { background: var(--brand); color: #fff; }
.palette-item.active { background: var(--brand-soft); }
.palette-item.active .p-ic { color: var(--brand); }
.qr-steps b, .qr-tag { background: var(--brand); color: #fff; }
.qr-timer .bar .tone-accent { background: var(--brand); }
.toast-x[data-autohide]::after { background: var(--brand); opacity: .6; }
.toast-x.ok i, .flash-ok i { color: var(--ok); }
.panel-head a.more { color: var(--brand); }
.list-row .chev { color: var(--faint); }
a.list-row:hover .chev { color: var(--brand); }

/* KPI icons: soft tinted chips */
.kpi-icon { background: var(--brand-soft); color: var(--brand); }
.kpi-icon.i-excused { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.i-absent { background: var(--danger-soft); color: var(--danger); }

/* Statuses: green / amber / red */
.badge-present { background: var(--ok-soft); color: var(--ok); }
.badge-excused { background: var(--warn-soft); color: var(--warn); }
.dot-present { background: var(--ok); }
.dot-excused { background: var(--warn); }
.bar .s-present, .bar .tone-good { background: var(--ok); }
.bar .s-excused, .bar .tone-warn { background: var(--warn); opacity: 1; }
.ring.tone-good { --ring-c: var(--ok); }
.ring.tone-warn { --ring-c: var(--warn); }
.key-good { color: var(--ok); }
.key-warn { color: var(--warn); }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.live-dot { color: var(--ok); }
.live-dot::before { background: var(--ok); animation-name: livePulseOk; }
@keyframes livePulseOk { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); } 70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

.roll-card.is-present { border-color: var(--ok-line); }
.roll-card.is-excused { border-color: var(--warn-line); }
.seg input.s-present:checked + label { background: var(--ok); color: #fff; }
.seg input.s-excused:checked + label { background: var(--warn); color: #fff; box-shadow: none; }
[data-bs-theme="dark"] .seg input.s-present:checked + label,
[data-bs-theme="dark"] .seg input.s-excused:checked + label { color: #09090b; }
.reason { background: var(--warn-soft); border-color: var(--warn-line); }
.reason-label { color: var(--warn); }
.reason-chips input:checked + label { background: var(--warn); border-color: var(--warn); color: #fff; }
.roll-card .sub.excuse { color: var(--warn); }
.trend .dot.tone-good { stroke: var(--ok); }
.trend .dot.tone-warn { stroke: var(--warn); }
.trend .fill-top { stop-opacity: .18; }
.trend .line { stroke: url(#trendStroke) var(--brand); }
.trend .stroke-a { stop-color: var(--brand); }
.trend .stroke-b { stop-color: var(--brand-2); }
.swatch.line { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.success-mark circle { fill: var(--ok-soft); stroke: var(--ok); }
.success-mark path { stroke: var(--ok); }
.list-row.fresh { animation-name: freshOk; }
@keyframes freshOk { from { background: var(--ok-soft); } }

/* Voice parts: soft tints on initials (c0–c5 come from the voice part) */
.avatar.c0 { background: var(--t-rose-bg); color: var(--t-rose); box-shadow: none; }
.avatar.c1 { background: var(--t-violet-bg); color: var(--t-violet); box-shadow: none; }
.avatar.c2 { background: var(--t-blue-bg); color: var(--t-blue); box-shadow: none; }
.avatar.c3 { background: var(--t-teal-bg); color: var(--t-teal); box-shadow: none; }
.avatar.c4 { background: var(--t-orange-bg); color: var(--t-orange); box-shadow: none; }
.avatar.c5 { background: var(--t-sky-bg); color: var(--t-sky); box-shadow: none; }

/* Event types: neutral label, coloured icon */
.badge-rehearsal i { color: var(--t-blue); opacity: 1; }
.badge-sectional i { color: var(--t-sky); opacity: 1; }
.badge-service i { color: var(--t-teal); opacity: 1; }
.badge-concert i { color: var(--t-violet); opacity: 1; }
.badge-competition i { color: var(--t-orange); opacity: 1; }
.pill:not(.active) .bi-music-note-beamed { color: var(--t-blue); opacity: 1; }
.pill:not(.active) .bi-people { color: var(--t-sky); opacity: 1; }
.pill:not(.active) .bi-house-heart { color: var(--t-teal); opacity: 1; }
.pill:not(.active) .bi-stars { color: var(--t-violet); opacity: 1; }
.pill:not(.active) .bi-trophy { color: var(--t-orange); opacity: 1; }

/* Hero & sign-in panel: deep blue gradient */
.hero { background: var(--hero); border-color: transparent; box-shadow: 0 18px 40px -18px rgba(30, 58, 138, .55); }
[data-bs-theme="dark"] .hero { background: var(--hero); border-color: transparent; }
.hero::after { background:
    radial-gradient(520px 220px at 95% -10%, rgba(255,255,255,.16), transparent 70%),
    radial-gradient(420px 220px at 30% 140%, rgba(56, 189, 248, .22), transparent 70%); }
.hero-eyebrow, .hero .hero-meta, .hero-ring small { color: rgba(255,255,255,.72); }
.hero .badge-x { background: rgba(255,255,255,.12); color: #fff; }
.hero .badge-x i { color: #fff; }
.hero .hero-live { color: #86efac; }
.hero .hero-live::before { background: #4ade80; }
.hero .btn-primary { background-image: none; box-shadow: 0 8px 20px -8px rgba(0,0,0,.45); --bs-btn-color: #1e3a8a; --bs-btn-hover-color: #1e3a8a; --bs-btn-active-color: #1e3a8a; }
.hero-ring { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
.auth-art { background: var(--hero); }
.auth-art::after { background:
    radial-gradient(500px 300px at 100% 0%, rgba(255,255,255,.16), transparent 70%),
    radial-gradient(420px 300px at 0% 100%, rgba(56, 189, 248, .25), transparent 70%); }
.auth-art p { color: rgba(255,255,255,.75); }
.auth-art .chips span { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }

/* ===== PHP edition: long choir names, copyright footer =================== */
/* The name wraps to two lines and never runs under the collapse button. */
.side-top .brand { flex: 1 1 auto; min-width: 0; padding-right: .35rem; }
.side .brand .lbl { white-space: normal; overflow: hidden; }
.side .brand-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.side .brand-tag { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .logo-badge { flex-shrink: 0; }
.appbar .brand { min-width: 0; flex: 1 1 auto; margin-right: .5rem; }
.appbar .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pub-brand > span:nth-child(2) { min-width: 0; }
.pub-brand .brand-name { overflow-wrap: anywhere; }

.app-footer { margin-top: 2.5rem; padding-top: 1.1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1.5rem; font-size: .75rem; color: var(--muted); }
.app-footer b { color: var(--text-2); font-weight: 650; }
.app-footer.center { justify-content: center; text-align: center; border-top: 0; margin-top: 1.25rem; padding-top: 0; flex-direction: column; align-items: center; }
@media (max-width: 575.98px) { .app-footer { justify-content: center; text-align: center; flex-direction: column; align-items: center; } }
@media print { .app-footer { display: none; } }
/* Footer sits at the bottom of the window on short pages, and below the content on long ones. */
.main > .page { flex: 1 0 auto; display: flex; flex-direction: column; }
.page > .app-footer { margin-top: auto; }
.page > :nth-last-child(2) { margin-bottom: 2.5rem; }

/* ===== Reports ============================================================ */
.report-table th { white-space: nowrap; }
.report-table .rate { min-width: 110px; }
.report-grid { max-height: 70vh; }
.report-grid table { font-size: .8rem; }
.report-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); font-size: .7rem; padding: .5rem .3rem; }
.report-grid td:first-child, .report-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 170px; }
.report-grid thead th:first-child { z-index: 3; }
.grid-cell { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .7rem; font-weight: 700; }
.grid-cell.g-P { background: color-mix(in srgb, var(--present, #16a34a) 16%, transparent); color: var(--present, #16a34a); }
.grid-cell.g-E { background: color-mix(in srgb, var(--excused, #d97706) 18%, transparent); color: var(--excused, #d97706); }
.grid-cell.g-A { background: color-mix(in srgb, var(--absent, #dc2626) 16%, transparent); color: var(--absent, #dc2626); }
.report-filters .choice { align-items: center; }

/* Roles & permissions matrix */
.perm-table th, .perm-table td { padding: .7rem .8rem; }
.perm-table thead th { font-size: .8rem; font-weight: 600; white-space: nowrap; vertical-align: bottom; }
.perm-table thead th .bi { font-size: 1.05rem; color: var(--muted); margin-bottom: .2rem; }
.perm-table td:first-child { min-width: 16rem; }
.perm-table .perm-group th { background: var(--surface-2, rgba(0,0,0,.03)); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .45rem .8rem; }
.perm-table .form-check-input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.perm-table .form-check-input:disabled { cursor: default; opacity: .55; }
.flash-warning { border-color: #f3d38a; background: #fff8e6; color: #7a5200; }
.flash-warning i { color: #b7791f; }
.flash-warning a { color: inherit; font-weight: 600; }
[data-bs-theme="dark"] .flash-warning { border-color: #6b5214; background: #2a2210; color: #f3d38a; }

/* ===== Sign-in screen (1.6.1) ============================================ */
/* Card centred, footer directly under it (not pushed to the bottom of the screen). */
.auth-page { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 2.5rem 1.25rem 1.5rem; }
.auth-page > .app-footer.center { margin: 0; opacity: .85; }
.auth { min-height: 540px; max-width: 940px; border-radius: 22px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 24px 60px -24px rgba(30, 58, 138, .28); }
.auth-art { margin: 10px; padding: 2.1rem 2.1rem 2.25rem; border-radius: 16px; }
.auth-art .logo-badge { box-shadow: 0 0 0 4px rgba(255,255,255,.14); }
.auth-art .staff { top: 36%; opacity: .14; }
.auth-art h2 { font-size: 2rem; letter-spacing: -.02em; margin-bottom: .7rem; }
.auth-art p { font-size: .93rem; line-height: 1.55; }
.art-note { position: absolute; right: -1.5rem; top: 4.5rem; font-size: 11rem; line-height: 1; color: #fff; opacity: .06; z-index: 0 !important; transform: rotate(-12deg); pointer-events: none; }
.art-features { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .65rem; }
.art-features li { display: flex; align-items: center; gap: .7rem; font-size: .86rem; font-weight: 500; color: rgba(255,255,255,.92); }
.art-features li span { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); }
.art-features li i { font-size: .95rem; color: #fff; }

.auth-form { padding: 3rem 2.5rem 2.5rem; }
.auth-box { max-width: 350px; }
.auth-box h1 { font-size: 1.85rem; letter-spacing: -.02em; }
.auth-box .form-label { font-size: .82rem; font-weight: 600; margin-bottom: .35rem; }
.field-icon { position: relative; }
.field-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; pointer-events: none; transition: color .15s; }
.field-icon .form-control { padding-left: 2.6rem; height: 2.85rem; border-radius: 11px; }
.field-icon:focus-within > i { color: var(--brand); }
.field-icon:has(.pw-toggle) .form-control { padding-right: 2.75rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 2.2rem; height: 2.2rem; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn-signin { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 3rem; border-radius: 11px; font-weight: 650; }
.btn-signin i { transition: transform .18s; }
.btn-signin:hover i { transform: translateX(3px); }
.auth-help { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 1.6rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
@media (max-width: 767.98px) {
    .auth-page { justify-content: flex-start; padding-top: 1.5rem; }
    .auth { min-height: 0; }
    .auth-form { padding: 3.25rem 1.5rem 1.75rem; }
}
