/* Bersih: a calm, Apple-HIG-like UI system (see DESIGN.md).
   Plain CSS: link it after the fonts and icons, or @import it into a
   Tailwind v4 entry together with bersih.tailwind.css. Generated from
   RapihOps by tools/extract.py; edit the source there, then re-run it,
   or edit here and carry the change back by hand. */

/* ------------------------------------------------------------------ */
/* Semantic tokens. Light values on :root, dark overrides on .dark.    */
/* Components and utilities both read these vars, so the theme toggle  */
/* re-skins the whole app without per-element dark: classes.           */
/* ------------------------------------------------------------------ */

:root {
    /* v3 "Bersih": a warm-grey canvas, white groups, black-ish ink, and the
       Brand purple kept for exactly three things -- the primary button, the
       active nav item, and progress. */
    --canvas: #f5f5f7;
    --surface: #ffffff;
    --raised: #f0f0f3;
    --fill: #f0f0f3;
    --line: rgba(0, 0, 0, .08);
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --faint: #aeaeb2;

    --brand: #7c3aed;
    --brand-hi: #9b6cf6;
    --brand-lo: #5f21c9;
    --brand-strong: #6d28d9;
    --brand-soft: #f1ebfd;
    --brand-ink: #6d28d9;

    --success: #248a3d;
    --success-soft: #e7f6ee;
    --warning: #c93400;
    --warning-soft: #fdf3e2;
    --danger: #d70015;
    --danger-soft: #fdecec;
    --info: #0071e3;
    --info-soft: #e6f1fd;

    --shadow-card: 0 4px 18px rgba(0, 0, 0, .035);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .14);
    /* Groups carry their edge as a hairline ring rather than a border, so the
       same group reads correctly on the canvas and over a photo. */
    --ring: 0 0 0 1px rgba(0, 0, 0, .08);
    --ring-hover: 0 0 0 1px rgba(0, 0, 0, .14);
    --ring-brand: 0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent);
    --lift: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);

    --radius-card: 18px;
    --radius-control: 12px;
    --ease-out: cubic-bezier(.23, 1, .32, 1);

    --sidebar-width: 236px;
    --topbar-height: 56px;
}

.dark {
    --canvas: #0b0b0d;
    --surface: #1c1c1e;
    --raised: #2a2a2d;
    --fill: #2a2a2d;
    --line: rgba(255, 255, 255, .09);
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --faint: #6e6e73;

    --brand: #8b5cf6;
    --brand-hi: #a78bfa;
    --brand-lo: #6d28d9;
    --brand-strong: #7c3aed;
    --brand-soft: rgba(139, 92, 246, .18);
    --brand-ink: #c4b5fd;

    --success: #30d158;
    --success-soft: rgba(48, 209, 88, .16);
    --warning: #ff9f0a;
    --warning-soft: rgba(255, 159, 10, .16);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, .16);
    --info: #0a84ff;
    --info-soft: rgba(10, 132, 255, .16);

    --shadow-card: 0 4px 18px rgba(0, 0, 0, .35);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55);
    --ring: 0 0 0 1px rgba(255, 255, 255, .08);
    --ring-hover: 0 0 0 1px rgba(255, 255, 255, .14);
    --ring-brand: 0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent);
    --lift: 0 1px 3px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .06);
}


/* The font stack (Tailwind projects also get it from @theme). */
:root { --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* The reset the components assume (the essentials of Tailwind's preflight). */
@layer base {
    *, ::before, ::after { box-sizing: border-box; border: 0 solid; }
    html, body { margin: 0; }
    h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul, fieldset, legend { margin: 0; padding: 0; }
    h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
    ol, ul { list-style: none; }
    button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
    button, [role="button"] { cursor: pointer; background: transparent; }
    img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
    table { border-collapse: collapse; }
}

/* Base                                                                */
/* ------------------------------------------------------------------ */

@layer base {
    html {
        /* Stops mobile browsers from inflating body text in narrow columns. */
        -webkit-text-size-adjust: 100%;
    }

    body {
        font-family: var(--font-sans);
        background-color: var(--canvas);
        color: var(--ink);
        font-size: .9375rem;
        line-height: 1.47;
        letter-spacing: -.01em;
        -webkit-font-smoothing: antialiased;
        /* Long account numbers, URLs and user agents must not widen the page. */
        overflow-wrap: break-word;
    }

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

    /* Nothing embedded may exceed its column: phone-camera photos and
       signatures arrive at native resolution. */
    img, svg, video, canvas, iframe {
        max-width: 100%;
    }

    img, video {
        height: auto;
    }

    ::placeholder {
        color: var(--faint);
    }

    /* The parts nobody draws still carry the design: the caret, the
       selection highlight and the focus ring all take the brand. */
    ::selection {
        background: color-mix(in srgb, var(--brand) 35%, transparent);
        color: var(--ink);
    }

    input, textarea {
        caret-color: var(--brand);
    }

    :focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }

    /* Amounts, counts and codes never shift width as they change. */
    .num, .table td, .stat-value, code {
        font-variant-numeric: tabular-nums;
    }

    /* ---------- Scrollbars ---------- */
    /* The platform default is a heavy grey trough that reads as unstyled next
       to the rest of the UI, and it stays light grey in dark mode. These follow
       the theme tokens instead. Firefox takes the two scrollbar-* properties
       (not inherited, so every scroll container is listed); Chromium and Safari
       take the ::-webkit pseudo-elements, which apply document-wide. */
    html,
    .sidebar-nav,
    .table-responsive,
    .menu-panel {
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--faint) 55%, transparent) transparent;
    }

    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track,
    ::-webkit-scrollbar-corner {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--faint) 45%, transparent);
        border-radius: 999px;
        /* Transparent border + content-box clip insets the thumb, so it reads as
           a floating pill rather than a bar wedged against the content. */
        border: 3px solid transparent;
        background-clip: content-box;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: color-mix(in srgb, var(--faint) 80%, transparent);
        background-clip: content-box;
    }
}

/* ------------------------------------------------------------------ */
/* Components                                                          */
/* ------------------------------------------------------------------ */

@layer components {

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

       One glossy primary per page; everything else is glass or plain text.
       Pressing moves the button down a pixel and darkens it, 120 ms: the
       v3 spec's "turun 1 px", not a scale. */

    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .45rem;
        font-weight: 600;
        font-size: .875rem;
        line-height: 1.2;
        letter-spacing: -.01em;
        border-radius: var(--radius-control);
        border: 0;
        padding: 0 1rem;
        height: 38px;
        min-height: 38px;
        cursor: pointer;
        white-space: nowrap;
        transition-property: background-color, color, box-shadow, translate, filter;
        transition-duration: 120ms;
        transition-timing-function: ease-out;
    }

    .btn:active {
        translate: 0 1px;
        filter: brightness(.92);
    }

    .btn:disabled {
        opacity: .45;
        pointer-events: none;
    }

    .btn-sm {
        height: 32px;
        min-height: 32px;
        padding: 0 .75rem;
        font-size: .8125rem;
        font-weight: 500;
        border-radius: 10px;
    }

    .btn-lg {
        height: 46px;
        min-height: 46px;
        padding: 0 1.4rem;
        font-size: .9375rem;
        border-radius: 14px;
    }

    .btn-primary {
        color: #fff;
        background: linear-gradient(180deg, var(--brand-hi) 0%, var(--brand) 55%, var(--brand-lo) 100%);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .35),
            inset 0 -1px 0 rgba(0, 0, 0, .18),
            0 1px 2px rgba(95, 33, 201, .35),
            0 8px 18px -6px rgba(124, 58, 237, .55);
        text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
    }

    .btn-primary:hover {
        color: #fff;
        filter: brightness(1.05);
    }

    .btn-primary:active {
        filter: brightness(.9);
    }

    .btn-secondary,
    .btn-outline-secondary {
        background: var(--fill);
        color: var(--ink);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 1px var(--line);
    }

    .dark .btn-secondary,
    .dark .btn-outline-secondary {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 0 1px var(--line);
    }

    .btn-secondary:hover,
    .btn-outline-secondary:hover {
        color: var(--ink);
        filter: brightness(.97);
    }

    /* Scope/filter chips: the selected one reads as a soft brand pill. */
    .btn-secondary.active,
    .btn-outline-secondary.active {
        background: var(--brand-soft);
        box-shadow: none;
        color: var(--brand-ink);
    }

    .btn-soft {
        background: var(--brand-soft);
        color: var(--brand-ink);
    }

    .btn-soft:hover {
        color: var(--brand-ink);
        filter: brightness(.96);
    }

    .btn-danger {
        background: var(--danger);
        color: #fff;
    }

    .btn-danger:hover {
        filter: brightness(.92);
        color: #fff;
    }

    .btn-danger-soft {
        background: var(--danger-soft);
        color: var(--danger);
    }

    .btn-danger-soft:hover {
        background: var(--danger);
        color: #fff;
    }

    .btn-warning {
        background: var(--warning);
        color: #fff;
    }

    .btn-warning:hover {
        filter: brightness(.92);
        color: #fff;
    }

    .btn-warning-soft {
        background: var(--warning-soft);
        color: var(--warning);
    }

    .btn-warning-soft:hover {
        background: var(--warning);
        color: #fff;
    }

    .btn-success-soft {
        background: var(--success-soft);
        color: var(--success);
    }

    .btn-success-soft:hover {
        background: var(--success);
        color: #fff;
    }

    .btn-success {
        background: var(--success);
        color: #fff;
    }

    .btn-success:hover {
        filter: brightness(.92);
        color: #fff;
    }

    /* Tertiary: a text button. Same box as any .btn of its size (height,
       padding, radius), so its hover fill is the shape a primary button
       beside it has; the fill is a tint of its own text colour, so a muted or
       danger ghost keeps its colour instead of turning purple. Every text
       action that stands on its own is one of these; links inside a
       sentence stay underlined links. */
    .btn-ghost {
        background: transparent;
        color: var(--brand-ink);
        font-weight: 500;
    }

    .btn-ghost:hover,
    .btn-ghost:focus-visible {
        background: color-mix(in srgb, currentColor 10%, transparent);
    }

    /* White-on-gradient buttons for promo/hero cards. */
    .btn-on-accent {
        background: #fff;
        color: var(--brand-strong);
    }

    .btn-on-accent:hover {
        background: rgba(255, 255, 255, .88);
        color: var(--brand-strong);
    }

    .btn-outline-on-accent {
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
        color: #fff;
    }

    .btn-outline-on-accent:hover {
        background: rgba(255, 255, 255, .16);
        color: #fff;
    }

    .btn-icon {
        border: none;
        background: transparent;
        font-size: 1.25rem;
        color: var(--muted);
        border-radius: 10px;
        padding: .3rem .5rem;
        cursor: pointer;
    }

    .btn-icon:hover {
        background: var(--fill);
        color: var(--ink);
    }

    /* ---------- Cards (groups) ----------

       A card is a v3 group: white, radius 18, hairline ring, a shadow so soft
       it is felt rather than seen. Its header is a label above the content,
       not a bar across it. */

    .card {
        background: var(--surface);
        border-radius: var(--radius-card);
        box-shadow: var(--ring), var(--shadow-card);
        min-width: 0;
        transition-property: box-shadow;
        transition-duration: 150ms;
        transition-timing-function: ease-out;
    }

    a > .card:hover,
    a.card:hover {
        box-shadow: var(--ring-hover), var(--shadow-card);
    }

    /* The one card on a page that asks for a decision. */
    .card-action {
        box-shadow: var(--ring-brand), var(--shadow-card);
    }

    .card-header {
        padding: 1rem 1.25rem .375rem;
        border-bottom: 0;
        font-weight: 600;
        font-size: .9375rem;
        letter-spacing: -.01em;
        display: flex;
        align-items: center;
        gap: .5rem;
        flex-wrap: wrap;
    }

    .card-body {
        padding: 1.25rem;
    }

    .card-header + .card-body {
        padding-top: .75rem;
    }

    .card-footer {
        padding: .9rem 1.25rem;
        border-top: 1px solid var(--line);
    }

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

    .form-label {
        display: inline-block;
        font-size: .8125rem;
        font-weight: 500;
        color: var(--muted);
        letter-spacing: 0;
        margin-bottom: .35rem;
    }

    /* Fields are grey wells, not outlined boxes; focus lifts one to white
       with a brand ring. */
    .form-control,
    .form-select {
        display: block;
        width: 100%;
        background: var(--fill);
        border: 1px solid transparent;
        border-radius: var(--radius-control);
        color: var(--ink);
        font-size: .9375rem;
        letter-spacing: -.005em;
        padding: .5rem .875rem;
        min-height: 40px;
        transition: background-color .15s ease, box-shadow .15s ease;
        appearance: none;
    }

    .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236f7288' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right .65rem center;
        background-repeat: no-repeat;
        background-size: 1.1em;
        padding-right: 2.3rem;
    }

    .form-control:focus,
    .form-select:focus {
        outline: none;
        background: var(--surface);
        border-color: transparent;
        box-shadow: 0 0 0 1px var(--brand), 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
    }

    .form-control:disabled,
    .form-select:disabled,
    .form-control[readonly] {
        background: color-mix(in srgb, var(--fill) 55%, transparent);
        color: var(--muted);
    }

    textarea.form-control {
        min-height: calc(1.55em * 3 + 1.2rem);
    }

    input[type="date"].form-control,
    input[type="time"].form-control {
        min-height: 2.55rem;
    }

    .form-text {
        font-size: .78rem;
        color: var(--muted);
        margin-top: .3rem;
        display: block;
    }

    .form-check {
        display: flex;
        align-items: flex-start;
        gap: .55rem;
    }

    .form-check-input {
        appearance: none;
        width: 1.05rem;
        height: 1.05rem;
        flex-shrink: 0;
        margin-top: .18rem;
        border: 1px solid var(--faint);
        border-radius: .3rem;
        background: var(--surface);
        cursor: pointer;
        transition: background-color .12s ease, border-color .12s ease;
    }

    .form-check-input:checked {
        background-color: var(--brand);
        border-color: var(--brand);
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3e%3cpath d='m5.5 10.5 3 3 6-7' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
        background-size: 100% 100%;
    }

    input[type="radio"].form-check-input {
        border-radius: 50%;
    }

    input[type="radio"].form-check-input:checked {
        background-image: radial-gradient(circle, #fff 0 32%, transparent 36%);
    }

    .form-check-input:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
    }

    .form-check-label {
        cursor: pointer;
    }

    /* Pill-toggle variant of a checkbox row. */
    .form-switch .form-check-input {
        width: 2.1rem;
        height: 1.2rem;
        border-radius: 999px;
        background-image: radial-gradient(circle 7px at 30% 50%, #fff 97%, transparent);
        background-color: var(--line);
        border-color: var(--line);
        transition: background-color .15s ease, background-position .15s ease;
    }

    .form-switch .form-check-input:checked {
        background-color: var(--brand);
        border-color: var(--brand);
        background-image: radial-gradient(circle 7px at 70% 50%, #fff 97%, transparent);
    }

    /* Hidden radio driving a button label (segmented choice). */
    .btn-check {
        position: absolute;
        clip: rect(0, 0, 0, 0);
        pointer-events: none;
    }

    .btn-check:checked + .btn {
        background: var(--brand-soft);
        border-color: color-mix(in srgb, var(--brand) 35%, transparent);
        color: var(--brand-ink);
    }

    .btn-check:focus-visible + .btn {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
    }

    /* The same 40px as every other control, so a file field lines up with
       the select or input beside it; its button sits centred inside. */
    input[type="file"].form-control {
        height: 40px;
        min-height: 40px;
        padding: 0 .5rem 0 .3125rem;
        line-height: 38px;
        cursor: pointer;
    }

    input[type="file"].form-control::file-selector-button {
        vertical-align: middle;
        line-height: 1.2;
        background: var(--raised);
        color: var(--ink);
        border: 0;
        border-radius: .45rem;
        padding: .3rem .7rem;
        margin-right: .7rem;
        font-size: .82rem;
        font-weight: 500;
        cursor: pointer;
    }

    .is-invalid {
        box-shadow: 0 0 0 1px var(--danger) !important;
    }

    .is-invalid:focus {
        box-shadow: 0 0 0 1px var(--danger), 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent) !important;
    }

    .invalid-feedback {
        color: var(--danger);
        font-size: .78rem;
        margin-top: .3rem;
        display: block;
    }

    /* Emitted from finance/forms.py alongside form-control. */
    .text-end {
        text-align: right;
    }

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

    .alert {
        border-radius: 14px;
        border: 0;
        padding: .8rem 1rem;
        font-size: .875rem;
        font-weight: 500;
        margin-bottom: 1rem;
    }

    .alert-dismissible {
        display: flex;
        align-items: flex-start;
        gap: .75rem;
    }

    .alert-close {
        margin-left: auto;
        flex-shrink: 0;
        background: transparent;
        border: 0;
        color: inherit;
        opacity: .55;
        cursor: pointer;
        font-size: .8rem;
        line-height: 1;
        padding: .15rem;
        border-radius: .35rem;
    }

    .alert-close:hover {
        opacity: 1;
    }

    .alert-info {
        background: var(--info-soft);
        color: var(--info);
    }

    .alert-success {
        background: var(--success-soft);
        color: var(--success);
    }

    .alert-warning {
        background: var(--warning-soft);
        color: var(--warning);
    }

    .alert-danger,
    .alert-error {
        background: var(--danger-soft);
        color: var(--danger);
    }

    /* ---------- Badges: a dot and a word ----------

       Status is never a filled pill. Seven pixels of colour and 13/500 text
       in the same colour; the markup did not change, the meaning did. */

    .badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: 0;
        line-height: 1.3;
        white-space: nowrap;
        padding: 0;
        border-radius: 0;
        color: var(--muted);
    }

    .badge::before {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 999px;
        background: currentColor;
        flex-shrink: 0;
    }

    .badge-primary { color: var(--brand); }
    .badge-success { color: var(--success); }
    .badge-warning { color: var(--warning); }
    .badge-danger  { color: var(--danger); }
    .badge-info    { color: var(--info); }
    .badge-neutral,
    .badge-secondary { color: var(--muted); }

    /* A count, not a status: the one badge that stays a solid pill. */
    .badge-solid-danger {
        background: var(--danger);
        color: #fff;
        padding: .15rem .5rem;
        border-radius: 999px;
        font-size: .7rem;
        font-weight: 700;
        line-height: 1.1;
    }

    .badge-solid-danger::before {
        display: none;
    }

    /* ---------- Soft icon tiles (stat cards, quick actions) ---------- */

    .bg-soft-primary   { background: var(--brand-soft); color: var(--brand-ink); }
    .bg-soft-success   { background: var(--success-soft); color: var(--success); }
    .bg-soft-warning   { background: var(--warning-soft); color: var(--warning); }
    .bg-soft-danger    { background: var(--danger-soft); color: var(--danger); }
    .bg-soft-info      { background: var(--info-soft); color: var(--info); }
    .bg-soft-secondary { background: var(--raised); color: var(--muted); }

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

    /* A data table never squeezes below what its columns need: inside its
       card it scrolls sideways instead, and the card's edge stays whole. */
    .table-responsive > .table:not(.table-sm) {
        min-width: 42rem;
    }

    /* A scroller with more to the right says so: a fade on its edge, set by
       a small script while the content really is wider than the box. */
    .table-responsive,
    .filter-presets {
        position: relative;
    }

    .is-scrollable::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 2.5rem;
        pointer-events: none;
        background: linear-gradient(to right, transparent, var(--surface));
    }

    .is-scrollable.filter-presets::after {
        background: linear-gradient(to right, transparent, var(--canvas));
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
    }

    /* A table reads as a grouped list: quiet caption headings, 15 px rows,
       hairline dividers, no header bar. */
    .table {
        width: 100%;
        border-collapse: collapse;
        font-size: .9375rem;
    }

    .table thead th {
        font-size: .75rem;
        text-transform: none;
        letter-spacing: 0;
        color: var(--muted);
        font-weight: 500;
        text-align: left;
        padding: .9rem 1.25rem .5rem;
        border-bottom: 1px solid var(--line);
        background: transparent;
        white-space: nowrap;
    }

    .table tbody td {
        padding: .875rem 1.25rem;
        border-bottom: 1px solid var(--line);
        vertical-align: middle;
    }

    .table tbody tr:last-child td {
        border-bottom: 0;
    }

    .table-sm thead th {
        padding: .55rem .75rem;
    }

    .table-sm tbody td,
    .table-sm tfoot td {
        padding: .55rem .75rem;
    }

    .table tfoot td {
        padding: .8rem 1rem;
        border-top: 1px solid var(--line);
    }

    .table-hover tbody tr:hover td {
        background: color-mix(in srgb, var(--fill) 60%, transparent);
    }

    /* ---------- Meter ---------- */
    /* A coverage bar. Colour carries the same meaning as the number beside it,
       so the row reads at a glance without being the only signal. */

    .meter {
        height: 6px;
        border-radius: 999px;
        background: var(--raised);
        overflow: hidden;
    }

    .meter-fill {
        display: block;
        height: 100%;
        border-radius: inherit;
    }

    .meter-good  { background: var(--success); }
    .meter-warn  { background: var(--warning); }
    .meter-bad   { background: var(--danger); }
    .meter-muted { background: var(--faint); }

    /* ---------- Stat cards ---------- */

    .stat-card {
        background: var(--surface);
        border-radius: var(--radius-card);
        box-shadow: var(--ring), var(--shadow-card);
        padding: 1.1rem 1.25rem;
        display: flex;
        align-items: center;
        gap: .95rem;
        height: 100%;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

    a .stat-card:hover {
        box-shadow: var(--ring-hover), var(--shadow-pop);
    }

    .stat-icon {
        width: 46px;
        height: 46px;
        border-radius: .8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 1.625rem;
        font-weight: 700;
        line-height: 1.1;
        letter-spacing: -.022em;
    }

    .stat-label {
        color: var(--muted);
        font-size: .8rem;
        margin-top: .1rem;
    }

    /* ---------- Dropdown menu (vanilla replacement for Bootstrap's) ------ */

    .menu {
        position: relative;
    }

    .menu-panel {
        position: absolute;
        right: 0;
        top: calc(100% + .5rem);
        min-width: 200px;
        background: var(--surface);
        border: 0;
        border-radius: 14px;
        box-shadow: var(--ring), var(--shadow-pop);
        padding: .4rem;
        z-index: 1040;
    }

    .menu-item {
        display: flex;
        align-items: center;
        gap: .6rem;
        width: 100%;
        padding: .5rem .7rem;
        border-radius: .55rem;
        font-size: .875rem;
        color: var(--ink);
        background: transparent;
        border: none;
        cursor: pointer;
        text-align: left;
    }

    .menu-item:hover {
        background: var(--raised);
    }

    .menu-divider {
        height: 1px;
        background: var(--line);
        margin: .35rem .3rem;
    }

    /* ---------- Auth (login) ---------- */

    .auth-body {
        background: var(--canvas);
    }

    .auth-wrapper {
        position: relative;
        isolation: isolate;
        overflow: hidden;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--canvas);
        padding: 1.5rem;
    }

    .setup-bar {
        height: 4px;
        border-radius: 999px;
        background: rgba(0, 0, 0, .08);
        overflow: hidden;
    }

    .dark .setup-bar {
        background: rgba(255, 255, 255, .12);
    }

    .setup-bar i {
        display: block;
        height: 100%;
        border-radius: 999px;
        background: var(--brand);
    }

    /* A switch drawn from a hidden checkbox (the modules page). */
    .toggle {
        display: inline-block;
        width: 40px;
        height: 24px;
        border-radius: 999px;
        background: rgba(0, 0, 0, .14);
        position: relative;
        flex-shrink: 0;
        transition: background-color 180ms var(--ease-out);
    }

    .dark .toggle {
        background: rgba(255, 255, 255, .18);
    }

    .toggle::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
        transition: transform 180ms var(--ease-out);
    }

    .toggle-input:checked + .toggle {
        background: var(--brand);
    }

    .toggle-input:checked + .toggle::after {
        transform: translateX(16px);
    }

    .toggle-input:focus-visible + .toggle {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
    }

    .bg-soft-brand {
        background: var(--brand-soft);
        color: var(--brand-ink, var(--brand));
    }

    .otp-input {
        height: 3.25rem;
        font-size: 1.75rem;
        font-weight: 600;
        letter-spacing: .45em;
        text-align: center;
        font-variant-numeric: tabular-nums;
        padding-left: .45em;
    }

    .auth-alert-ok {
        background: color-mix(in srgb, var(--success) 12%, transparent);
        color: var(--success);
    }

    /* ---------- Glossy fills ----------
       The primary button's treatment (top-lit gradient, inner highlight, a
       soft coloured drop) in green and red, for "done" and "missed" marks.
       Text and icons on them are white. */

    .gl-purple {
        color: #fff;
        background: linear-gradient(180deg, var(--brand-hi) 0%, var(--brand) 55%, var(--brand-lo) 100%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .18),
            0 1px 2px rgba(124, 58, 237, .45), 0 6px 14px -6px rgba(124, 58, 237, .55);
    }

    .gl-green {
        color: #fff;
        background: linear-gradient(180deg, #35c46a 0%, #248a3d 55%, #1b6e30 100%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .18),
            0 1px 2px rgba(36, 138, 61, .45), 0 6px 14px -6px rgba(36, 138, 61, .55);
    }

    .gl-red {
        color: #fff;
        background: linear-gradient(180deg, #ff5a52 0%, #d70015 55%, #a50012 100%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .18),
            0 1px 2px rgba(215, 0, 21, .4), 0 6px 14px -6px rgba(215, 0, 21, .5);
    }

    /* ---------- Page header ----------

       Every management page opens the same way: what this is, one line of
       numbers that say how it is going, and the one primary action. The
       topbar only carries the short title; this is where the page speaks. */

    .page-head {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: 1.625rem;
    }

    .page-head h1 {
        margin: 0;
        font-size: 1.75rem;
        font-weight: 700;
        letter-spacing: -.022em;
        line-height: 1.15;
        text-wrap: balance;
    }

    .page-head-sub {
        font-size: .9375rem;
        color: var(--muted);
        margin-top: .375rem;
        text-wrap: pretty;
    }

    .page-head-actions {
        display: flex;
        align-items: center;
        gap: .5rem;
        flex-wrap: wrap;
    }

    /* ---------- Card header, lighter ----------

       A card's title is a label, not a bar: icon in muted, title at 14.5px,
       optional context at the right, no full-width rule under it. Existing
       .card-header keeps working; .card-h is the rework's variant. */

    .card-h {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .9rem 1.25rem 0;
        font-weight: 600;
        font-size: .9rem;
    }

    .card-h > i {
        color: var(--muted);
        font-size: 1.05rem;
    }

    .card-h .card-h-sub {
        margin-left: auto;
        font-weight: 500;
        font-size: .78rem;
        color: var(--muted);
        white-space: nowrap;
    }

    /* ---------- Toolbar ----------

       One row: scope segments, search, selects. Replaces the three stacked
       filter rows the list pages grew. */

    .toolbar {
        display: flex;
        align-items: center;
        gap: .6rem;
        flex-wrap: wrap;
        padding: .7rem .8rem;
        margin-bottom: 1rem;
    }

    .toolbar .form-control,
    .toolbar .form-select,
    .toolbar .ts-wrapper .ts-control {
        min-height: 2.5rem;
    }

    .toolbar-search {
        flex: 1 1 14rem;
        min-width: 0;
    }

    .seg {
        display: inline-flex;
        background: var(--raised);
        box-shadow: var(--ring);
        border-radius: .625rem;
        padding: 3px;
        gap: 2px;
    }

    .seg a,
    .seg button {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        min-height: 2rem;
        padding: 0 .75rem;
        border-radius: .45rem;
        border: 0;
        background: transparent;
        font-size: .82rem;
        font-weight: 500;
        color: var(--muted);
        white-space: nowrap;
        cursor: pointer;
        transition-property: background-color, color, box-shadow;
        transition-duration: 150ms;
    }

    .seg .active {
        background: var(--surface);
        color: var(--ink);
        box-shadow: var(--shadow-card);
    }

    .seg .seg-count {
        font-weight: 600;
        color: var(--muted);
    }

    .seg .seg-count.is-danger {
        color: var(--danger);
    }

    /* ---------- Chips (filters) ---------- */

    .chip {
        display: inline-flex;
        align-items: center;
        gap: .35rem;
        height: 30px;
        padding: 0 .875rem;
        border-radius: 9px;
        background: transparent;
        color: var(--muted);
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: 0;
        white-space: nowrap;
        transition-property: background-color, color, box-shadow;
        transition-duration: 180ms;
        transition-timing-function: var(--ease-out);
    }

    .chip:hover {
        color: var(--ink);
    }

    .chip.active {
        background: var(--surface);
        box-shadow: var(--lift);
        color: var(--ink);
        font-weight: 600;
    }

    /* ---------- Status stepper ----------

       The same five-dot strip for a payment request, a ticket and a cleaning
       day: done in brand, current ringed, upcoming faint. */

    .stepper {
        display: flex;
        align-items: center;
        gap: 0;
        overflow-x: auto;
        padding-bottom: .1rem;
    }

    .step {
        display: flex;
        align-items: center;
        gap: .55rem;
        flex: 1 1 0;
        min-width: 0;
    }

    .step:last-child {
        flex: 0 0 auto;
    }

    .step-k {
        width: 26px;
        height: 26px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: .72rem;
        font-weight: 700;
        background: var(--raised);
        color: var(--faint);
        box-shadow: var(--ring);
    }

    /* Purple is reserved for the one current step; what is done reads as
       settled, in the success tone at ring weight. */
    .step.is-done .step-k {
        background: var(--success-soft);
        color: var(--success);
        box-shadow: none;
    }

    .step.is-now .step-k {
        background: var(--brand-soft);
        color: var(--brand-ink);
        box-shadow: inset 0 0 0 2px var(--brand);
    }

    .step-t {
        font-size: .78rem;
        font-weight: 500;
        color: var(--faint);
        white-space: nowrap;
    }

    .step.is-done .step-t { color: var(--ink); font-weight: 600; }
    .step.is-now  .step-t { color: var(--brand-ink); font-weight: 600; }

    .step-ln {
        flex: 1;
        height: 2px;
        min-width: .75rem;
        margin: 0 .5rem;
        border-radius: 2px;
        background: var(--line);
    }

    .step.is-done .step-ln {
        background: color-mix(in srgb, var(--success) 45%, transparent);
    }

    /* Five labels do not fit across a phone; the strip becomes a list. */
    @media (max-width: 767px) {
        .stepper {
            flex-direction: column;
            align-items: stretch;
            gap: .4rem;
            overflow: visible;
        }

        .step,
        .step:last-child {
            flex: 0 0 auto;
        }

        .step-ln {
            display: none;
        }

        .step-t {
            white-space: normal;
        }
    }

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

    .pagination-bar {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
        gap: .75rem;
        justify-content: space-between;
        margin-top: 1rem;
    }

    .pagination {
        display: flex;
        align-items: center;
        gap: .25rem;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .page-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.1rem;
        height: 2.1rem;
        padding: 0 .55rem;
        border-radius: .55rem;
        border: 1px solid var(--line);
        background: var(--surface);
        color: var(--muted);
        font-size: .85rem;
        font-weight: 500;
    }

    .page-link:hover {
        background: var(--raised);
        color: var(--ink);
    }

    .page-item.active .page-link {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
    }

    .page-item.disabled .page-link {
        opacity: .45;
        pointer-events: none;
    }

    /* ---------- Spinner (replacement for Bootstrap's spinner-border) ---- */

    .spinner {
        display: inline-block;
        width: 1em;
        height: 1em;
        border: 2px solid currentColor;
        border-right-color: transparent;
        border-radius: 50%;
        animation: spin .7s linear infinite;
        vertical-align: -.125em;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    /* ---------- v3 type scale ----------

       Apple-HIG rhythm for the desktop: large title 28/700 tight, title
       22/600, headline 15/600, body 15/400, callout 13, caption 12. Numbers
       tabular. No spaced capitals in running text. */

    .lg-title {
        font-size: 1.75rem;
        font-weight: 700;
        letter-spacing: -.022em;
        line-height: 1.15;
        margin: 0;
    }

    .title {
        font-size: 1.375rem;
        font-weight: 600;
        letter-spacing: -.02em;
        line-height: 1.2;
        margin: 0;
    }

    .headline {
        font-size: .9375rem;
        font-weight: 600;
        letter-spacing: -.01em;
    }

    .callout {
        font-size: .8125rem;
        color: var(--muted);
        letter-spacing: 0;
    }

    .caption {
        font-size: .75rem;
        color: var(--muted);
        letter-spacing: 0;
    }

    /* ---------- Grouped list ----------

       The v3 replacement for tables on management pages: 15 px rows with a
       13 px sub-line, hairline dividers inset past the icon, a soft-tinted
       icon at the left, status as a dot and a word at the right, and a
       chevron as the only hint that a row opens. */

    .list {
        background: var(--surface);
        border-radius: var(--radius-card);
        box-shadow: var(--ring), var(--shadow-card);
        overflow: hidden;
        min-width: 0;
    }

    .list-head {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: 1rem 1.25rem .375rem;
        font-size: .9375rem;
        font-weight: 600;
        letter-spacing: -.01em;
    }

    .list-head .callout,
    .list-head .btn-ghost {
        margin-left: auto;
        font-weight: 500;
    }

    .list-row {
        display: flex;
        align-items: center;
        gap: .875rem;
        padding: .875rem 1.25rem;
        position: relative;
        color: var(--ink);
        min-width: 0;
        transition: background-color 120ms ease-out;
    }

    .list-row + .list-row::before,
    .list-head + .list-row::before {
        content: '';
        position: absolute;
        left: calc(1.25rem + 34px + .875rem);
        right: 0;
        top: 0;
        height: 1px;
        background: var(--line);
    }

    .list-head + .list-row::before {
        display: none;
    }

    .list-row.no-icon + .list-row.no-icon::before,
    .list-plain .list-row + .list-row::before {
        left: 1.25rem;
    }

    a.list-row:hover,
    a.list-row:focus-visible {
        background: color-mix(in srgb, var(--fill) 60%, transparent);
        color: var(--ink);
    }

    .list-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 1.05rem;
    }

    .list-main {
        display: block;
        min-width: 0;
        flex: 1;
    }

    .list-title {
        display: block;
        font-size: .9375rem;
        font-weight: 500;
        letter-spacing: -.005em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .list-sub {
        display: block;
        font-size: .8125rem;
        color: var(--muted);
        letter-spacing: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* A list whose rows are meant to be read in full (the setup checklist):
       titles and subtitles wrap instead of clipping. */
    .list-wrap .list-title,
    .list-wrap .list-sub {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .list-side {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: .625rem;
        flex-shrink: 0;
    }

    .list-chev {
        color: var(--faint);
        font-size: .85rem;
    }

    .list-empty {
        padding: 1.75rem 1.25rem;
        text-align: center;
        color: var(--muted);
        font-size: .875rem;
    }

    .list-fill {
        background: var(--fill);
    }

    /* Status: a dot and a word, four semantic colours and grey. */
    .status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: 0;
        white-space: nowrap;
        color: var(--muted);
    }

    .status::before {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 999px;
        background: currentColor;
        flex-shrink: 0;
    }

    .status-danger  { color: var(--danger); }
    .status-warning { color: var(--warning); }
    .status-info    { color: var(--info); }
    .status-brand   { color: var(--brand); }
    .status-success { color: var(--success); }
    .status-muted   { color: var(--muted); }

    /* A stat is a group with one big number. */
    .stat {
        padding: 1.125rem 1.25rem;
        display: flex;
        flex-direction: column;
        gap: .25rem;
    }

    .stat-v {
        font-size: 1.625rem;
        font-weight: 700;
        letter-spacing: -.022em;
        line-height: 1.1;
    }

    /* Segmented control, iOS-style: the chosen option is a lifted white pill. */
    .seg {
        display: inline-flex;
        background: rgba(0, 0, 0, .06);
        border-radius: 12px;
        padding: 3px;
        gap: 2px;
    }

    .dark .seg {
        background: rgba(255, 255, 255, .08);
    }

    .seg > * {
        height: 30px;
        padding: 0 .875rem;
        display: inline-flex;
        align-items: center;
        border-radius: 9px;
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: 0;
        color: var(--muted);
        border: 0;
        background: transparent;
        cursor: pointer;
        white-space: nowrap;
        transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
    }

    .seg > .active {
        background: var(--surface);
        color: var(--ink);
        font-weight: 600;
        box-shadow: var(--lift);
    }

    /* In the dark the surface is darker than the track, so a selected
       segment in "surface" nearly vanishes; it lifts to a lighter grey
       instead, as iOS does. */
    .dark .seg > .active,
    .dark .seg label:has(input:checked) {
        background: #636366;
        color: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    }

    /* Search: a grey well with no outline. */
    .search {
        display: flex;
        align-items: center;
        gap: .5rem;
        height: 36px;
        padding: 0 .75rem;
        border-radius: 11px;
        background: rgba(0, 0, 0, .05);
        color: var(--faint);
        font-size: .875rem;
    }

    .dark .search {
        background: rgba(255, 255, 255, .08);
    }

    .search input {
        background: transparent;
        border: 0;
        outline: 0;
        color: var(--ink);
        width: 100%;
        min-width: 0;
        font-size: .875rem;
    }

    /* Five-segment progress, replacing the labelled stepper. */
    .dots {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .dots i {
        height: 6px;
        flex: 1;
        border-radius: 999px;
        background: rgba(0, 0, 0, .08);
    }

    .dark .dots i {
        background: rgba(255, 255, 255, .12);
    }

    .dots i.done {
        background: var(--brand);
    }

    .dots i.now {
        background: linear-gradient(90deg, var(--brand) 50%, color-mix(in srgb, var(--brand) 25%, transparent) 50%);
    }

    .stack-lg {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }

    .stack-md {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Spacing standard (DESIGN.md "Spacing"): a title and its one-line
       description sit 4px apart as a pair; a section title and its content
       .75rem; a form label and its field .375rem; an icon and its label
       .375rem. .stack-sm is the section-title-to-content step. */
    .stack-sm {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }

    /* A <legend> is not a flex item of its fieldset, so it takes the step
       itself; its hint lives inside it as the pair's second line. */
    fieldset.stack-sm > legend {
        margin-bottom: .75rem;
    }

    fieldset.stack-sm > legend .caption {
        display: block;
        margin-top: .25rem;
        font-weight: 400;
    }

    /* An icon and its label, whether a bare span or a card header's title. */
    .with-icon,
    .card-header > span:has(> .bi),
    .kanban-card-meta > span:has(> .bi) {
        display: inline-flex;
        align-items: center;
        gap: .375rem;
    }

    .card-header > span:has(> .bi) {
        gap: .5rem;
    }

    .list.is-quiet {
        opacity: .8;
    }

    .list-more .list-title {
        font-weight: 500;
        font-size: .875rem;
    }

    /* Statuses in a list line up on one column. */
    .list-status {
        min-width: 10rem;
        justify-content: flex-end;
    }

    .toolbar {
        padding: 0;
    }

    .toolbar .search {
        height: 40px;
    }

    /* A group used as a single panel: padding instead of rows. */
    .card-pad {
        padding: 1.625rem 1.75rem;
    }

    .list-thumb {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        object-fit: cover;
        display: block;
    }

    /* Two figures side by side: budget and what was spent. */
    .tile {
        background: var(--fill);
        border-radius: 12px;
        padding: .75rem .875rem;
    }

    .tile-success {
        background: var(--success-soft);
    }

    .tile-success .caption,
    .tile-success .num {
        color: var(--success);
    }

    .tile-warning {
        background: var(--warning-soft);
    }

    .tile-warning .caption,
    .tile-warning .num {
        color: var(--warning);
    }

    /* Phone-first pieces: the big clock and the one thumb-sized button. */
    .clock-big {
        font-size: 3.5rem;
        font-weight: 700;
        letter-spacing: -.03em;
        line-height: 1;
    }

    .btn-xl {
        height: 54px;
        min-height: 54px;
        border-radius: 16px;
        font-size: 1rem;
    }

    .absen-page {
        max-width: 30rem;
        margin: 0 auto;
    }

    /* ---------- Rules picked from app-only sections: radio segments, the sign-in card ---------- */

    .seg label {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        min-height: 2rem;
        padding: 0 .75rem;
        border-radius: .45rem;
        font-size: .82rem;
        font-weight: 500;
        color: var(--muted);
        white-space: nowrap;
        cursor: pointer;
        transition-property: background-color, color, box-shadow;
        transition-duration: 150ms;
    }

    .seg label input {
        position: absolute;
        inset: 0;
        opacity: 0;
        margin: 0;
        cursor: pointer;
    }

    .seg label:has(input:checked) {
        background: var(--surface);
        color: var(--ink);
        box-shadow: var(--shadow-card);
    }

    .seg label:has(input:focus-visible) {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
    }

    .seg.seg-fill {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
    }

    .seg.seg-fill label {
        justify-content: center;
    }

    .auth-card {
        background: var(--surface);
        border: 0;
        border-radius: 22px;
        padding: 2.25rem;
        width: 100%;
        max-width: 410px;
        box-shadow: var(--ring), 0 24px 60px -30px rgba(0, 0, 0, .25);
    }

}

/* Aurora: our moving gradient, the AI card's wash grown up. Four soft
   colour blobs drift on the compositor (transform only, 20-30 s, alternate)
   over a base colour, with a faint grain. No script, no WebGL; reduced
   motion gets the still picture. .aurora-soft sits behind dark text,
   .aurora-deep behind white text (every colour 5.7:1 or better). The parent
   is `position: relative; isolation: isolate`. Variables are --au-*: the
   stylesheet already registers short names like --s as typed properties. */
@layer components {
    .aurora { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; border-radius: inherit; }
    .aurora > i { position: absolute; width: var(--au-s, 60%); aspect-ratio: 1; border-radius: 50%;
        background: radial-gradient(closest-side, var(--au-c) 0%, color-mix(in srgb, var(--au-c) 55%, transparent) 40%, transparent 100%);
        will-change: transform; animation: aurora-drift var(--au-d, 24s) ease-in-out infinite alternate; animation-delay: var(--au-delay, 0s); }
    .aurora::after { content: ''; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay; border-radius: inherit;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
    .aurora > i:nth-child(1) { left: -12%; top: -20%; --au-s: 62%; --au-d: 26s; --au-x: 14%; --au-y: 10%; }
    .aurora > i:nth-child(2) { right: -14%; top: -10%; --au-s: 58%; --au-d: 22s; --au-delay: -6s; --au-x: -16%; --au-y: 14%; }
    .aurora > i:nth-child(3) { left: 22%; bottom: -40%; --au-s: 70%; --au-d: 30s; --au-delay: -12s; --au-x: 10%; --au-y: -12%; }
    .aurora > i:nth-child(4) { right: 10%; bottom: -30%; --au-s: 44%; --au-d: 20s; --au-delay: -3s; --au-x: -12%; --au-y: -8%; }
    @keyframes aurora-drift {
        from { transform: translate3d(0, 0, 0) scale(1); }
        to { transform: translate3d(var(--au-x), var(--au-y), 0) scale(1.18); }
    }
    .aurora-soft { background: #efeafd; }
    .aurora-soft > i:nth-child(1) { --au-c: #c4b5fd; }
    .aurora-soft > i:nth-child(2) { --au-c: #ddd6fe; }
    .aurora-soft > i:nth-child(3) { --au-c: #a78bfa; }
    .aurora-soft > i:nth-child(4) { --au-c: #e9d5ff; }
    /* The signed-out pages follow the theme: in the dark the soft aurora
       becomes deep purples over the dark canvas instead of a lavender glare. */
    .dark .aurora-soft { background: var(--canvas); }
    .dark .aurora-soft > i:nth-child(1) { --au-c: #3b0764; }
    .dark .aurora-soft > i:nth-child(2) { --au-c: #2e1065; }
    .dark .aurora-soft > i:nth-child(3) { --au-c: #4c1d95; }
    .dark .aurora-soft > i:nth-child(4) { --au-c: #1e1b4b; }
    .aurora-deep { background: #4c1d95; }
    .aurora-deep > i:nth-child(1) { --au-c: #7c3aed; }
    .aurora-deep > i:nth-child(2) { --au-c: #3b0764; }
    .aurora-deep > i:nth-child(3) { --au-c: #6d28d9; }
    .aurora-deep > i:nth-child(4) { --au-c: #5f21c9; }
    @media (prefers-reduced-motion: reduce) {
        .aurora > i { animation: none; }
    }
}

/* Segmented controls with a sliding pill (static/js/seg_slide.js adds
   .seg-slide and the pill). The chosen segment gives up its own fill to the
   pill, which slides 250 ms ease-out; keyboard changes and reduced motion
   snap. Without the script the old static fill stays. */
@layer components {
    .seg.seg-slide { position: relative; isolation: isolate; }
    .seg-pill { position: absolute; top: 0; left: 0; z-index: -1; pointer-events: none;
        background: var(--surface); box-shadow: var(--lift);
        transition: transform 250ms var(--ease-out), width 250ms var(--ease-out), height 250ms var(--ease-out); }
    .dark .seg-pill { background: #636366; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
    .seg-pill.seg-pill-still { transition: none; }
    .seg.seg-slide > .active,
    .seg.seg-slide > label:has(input:checked),
    .dark .seg.seg-slide > .active,
    .dark .seg.seg-slide > label:has(input:checked) { background: transparent; box-shadow: none; }
    .seg.seg-slide > label:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
    @media (prefers-reduced-motion: reduce) {
        .seg-pill { transition: none; }
    }
}

/* Helpers the component markup relies on, for projects without Tailwind. */
@layer components {
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
        clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .w-full { width: 100%; }
    .text-center { text-align: center; }
    .hstack { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
}

/* Motion is opt-in for the eye that can take it. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
    }
}
