/*
    Agriculture & Cooperatives Department — Complaint Management System
    Application styles on top of the committed Bootstrap build.

    Three rules hold throughout this file.

    1.  Logical properties, always (inline-start rather than left, block-end rather than
        bottom). The Urdu right-to-left layout then needs no separate stylesheet — the dir
        attribute on <html> does the work.
    2.  Colour, spacing and radius come from the tokens in :root. A component that invents its
        own hex value is a component that will look wrong when the palette is next touched.
    3.  Every interactive element has a visible focus state. This is a government service and
        a keyboard user must be able to see where they are.
*/

/* ==========================================================================================
   Tokens
   ========================================================================================== */

:root {
    /* Tells the browser which way its own furniture goes: form controls, scrollbars and the
       canvas behind the page. Redeclared by the dark block below. */
    color-scheme: light;

    /* Brand. Deep institutional green, taken from the department's own livery and extended
       into a ramp so tints and hovers stop being guesswork. */
    --green-900: #0b3d21;
    --green-800: #14532d;
    --green-700: #166534;
    --green-600: #15803d;
    --green-500: #22a155;
    --green-100: #dcf1e3;
    --green-50:  #f0f9f3;

    /* Neutrals. Slightly warm, so the greys sit with the green rather than against it. */
    --ink-900: #14181f;
    --ink-800: #1f2733;
    --ink-700: #344054;
    --ink-600: #475467;
    --ink-500: #667085;
    --ink-400: #98a2b3;
    --ink-300: #d0d5dd;
    --ink-200: #e4e7ec;
    --ink-100: #f2f4f7;
    --ink-50:  #f8fafc;

    /* Semantic. Used for SLA states, validation and badges — never for decoration. */
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --critical: #b54708;
    --critical-bg: #fffaeb;
    --warning: #a16207;
    --warning-bg: #fefce8;
    --ok: #067647;
    --ok-bg: #ecfdf3;
    --info: #175cd3;
    --info-bg: #eff8ff;

    /* The brand green as a text colour. Separate from the ramp because a word has to keep
       its contrast when the page turns over and a button's background does not. */
    --link: var(--green-700);
    --link-hover: var(--green-800);
    --brand-text: var(--green-800);

    /* The header is glass over whatever scrolls beneath it, and what is beneath it differs
       by theme: the same translucent green goes milky over a white page and stays deep over
       a dark one. Light therefore keeps nearly all of the brand's depth. */
    --header-top: rgba(11, 61, 33, 0.94);
    --header-bottom: rgba(8, 48, 26, 0.9);
    --header-rule: rgba(255, 255, 255, 0.16);
    --header-sheen: rgba(255, 255, 255, 0.14);

    /* The footer is the opposite of the page on purpose, so it carries its own colours
       rather than borrowing a ramp that inverts underneath it. */
    --footer-bg: #0d2c1b;
    --footer-text: rgba(255, 255, 255, 0.72);
    --footer-strong: #ffffff;
    --footer-rule: rgba(255, 255, 255, 0.14);

    --surface: #ffffff;
    --surface-muted: var(--ink-50);
    --surface-sunken: var(--ink-100);
    --border: var(--ink-200);
    --border-strong: var(--ink-300);

    /* Type. One scale, used everywhere. */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-urdu: "Noto Nastaliq Urdu", var(--font-sans);
    --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;

    /* Space. A 4px grid; components pick from it rather than inventing margins. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-pill: 100rem;

    /* Shadows are deliberately shallow. Paper, not glass. */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.10), 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 8px 20px rgba(16, 24, 40, 0.10);

    --admin-nav-width: 17rem;
    --admin-header-height: 3.5rem;

    --focus-ring: 0 0 0 3px rgba(21, 128, 61, 0.35);

    /* Entrances. Quick off the mark and a long soft landing, which is what makes a
       movement of half a centimetre read as deliberate rather than as a twitch. */
    --ease-entrance: cubic-bezier(0.16, 1, 0.3, 1);
}


/* ==========================================================================================
   Dark
   ==========================================================================================

   The tokens are redefined; the components are not. Every rule below reads --ink-*, --surface
   and --border, so a dark interface is this block and the few places that named a colour
   outright.

   Said twice on purpose: once for a reader who has set their device and chosen nothing here,
   and once for a reader who has chosen. The :not() keeps an explicit choice of light from
   being overruled by the device.
*/

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
    color-scheme: dark;

    /* The ink ramp turns over: 900 is still the strongest against the page, which on a dark
       page means the lightest. Every rule that said "text is --ink-800" keeps saying it. */
    --ink-900: #f4f6f9;
    --ink-800: #e3e8ef;
    --ink-700: #c7d0dc;
    --ink-600: #a2adbd;
    --ink-500: #8691a2;
    --ink-400: #6a7585;
    --ink-300: #4b5564;
    --ink-200: #343d4a;
    --ink-100: #272f3a;
    --ink-50:  #1e242d;

    --surface: #181d25;
    --surface-muted: #12161c;
    --surface-sunken: #1e242d;
    --border: #2d3540;
    --border-strong: #3d4653;

    /* The brand's own green stays the brand's own green — the header is already dark — but
       the two tints it uses as backgrounds have to come down to meet the page. */
    --green-100: #1d3326;
    --green-50:  #16251c;

    /* Semantic colours lift and their backgrounds drop: a #fef3f2 panel on a dark page is a
       lamp, and #b42318 text on it is unreadable either way round. */
    --danger: #f1756b;
    --danger-bg: #3a1c19;
    --critical: #e9a33f;
    --critical-bg: #392a12;
    --warning: #d9b53c;
    --warning-bg: #322c13;
    --ok: #4fc083;
    --ok-bg: #13301f;
    --info: #6ea8f6;
    --info-bg: #15243c;

    /* Paper, not glass, still — but a shadow on a dark page has to be darker than the page,
       not lighter, or it reads as a glow. */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.55);

    --focus-ring: 0 0 0 3px rgba(79, 192, 131, 0.4);

    --header-top: rgba(20, 83, 45, 0.82);
    --header-bottom: rgba(11, 61, 33, 0.7);
    --header-rule: rgba(255, 255, 255, 0.12);
    --header-sheen: rgba(255, 255, 255, 0.08);

    --link: #5ec98c;
    --link-hover: #8fe0b0;
    --brand-text: #5ec98c;

    --footer-bg: #10161d;
    --footer-text: rgba(255, 255, 255, 0.62);
    --footer-strong: rgba(255, 255, 255, 0.92);
    --footer-rule: rgba(255, 255, 255, 0.1);

    /* Bootstrap paints tables, form controls and its own surfaces from its variables, not
       from ours. Pointing them at our tokens is what stops a table row staying white under
       near-white text — which is what a dark page looks like when only half of it is told. */
    --bs-body-bg: var(--surface);
    --bs-body-color: var(--ink-800);
    --bs-emphasis-color: var(--ink-900);
    --bs-secondary-color: var(--ink-600);
    --bs-secondary-bg: var(--surface-sunken);
    --bs-tertiary-bg: var(--surface-muted);
    --bs-border-color: var(--border);
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink-800);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    --bs-table-border-color: var(--border);
    --bs-link-color: var(--green-500);
    --bs-link-hover-color: var(--green-100);
    }

    :root:not([data-theme="light"]) {
            /* The four alerts name their border and text outright, because a tint and a dark text is
               the one thing a token pair cannot express. */
            .alert-success { border-color: #1f5a3c; color: #7fd6a6; }
            .alert-danger  { border-color: #6b2b25; color: #f5a29a; }
            .alert-warning { border-color: #5c4a18; color: #e6cb6d; }
            .alert-info    { border-color: #27456f; color: #9cc5fa; }

            /* The board's wing tints are pale washes of a hue. On a dark page the hue has to be laid
               over the surface instead of over white, or every card glows. */
            .head-hue-0 { --head-tint: #152a20; }
            .head-hue-1 { --head-tint: #2b2113; }
            .head-hue-2 { --head-tint: #161f33; }
            .head-hue-3 { --head-tint: #2b1622; }
            .head-hue-4 { --head-tint: #13282a; }
            .head-hue-5 { --head-tint: #2a1a14; }
            .head-hue-6 { --head-tint: #1d1b35; }

            /* The chip is an island of its own colour, so on a dark page it is laid over the
               surface instead of over white and the word goes towards white instead of black.
               Same arithmetic the other way up: nothing on the status list falls below 5.2:1. */
            .status-chip {
                color: color-mix(in srgb, var(--chip, var(--ink-500)) 55%, white);
                background: color-mix(in srgb, var(--chip, var(--ink-500)) 20%, var(--surface));
                border-color: color-mix(in srgb, var(--chip, var(--ink-500)) 40%, var(--surface));
            }
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    /* The ink ramp turns over: 900 is still the strongest against the page, which on a dark
       page means the lightest. Every rule that said "text is --ink-800" keeps saying it. */
    --ink-900: #f4f6f9;
    --ink-800: #e3e8ef;
    --ink-700: #c7d0dc;
    --ink-600: #a2adbd;
    --ink-500: #8691a2;
    --ink-400: #6a7585;
    --ink-300: #4b5564;
    --ink-200: #343d4a;
    --ink-100: #272f3a;
    --ink-50:  #1e242d;

    --surface: #181d25;
    --surface-muted: #12161c;
    --surface-sunken: #1e242d;
    --border: #2d3540;
    --border-strong: #3d4653;

    /* The brand's own green stays the brand's own green — the header is already dark — but
       the two tints it uses as backgrounds have to come down to meet the page. */
    --green-100: #1d3326;
    --green-50:  #16251c;

    /* Semantic colours lift and their backgrounds drop: a #fef3f2 panel on a dark page is a
       lamp, and #b42318 text on it is unreadable either way round. */
    --danger: #f1756b;
    --danger-bg: #3a1c19;
    --critical: #e9a33f;
    --critical-bg: #392a12;
    --warning: #d9b53c;
    --warning-bg: #322c13;
    --ok: #4fc083;
    --ok-bg: #13301f;
    --info: #6ea8f6;
    --info-bg: #15243c;

    /* Paper, not glass, still — but a shadow on a dark page has to be darker than the page,
       not lighter, or it reads as a glow. */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.55);

    --focus-ring: 0 0 0 3px rgba(79, 192, 131, 0.4);

    --header-top: rgba(20, 83, 45, 0.82);
    --header-bottom: rgba(11, 61, 33, 0.7);
    --header-rule: rgba(255, 255, 255, 0.12);
    --header-sheen: rgba(255, 255, 255, 0.08);

    --link: #5ec98c;
    --link-hover: #8fe0b0;
    --brand-text: #5ec98c;

    --footer-bg: #10161d;
    --footer-text: rgba(255, 255, 255, 0.62);
    --footer-strong: rgba(255, 255, 255, 0.92);
    --footer-rule: rgba(255, 255, 255, 0.1);

    /* Bootstrap paints tables, form controls and its own surfaces from its variables, not
       from ours. Pointing them at our tokens is what stops a table row staying white under
       near-white text — which is what a dark page looks like when only half of it is told. */
    --bs-body-bg: var(--surface);
    --bs-body-color: var(--ink-800);
    --bs-emphasis-color: var(--ink-900);
    --bs-secondary-color: var(--ink-600);
    --bs-secondary-bg: var(--surface-sunken);
    --bs-tertiary-bg: var(--surface-muted);
    --bs-border-color: var(--border);
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink-800);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    --bs-table-border-color: var(--border);
    --bs-link-color: var(--green-500);
    --bs-link-hover-color: var(--green-100);
}

:root[data-theme="dark"] {
        /* The four alerts name their border and text outright, because a tint and a dark text is
           the one thing a token pair cannot express. */
        .alert-success { border-color: #1f5a3c; color: #7fd6a6; }
        .alert-danger  { border-color: #6b2b25; color: #f5a29a; }
        .alert-warning { border-color: #5c4a18; color: #e6cb6d; }
        .alert-info    { border-color: #27456f; color: #9cc5fa; }

        /* The board's wing tints are pale washes of a hue. On a dark page the hue has to be laid
           over the surface instead of over white, or every card glows. */
        .head-hue-0 { --head-tint: #152a20; }
        .head-hue-1 { --head-tint: #2b2113; }
        .head-hue-2 { --head-tint: #161f33; }
        .head-hue-3 { --head-tint: #2b1622; }
        .head-hue-4 { --head-tint: #13282a; }
        .head-hue-5 { --head-tint: #2a1a14; }
        .head-hue-6 { --head-tint: #1d1b35; }

        /* The chip is an island of its own colour, so on a dark page it is laid over the
           surface instead of over white and the word goes towards white instead of black.
           Same arithmetic the other way up: nothing on the status list falls below 5.2:1. */
        .status-chip {
            color: color-mix(in srgb, var(--chip, var(--ink-500)) 55%, white);
            background: color-mix(in srgb, var(--chip, var(--ink-500)) 20%, var(--surface));
            border-color: color-mix(in srgb, var(--chip, var(--ink-500)) 40%, var(--surface));
        }
}

/* The Urdu face is 675 KB, so it is declared but only referenced under [lang="ur"]. A browser
   fetches a font only when something actually uses it, which keeps the English portal — the
   one most likely to be opened on 2G — from paying for it. */
@font-face {
    font-family: "Noto Nastaliq Urdu";
    src: url("/fonts/NotoNastaliqUrdu-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

/* ==========================================================================================
   Base
   ========================================================================================== */

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--ink-800);
    background: var(--surface-muted);
    -webkit-font-smoothing: antialiased;
}

/* Nastaliq needs considerably more leading than a Latin face or the descenders collide.
   The attribute match has to be |= rather than =, because the culture is "ur-PK", not "ur".
   Balochi, Brahui and Pashto are set in Nastaliq here too, which is why this keys off the
   direction rather than naming Urdu alone. */
[lang|="ur"],
[dir="rtl"] body {
    font-family: var(--font-urdu);
    line-height: 2.1;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink-900);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

a:hover { color: var(--link-hover); }

:focus-visible {
    outline: 2px solid var(--green-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.text-muted { color: var(--ink-600) !important; }

/* Alpine sets x-cloak until it has initialised; without this the conditional fields flash
   into view before being hidden. */
[x-cloak] { display: none !important; }

.skip-link {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: 100;
    background: var(--surface);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================================
   Bootstrap, brought into line
   Overridden rather than re-implemented: the committed build stays untouched so it can be
   swapped for a later one without losing this.
   ========================================================================================== */

.btn {
    --bs-btn-padding-y: 0.4375rem;
    --bs-btn-padding-x: 0.875rem;
    --bs-btn-font-size: var(--text-base);
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.btn:focus-visible { box-shadow: var(--focus-ring); }

.btn-primary {
    --bs-btn-bg: var(--green-700);
    --bs-btn-border-color: var(--green-700);
    --bs-btn-hover-bg: var(--green-800);
    --bs-btn-hover-border-color: var(--green-800);
    --bs-btn-active-bg: var(--green-900);
    --bs-btn-active-border-color: var(--green-900);
    --bs-btn-disabled-bg: var(--ink-300);
    --bs-btn-disabled-border-color: var(--ink-300);
}

.btn-secondary {
    --bs-btn-color: var(--ink-800);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--ink-900);
    --bs-btn-hover-bg: var(--ink-100);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: var(--ink-200);
}

.btn-outline-primary {
    --bs-btn-color: var(--link);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--green-50);
    --bs-btn-hover-color: var(--link-hover);
    --bs-btn-hover-border-color: var(--green-600);
    --bs-btn-active-bg: var(--green-100);
    --bs-btn-active-color: var(--link-hover);
    --bs-btn-active-border-color: var(--green-600);
}

.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);

    /* The word on it is the pale end of the same pair rather than a flat white: --danger
       darkens for a light page and lifts for a dark one, and white only survives the first
       of those. Hover and active move the fill towards the page's own ink, which is darker
       on a light page and lighter on a dark one — in both cases, further from the label. */
    --bs-btn-color: var(--danger-bg);
    --bs-btn-hover-color: var(--danger-bg);
    --bs-btn-active-color: var(--danger-bg);
    --bs-btn-hover-bg: color-mix(in srgb, var(--danger) 86%, var(--ink-900));
    --bs-btn-hover-border-color: color-mix(in srgb, var(--danger) 86%, var(--ink-900));
    --bs-btn-active-bg: color-mix(in srgb, var(--danger) 78%, var(--ink-900));
    --bs-btn-active-border-color: color-mix(in srgb, var(--danger) 78%, var(--ink-900));
}

/* The outlined pair kept the library's own grey and red, which are picked for a white page
   and sit at about 4:1 on ours in either theme. */
.btn-outline-secondary {
    --bs-btn-color: var(--ink-700);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--ink-100);
    --bs-btn-hover-color: var(--ink-900);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: var(--ink-200);
    --bs-btn-active-color: var(--ink-900);
    --bs-btn-active-border-color: var(--border-strong);
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: color-mix(in srgb, var(--danger) 45%, var(--surface));
    --bs-btn-hover-bg: var(--danger-bg);
    --bs-btn-hover-color: var(--danger);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-active-bg: var(--danger-bg);
    --bs-btn-active-color: var(--danger);
    --bs-btn-active-border-color: var(--danger);
}

.btn-link {
    --bs-btn-color: var(--link);
    text-decoration: none;
    box-shadow: none;
}

.btn-link:hover { text-decoration: underline; }

.form-label {
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--ink-700);
    margin-block-end: var(--space-1);
}

.form-control,
.form-select {
    font-size: var(--text-base);
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    padding-block: 0.4375rem;
    color: var(--ink-900);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--green-600);
    box-shadow: var(--focus-ring);
}

.form-control::placeholder { color: var(--ink-400); }

.form-text {
    font-size: var(--text-xs);
    color: var(--ink-600);
}

.form-check-input:checked {
    background-color: var(--green-700);
    border-color: var(--green-700);
}

.form-check-input:focus { box-shadow: var(--focus-ring); }

.table {
    --bs-table-color: var(--ink-800);
    font-size: var(--text-base);
    margin-block-end: 0;
}

.table > thead > tr > th {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-600);
    background: var(--ink-50);
    border-block-end: 1px solid var(--border);
    padding-block: var(--space-3);
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding-block: var(--space-3);
    border-block-end: 1px solid var(--border);
    vertical-align: middle;
}

.table > tbody > tr:last-child > td { border-block-end: 0; }

.table-hover > tbody > tr:hover > * {
    background: var(--green-50);
}

/* A breached row, a row waiting on a report, a row that came out right. Bootstrap writes
   these as fixed pale washes — #f8d7da under black — so on a dark page the row is a lamp,
   our own link colour on it is a light green on pink, and the muted line under it disappears.
   Re-stated in the semantic pairs everything else uses, which turn over with the page, so
   this is said once rather than once per theme. */
.table-danger,
.table-warning,
.table-success,
.table-info {
    --bs-table-color: var(--ink-800);
    --bs-table-striped-color: var(--ink-800);
    --bs-table-active-color: var(--ink-800);
    --bs-table-hover-color: var(--ink-800);
    --bs-table-border-color: var(--border);

    /* Hover and stripe are the tint itself, carried a little further towards the page's own
       ink — away from white on a light page and away from black on a dark one. */
    --bs-table-striped-bg: color-mix(in srgb, var(--bs-table-bg) 94%, var(--ink-900));
    --bs-table-hover-bg: color-mix(in srgb, var(--bs-table-bg) 90%, var(--ink-900));
    --bs-table-active-bg: color-mix(in srgb, var(--bs-table-bg) 86%, var(--ink-900));
}

.table-danger  { --bs-table-bg: var(--danger-bg); }
.table-warning { --bs-table-bg: var(--warning-bg); }
.table-success { --bs-table-bg: var(--ok-bg); }
.table-info    { --bs-table-bg: var(--info-bg); }

.alert {
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
}

/* asp-validation-summary always renders its div, marking it validation-summary-valid when
   there is nothing to report. Left alone that is an empty red box sitting above every form
   the first time it is opened. */
.validation-summary-valid { display: none; }

.alert-success { background: var(--ok-bg); border-color: #a9e3c4; color: #054f32; }
.alert-danger  { background: var(--danger-bg); border-color: #f5c4c0; color: #7a1c15; }
.alert-warning { background: var(--warning-bg); border-color: #f0dca2; color: #7a4a06; }
.alert-info    { background: var(--info-bg); border-color: #b9d6fb; color: #10418f; }

/* The quiet one. Bootstrap's is a fixed light grey, which on a dark page is a white card
   with our light link colour on it; these three tokens all turn over together. */
.alert-secondary {
    background: var(--ink-100);
    border-color: var(--border);
    color: var(--ink-800);
}

.badge { font-weight: 500; letter-spacing: 0.01em; }

/* The badges keep their solid chip, in our colours rather than the library's: white on
   Bootstrap's #0dcaf0 is 2:1 and unreadable on any page, light or dark.

   The text is the tint from the same pair as the background. That reads oddly written down
   and is exactly right: --info is a blue that darkens for a light page and lifts for a dark
   one, --info-bg is its near-white that darkens with it, so the two stay opposite ends of
   the same pair whichever way the page goes, and the chip never has to be said twice.

   text-dark is named alongside, because the markup carries it on the two light chips and it
   is !important in the library — without it the word stays near-black on a dark chip. */
.badge.bg-success { background-color: var(--ok) !important;     color: var(--ok-bg); }
.badge.bg-danger  { background-color: var(--danger) !important; color: var(--danger-bg); }
.badge.bg-info    { background-color: var(--info) !important;   color: var(--info-bg); }

.badge.bg-warning,
.badge.bg-warning.text-dark {
    background-color: var(--warning) !important;
    color: var(--warning-bg) !important;
}

.badge.bg-secondary {
    background-color: var(--ink-600) !important;
    color: var(--surface);
}

.badge.bg-light,
.badge.bg-light.text-dark {
    background-color: var(--surface-sunken) !important;
    color: var(--ink-800) !important;
    border: 1px solid var(--border);
}

/* The wash itself, wherever it is used outside a badge. */
.bg-light { background-color: var(--surface-sunken) !important; }
.bg-light.text-dark { color: var(--ink-800) !important; }

/* The three meanings as words rather than fills. The library's own are picked for a white
   page -- its red is #dc3545, which is 3.7:1 on ours when the page turns over -- and these
   are the same three colours the chips, the countdowns and the alerts already use. */
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-success { color: var(--ok) !important; }

/* A tracking number is set in a code element, which Bootstrap paints #d63384: a pink chosen
   against white, and 3.8:1 against a dark page. Carried towards the page's own ink, which
   darkens it on a light page and lifts it on a dark one, so it stays the accent it was. */
code { color: color-mix(in srgb, #d63384 60%, var(--ink-900)); }

.card {
    border-color: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

details > summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--link);
    padding-block: var(--space-1);
}

details > summary:hover { color: var(--link-hover); }

/* ==========================================================================================
   Panel — the single surface every screen is built from
   ========================================================================================== */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-block-end: var(--space-4);
}

.panel > h2:first-child,
.panel > h1:first-child {
    margin-block-start: 0;
    margin-block-end: var(--space-4);
    padding-block-end: var(--space-3);
    border-block-end: 1px solid var(--border);
}

.panel-subheading {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-500);
    font-weight: 600;
    margin-block: var(--space-4) var(--space-2);
}

/* A panel whose body is a table should not double up on padding. */
.panel > .table:last-child,
.panel > .table-responsive:last-child {
    margin-block-end: calc(var(--space-5) * -1);
    margin-inline: calc(var(--space-5) * -1);
    inline-size: calc(100% + var(--space-5) * 2);
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    padding: var(--space-7) var(--space-5);
    text-align: center;
    border-radius: var(--radius);
    color: var(--ink-600);
}

/* ==========================================================================================
   Public shell — portal, tracking, sign-in
   ========================================================================================== */

body.public { background: var(--surface-muted); }

.public-header {
    background: var(--green-800);
    color: #fff;
    border-block-end: 1px solid var(--header-rule);
    position: sticky;
    inset-block-start: 0;
    z-index: 20;
}

/* Glass, where the browser can make glass: the bar is sticky, so there is always something
   moving underneath it to frost. Declared here rather than above so a browser without
   backdrop-filter keeps the solid bar instead of a transparent one nobody can read. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .public-header {
        background: linear-gradient(180deg, var(--header-top), var(--header-bottom));
        -webkit-backdrop-filter: blur(18px) saturate(180%);
        backdrop-filter: blur(18px) saturate(180%);
        box-shadow: inset 0 1px 0 var(--header-sheen), 0 10px 30px rgba(0, 0, 0, 0.18);
    }
}

.public-brand {
    color: #fff;
    font-weight: 650;
    font-size: var(--text-lg);
    text-decoration: none;
    letter-spacing: -0.01em;
    padding-block: var(--space-2);
}

.public-brand:hover { color: #fff; text-decoration: none; opacity: 0.9; }

.public-brand:focus-visible {
    outline: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.public-header .form-select,
.public-header .btn {
    font-size: var(--text-sm);
}

/* Lighter than the slab it replaces, and it now says whose service this is -- which is what
   somebody checks when they are deciding whether a government site is the real one. */
/* The close of the page, not a strip of leftovers: the crest, the department under its own
   name, and the two things somebody at the bottom of the page still wants — how to ask, and
   where to sign in. Its colours are its own, because it is the opposite of the page in both
   themes and a ramp that inverts would take it with it. */
/* The page is a column as tall as the window, and the content takes the slack — so a
   short page puts its footer on the bottom of the screen rather than halfway up it with the
   page's own background showing underneath. */
body {
    min-block-size: 100dvh;
    display: flex;
    flex-direction: column;
}

/* The width has to be said out loud. Every main on this site is centred with
   margin-inline: auto, and an auto margin on the cross axis of a flex container stops the
   item stretching — so the moment the page became a column, every screen in the application
   shrank to the width of its own content and sat in the middle of the window. */
body > main {
    flex: 1 0 auto;
    inline-size: 100%;
}

body > footer { flex: 0 0 auto; }

.public-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-block-start: var(--space-7);
    padding-block: var(--space-6) var(--space-5);
    font-size: var(--text-sm);
    border-block-start: 1px solid var(--footer-rule);
}

.public-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-5);
}

.public-footer-identity {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    max-inline-size: 34rem;
}

.public-footer-crest {
    flex: none;
    inline-size: 2.75rem;
    block-size: 2.75rem;
}

.public-footer-name {
    color: var(--footer-strong);
    font-weight: 650;
    font-size: var(--text-md);
    line-height: 1.3;
    margin-block-end: var(--space-1);
}

.public-footer-department { margin-block-end: 0; }

.public-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
}

.public-footer a {
    color: var(--footer-strong);
    text-decoration: none;
    border-block-end: 1px solid var(--footer-rule);
    padding-block-end: 2px;
}

.public-footer a:hover {
    color: var(--footer-strong);
    border-block-end-color: currentColor;
}

/* The line that closes it: the year and the standing the service has, set quietly. */
.public-footer-note {
    margin-block: var(--space-5) 0;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--footer-rule);
    font-size: var(--text-xs);
    color: var(--footer-text);
}

/* -- Portal landing -----------------------------------------------------------------------

   Read on a cheap phone, outdoors, often by somebody who has never used a government site
   and will not come back if the first visit confuses them. So: one obvious primary action,
   type large enough to read in sunlight, and nothing decorative competing with either.

   The hero carries no card of its own. It used to, and the two doors sat inside it, which
   made them read as the contents of a box rather than as the point of the page.
   ----------------------------------------------------------------------------------------- */

/* ==========================================================================================
   The landing page
   ==========================================================================================
   Somebody arrives here from a poster, a QR code at a district office, or a search result,
   usually on a phone, often unsure whether this is the real thing. So the page does three
   things in order: it puts both doors on screen without scrolling, it says plainly what
   happens after one is pressed, and it shows what the desk has already done.

   The opening band carries the department's own green rather than a white page with a heading
   on it: the doors sit inside the band, which is what keeps them above the fold at 360px.

   Motion here is opted into, never out of. Every animation below sits inside
   (prefers-reduced-motion: no-preference), so the resting page -- what a reader who has asked
   for stillness sees, and what a browser too old for any of it sees -- is the finished page,
   with nothing hidden and nothing waiting on a cue that may not come. Nothing animates a
   property that costs the renderer a layout: opacity, and the individual `translate` and
   `scale` properties, which leave `transform` free for the hover states so that an element
   can be mid-arrival and still answer a pointer.
   ========================================================================================== */

@keyframes desk-rise {
    from { opacity: 0; translate: 0 0.75rem; }
    to   { opacity: 1; translate: none; }
}

@keyframes desk-settle {
    from { opacity: 0; scale: 0.84; }
    to   { opacity: 1; scale: none; }
}

.desk-band {
    position: relative;
    isolation: isolate;
    overflow: hidden;

    /* Exactly the container's own gutter, so the band sits flush with the viewport edge
       instead of a few pixels proud of it and scrolling the page sideways. Bootstrap's
       .container pads --bs-gutter-x (1.5rem) halved; --space-3 is that 0.75rem. The top
       cancels the main element's py-4 so the band meets the header. */
    margin-block: calc(var(--space-5) * -1) var(--space-6);
    margin-inline: calc(var(--space-3) * -1);
    padding: var(--space-5);
    border-end-start-radius: var(--radius-lg);
    border-end-end-radius: var(--radius-lg);

    /* Three greens rather than two, and the light placed off-centre. A single linear fill at
       this size reads as a printed rectangle, which is most of what dated the page. */
    background:
        radial-gradient(ellipse 90% 70% at 88% -10%, rgba(94, 201, 140, 0.30), transparent 70%),
        radial-gradient(ellipse 70% 60% at 6% 112%, rgba(34, 161, 85, 0.20), transparent 72%),
        linear-gradient(152deg, var(--green-900) 8%, var(--green-800) 56%, var(--green-700));
    color: #fff;
}

/* A gradient is placed in physical percentages and no amount of logical properties will
   mirror it, while the glow on ::after below is positioned and mirrors by itself. Said again
   the other way round, so the light falls on the same side of the reader's own page in both
   scripts instead of the two lighting opposite corners. */
[dir="rtl"] .desk-band {
    background:
        radial-gradient(ellipse 90% 70% at 12% -10%, rgba(94, 201, 140, 0.30), transparent 70%),
        radial-gradient(ellipse 70% 60% at 94% 112%, rgba(34, 161, 85, 0.20), transparent 72%),
        linear-gradient(208deg, var(--green-900) 8%, var(--green-800) 56%, var(--green-700));
}

/* Two decorative layers, and neither of them an element in the markup. A fine dot field
   gives the green some tooth at the size a desktop shows it at, and is masked away before it
   reaches the doors so it never competes with the words on them. */
.desk-band::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
    background-size: 1.375rem 1.375rem;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
    mask-image: linear-gradient(180deg, #000, transparent 70%);
    pointer-events: none;
}

/* A soft light in the corner the eye reaches first, sized in the band's own terms so it keeps
   its proportion from a phone to a wide desktop. */
.desk-band::after {
    content: "";
    position: absolute;
    inset-block-start: -45%;
    inset-inline-end: -12%;
    inline-size: min(34rem, 85%);
    aspect-ratio: 1;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 241, 227, 0.20), transparent 68%);
    pointer-events: none;
}

@media (min-width: 48rem) {
    .desk-band {
        margin-inline: 0;
        padding: var(--space-7) var(--space-6) var(--space-6);
        border-radius: var(--radius-lg);
    }

    /* Everything a phone had to give up, given back where the width exists to afford it. */
    .desk-opening { margin-block-end: var(--space-5); }

    .desk-door {
        gap: var(--space-4);
        min-block-size: 5.75rem;
        padding: var(--space-4) var(--space-5);
    }

    .desk-door-arrow {
        inline-size: 1.25rem;
        block-size: 1.25rem;
        padding: 0.625rem;
    }
}

/* The opening is centred and the doors below it are not: the band reads as a masthead over
   a pair of choices, rather than as one long left-aligned column. The department's own name
   carries the authority here -- somebody arriving from a search result is deciding whether
   this is the real thing -- so it is set at reading size rather than as a caption. */
.desk-opening {
    text-align: center;
    margin-block-end: var(--space-4);
}

.desk-eyebrow {
    margin-block: 0 var(--space-3);
    /* Larger than the lead below the title, not smaller: this line is the only thing on the
       page that tells a stranger whose service this is. */
    font-size: clamp(1.0625rem, 0.85rem + 0.9vw, 1.625rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;

    /* Literal, not a token: the band is dark green whichever way the page goes, so this line
       is light in both. A token here followed the theme and turned the department's own name
       dark on dark. */
    color: #dcf1e3;
}

.desk-title {
    margin-block: 0 var(--space-3);
    max-inline-size: 22ch;
    margin-inline: auto;
    font-size: clamp(1.75rem, 1.1rem + 2.8vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: #fff;
}

.desk-lead {
    margin-block: 0;
    max-inline-size: 56ch;
    margin-inline: auto;
    font-size: var(--text-lg);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.84);
}

/* The opening arrives in reading order, each line a breath behind the one above it: under
   six-tenths of a second from the crest to the second door, and then never again.

   `backwards` rather than `both` is the whole trick. It holds the opening frame through the
   delay and then lets go completely, so a door that has finished arriving is back under the
   control of its own rules and still answers a hover. `both` would leave the animation's last
   frame winning the cascade for the life of the page, and the lift below would never run. */
@media (prefers-reduced-motion: no-preference) {
    .desk-crest   { animation: desk-settle 560ms var(--ease-entrance) backwards; }
    .desk-eyebrow { animation: desk-rise 560ms var(--ease-entrance) 70ms backwards; }
    .desk-title   { animation: desk-rise 560ms var(--ease-entrance) 130ms backwards; }
    .desk-lead    { animation: desk-rise 560ms var(--ease-entrance) 190ms backwards; }

    .desk-door:nth-child(1) { animation: desk-rise 560ms var(--ease-entrance) 250ms backwards; }
    .desk-door:nth-child(2) { animation: desk-rise 560ms var(--ease-entrance) 310ms backwards; }
}

/* Both doors are why somebody came, so both are full-width rows on a phone and a pair of
   columns once there is room -- never a wide one and a narrow one. */
.desk-doors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: var(--space-3);
}

.desk-door {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-block-size: 5.5rem;
    padding: var(--space-4);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
    transition:
        transform 200ms var(--ease-entrance),
        background-color 200ms ease,
        border-color 200ms ease;
}

/* The lift wants a shadow, and a shadow animated as a shadow is a fresh blur over a large
   area every frame. It is painted once on a layer of its own instead, and only its opacity
   moves -- which the compositor can do without troubling the renderer at all. */
.desk-door::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    box-shadow: 0 1rem 2rem rgba(3, 20, 11, 0.45);
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.desk-door-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-inline-size: 0;
}

.desk-door-title {
    font-size: var(--text-xl);
    font-weight: 650;
    line-height: 1.25;
    color: #fff;
}

.desk-door-help {
    font-size: var(--text-base);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.desk-door:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transform: translateY(-3px);
}

.desk-door:hover::after,
.desk-door:focus-visible::after { opacity: 1; }

/* A press has to answer at once or the tap reads as dropped -- which on a slow phone is
   exactly when somebody presses it a second time. */
.desk-door:active {
    transform: translateY(-1px) scale(0.995);
    transition-duration: 90ms;
}

.desk-door:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* The one that most people came for reverses out of the band, so the choice is obvious
   without a second colour being introduced. */
.desk-door-primary {
    background: #fff;
    border-color: #fff;
}

/* The same again: this door is white in both themes, so its text is dark in both. */
.desk-door-primary .desk-door-title { color: #0b3d21; }
.desk-door-primary .desk-door-help { color: #344054; }
.desk-door-primary:hover { background: #f0f9f3; border-color: #f0f9f3; }
.desk-door-primary::after { box-shadow: 0 1rem 2rem rgba(3, 20, 11, 0.55); }

/* Decorative, and the chip behind it is drawn by this rule rather than by another span in the
   markup. Flipped rather than duplicated for Urdu. */
.desk-door-arrow {
    flex: none;
    box-sizing: content-box;
    inline-size: 1rem;
    block-size: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    transition: transform 200ms var(--ease-entrance), background-color 200ms ease;
}

/* Literal for the same reason the title above is: the white door stays white in both themes,
   so a token that turns over underneath it would put dark green on near-black. */
.desk-door-primary .desk-door-arrow {
    background: #dcf1e3;
    color: #166534;
}

.desk-door:hover .desk-door-arrow {
    transform: translateX(0.3rem);
    background: rgba(255, 255, 255, 0.22);
}

.desk-door-primary:hover .desk-door-arrow { background: #c9e8d7; }

[dir="rtl"] .desk-door-arrow { transform: scaleX(-1); }
[dir="rtl"] .desk-door:hover .desk-door-arrow { transform: scaleX(-1) translateX(0.3rem); }

/* -- What happens next --------------------------------------------------------------------
   The reassurance a government complaint portal most often fails to give. Three short
   statements, numbered, because the order is the point. Each is a card of its own now: run
   together as three lines of text on a phone, they read as one paragraph and nobody got past
   the first clause. */

.desk-next h2,
.desk-figures h2 {
    margin-block: 0 var(--space-4);
    font-size: var(--text-xl);
    font-weight: 650;
    color: var(--ink-900);
}

.desk-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.desk-steps li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: transform 200ms var(--ease-entrance), border-color 200ms ease;
}

.desk-steps li:hover {
    transform: translateY(-2px);
    border-color: var(--green-500);
}

.desk-step-number {
    flex: none;
    display: grid;
    place-items: center;
    inline-size: 2.25rem;
    block-size: 2.25rem;
    border-radius: 50%;
    border: 1px solid var(--green-100);
    background: linear-gradient(145deg, var(--green-100), var(--green-50));
    color: var(--brand-text);
    font-weight: 700;
    font-size: var(--text-md);
}

.desk-step-text {
    font-size: var(--text-md);
    line-height: 1.55;
    color: var(--ink-700);
}

.desk-promise {
    margin-block: var(--space-5) 0;
    padding-block: var(--space-2);
    padding-inline-start: var(--space-4);
    border-inline-start: 3px solid var(--green-600);
    font-size: var(--text-md);
    line-height: 1.6;
    color: var(--ink-800);
}

/* -- What the desk has done ----------------------------------------------------------------
   The same figures the statistics page publishes, behind the same setting. Shown because a
   number a visitor can check is worth more than any amount of assurance. */

.desk-figures {
    margin-block-start: var(--space-6);
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(ellipse 70% 120% at 100% 0%, var(--green-50), transparent 72%),
        var(--surface-muted);
}

.desk-figure-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--space-4);
    margin: 0;
}

/* The number first in the reading order would be a headline with no subject. The label is
   written above it and the number below, and the pair is flipped visually, so a screen
   reader hears "complaints received, four hundred" rather than "four hundred" alone. */
.desk-figure {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-1);
}

.desk-figure dt {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-600);
}

.desk-figure dd {
    margin: 0;
    font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--brand-text);

    /* Every digit the same width, so a figure counting up to itself does not shuffle the
       label underneath it from frame to frame. */
    font-variant-numeric: tabular-nums;
}

.desk-figure-note {
    margin-block: var(--space-4) 0;
    font-size: var(--text-sm);
}

.desk-figure-note a { color: var(--link); }

/* Everything below the band arrives as it is scrolled to rather than on a timer started at
   load, so somebody who lands halfway down the page or scrolls straight past is never looking
   at an empty box waiting for a cue that has already gone.

   Driven by the scroll position itself: no listener, no observer, nothing running when the
   page is still. Where the browser has no view timeline the @supports test fails, no
   animation-name is ever set, and the sections are simply there -- which is the correct
   fallback and the reason this is written as an opt-in rather than a hide-then-reveal. */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .desk-next > h2,
        .desk-steps li,
        .desk-promise,
        .desk-figures,
        .desk-secondary > * {
            animation-name: desk-rise;
            animation-duration: auto;
            animation-timing-function: linear;
            animation-fill-mode: both;
            animation-timeline: view();

            /* Finished by the time the element is most of the way into the viewport, rather
               than a quarter of the way through the scroll past it: a line of text sitting
               on screen at two-thirds opacity is not a reveal, it is a page that looks
               broken. Measured, not guessed -- see the note on the stagger below. */
            animation-range: entry 10% entry 80%;
        }

        /* The three arrive across rather than together: one animation read off one scroll,
           offset by where each card is asked to start. Side by side on a desktop that reads
           as a cascade from the left; stacked on a phone each simply arrives as it is
           reached. */
        .desk-steps li:nth-child(2) { animation-range: entry 18% entry 88%; }
        .desk-steps li:nth-child(3) { animation-range: entry 26% entry 96%; }
    }
}

/* -- The quieter half of the page ------------------------------------------------------- */

.desk-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--space-5);
    margin-block-start: var(--space-6);
    padding-block-start: var(--space-5);
    border-block-start: 1px solid var(--border);
}

.desk-links h2 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-500);
    margin-block-end: var(--space-1);
}

.desk-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Rows rather than bare links: a tap target on a phone has to be reachable by a thumb, and
   a line of text is not. */
.desk-links a {
    display: block;
    padding-block: var(--space-3);
    font-size: var(--text-md);
    color: var(--link);
    text-decoration: none;
    border-block-end: 1px solid var(--border);
}

.desk-links li:last-child a { border-block-end: 0; }

.desk-links a:hover,
.desk-links a:focus-visible {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Staff sign-in is not for the public. Quieter, so it never competes with the two doors. */
.desk-links-staff a { color: var(--ink-600); }
.desk-links-staff a:hover,
.desk-links-staff a:focus-visible { color: var(--ink-900); }

/* Nastaliq sits lower and taller than Latin, so the band's headline needs the room. */
[lang="ur"] .desk-title { line-height: 1.6; }
[lang="ur"] .desk-lead,
[lang="ur"] .desk-step-text { line-height: 2; }

/* Tiered, not switched off. What goes is displacement -- the lift under a pointer, the
   arrow's travel, the press -- because that is what makes somebody dizzy. What stays is
   everything that carries meaning: the colour change that says a card is under the pointer,
   and the focus ring.

   Nothing here has to turn an entrance off. Every animation on this page is declared inside
   (prefers-reduced-motion: no-preference), so under this query no animation-name is set at
   all and there is nothing hidden waiting to be let in. */
@media (prefers-reduced-motion: reduce) {
    .desk-door,
    .desk-door-arrow,
    .desk-steps li { transition: background-color 0.01ms, border-color 0.01ms; }

    .desk-door:hover,
    .desk-door:active,
    .desk-steps li:hover { transform: none; }

    .desk-door:hover .desk-door-arrow { transform: none; }
    [dir="rtl"] .desk-door-arrow,
    [dir="rtl"] .desk-door:hover .desk-door-arrow { transform: scaleX(-1); }
}

/* The sign-in page. The card on its own left a small box adrift in a wide grey field and
   answered neither question people arrive with -- am I in the right place, and what if I
   cannot get in. The explanation sits beside it on a desktop and above it on a phone. */
.auth-layout {
    display: grid;
    gap: var(--space-6);
    margin-block: var(--space-7);
}

@media (min-width: 62rem) {
    .auth-layout {
        grid-template-columns: minmax(0, 1fr) 26rem;
        gap: var(--space-7);
        align-items: center;
    }
}

/* On a phone the form comes first: somebody who knows their password should not scroll past
   an explanation written for somebody who does not. */
@media (max-width: 61.99rem) {
    .auth-layout .auth-card { order: -1; }
}

.auth-layout .auth-card { margin-block: 0; }

.auth-intro { max-inline-size: 44ch; }

.auth-eyebrow {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--brand-text);
    margin-block-end: var(--space-2);
}

.auth-title {
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ink-900);
    margin-block: 0 var(--space-3);
}

.auth-lead {
    font-size: var(--text-lg);
    line-height: 1.6;
    color: var(--ink-600);
    margin-block-end: var(--space-4);
}

.auth-aside {
    font-size: var(--text-base);
    color: var(--ink-600);
    margin-block-end: 0;
}

/* Set apart from the form: it is read when the form has already failed. */
.auth-help {
    margin-block: var(--space-4) 0;
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--ink-600);
}

.auth-card {
    max-inline-size: 26rem;
    margin-inline: auto;
    margin-block: var(--space-7);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
}

.auth-card h1 {
    font-size: var(--text-xl);
    margin-block-end: var(--space-5);
    text-align: center;
}

.content-page {
    max-inline-size: 46rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-6);
}

.content-page h2 { margin-block-start: var(--space-5); }

/* ==========================================================================================
   Wizard — the seven-step public lodging form
   ========================================================================================== */

.wizard {
    /* Wide enough for the first step's twelve answers to sit three across. A form is not
       prose: the measure that matters is the width of a field, and every field here is in a
       row of its own or in a pair. */
    max-inline-size: 52rem;
    margin-inline: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-6);
}

.wizard > h1 {
    font-size: var(--text-xl);
    margin-block: var(--space-2) var(--space-5);
}

.wizard-progress ol {
    display: flex;
    list-style: none;
    margin: 0 0 var(--space-4);
    padding: 0;
    gap: var(--space-1);
}

.wizard-progress li {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    text-align: center;
    position: relative;
}

/* The connecting rule sits behind the numbers and stops at the row's edges, so the first and
   last steps do not trail a line into nothing. */
.wizard-progress li::before {
    content: "";
    position: absolute;
    inset-block-start: 0.875rem;
    inset-inline: -50% 50%;
    block-size: 2px;
    background: var(--ink-200);
}

.wizard-progress li:first-child::before { display: none; }
.wizard-progress li.done::before,
.wizard-progress li.current::before { background: var(--green-600); }

.wizard-step-number {
    position: relative;
    z-index: 1;
    inline-size: 1.75rem;
    block-size: 1.75rem;
    border-radius: var(--radius-pill);
    display: grid;
    place-items: center;
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--surface);
    border: 2px solid var(--ink-300);
    color: var(--ink-500);
}

.wizard-progress li.done .wizard-step-number {
    background: var(--green-600);
    border-color: var(--green-600);
    color: #fff;
}

.wizard-progress li.current .wizard-step-number {
    border-color: var(--green-600);
    color: var(--brand-text);
    box-shadow: var(--focus-ring);
}

.wizard-step-label {
    font-size: var(--text-xs);
    color: var(--ink-600);
    line-height: 1.3;
}

.wizard-progress li.current .wizard-step-label {
    color: var(--brand-text);
    font-weight: 600;
}

/* On a phone the seven labels cannot fit; the numbered track alone still shows progress. */
@media (max-width: 36rem) {
    .wizard-step-label { display: none; }
    .wizard { padding: var(--space-4); border-radius: 0; }
}

.wizard-position {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-500);
    font-weight: 600;
    margin: 0;
}

.wizard-actions .btn-secondary { margin-inline-end: auto; }

.wizard-actions {
    display: flex;

    /* Continue sits at the end of the row, and Back — where there is one — is pushed to the
       start. space-between did that only while there were two of them: on the first step,
       which has no Back, it left Continue stranded at the start of the row. Logical ends, so
       the pair swaps over with the page in Urdu. */
    justify-content: flex-end;
    gap: var(--space-3);
    margin-block-start: var(--space-6);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
}

/* A column of twelve answers is a page and a half of scrolling to pick one of them. They
   go across as well as down, as many to a row as the width allows, and the question and its
   answers are on screen together. */
.choice-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: var(--space-2);
    margin-block: var(--space-3);
}

/* A legend is a child of the fieldset, so once the fieldset became a grid the legend became
   a cell of it and stood in a column beside the answers it was asking about. */
.choice-list > legend {
    grid-column: 1 / -1;
    float: none;
}

/* One grid for a form's fields rather than a row apiece: seven fields took seven lines and
   half of each of them was empty. */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-2) var(--space-3);
    margin-block-end: var(--space-3);
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-inline-size: 0;
}

.field .form-label { margin-block-end: 0; }
.field .form-text { margin-block-start: 0; }

/* A field that wants the whole line: a picker with three selects in it, or an address. */
.field-wide { grid-column: 1 / -1; }

/* A small heading over a group of fields — "Where you live" — where a legend would mean a
   fieldset inside a fieldset for three boxes. */
/* ==========================================================================================
   Type to find
   ==========================================================================================

   A dropdown of seventy subjects or forty-one districts, with a box above it to narrow them
   down. The real <select> is still underneath, still named, still posted and still what the
   browser validates — it is moved aside rather than hidden, because a display:none control
   that is required makes the browser refuse to submit and refuse to say why.
*/

.combo { position: relative; }

.combo-source {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 0;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.combo-input { margin-block: 0; }

.combo-list {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    inset-block-start: calc(100% + 2px);
    margin: 0;
    padding: var(--space-1);
    list-style: none;
    max-block-size: 15rem;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.combo-option {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-base);
}

.combo-option.is-active,
.combo-option:hover {
    background: var(--green-50);
    color: var(--brand-text);
}

/* The heading the options were grouped under, kept while filtering: a district means a
   different place under one division than under another.

   Drawn the way a dropdown has always drawn one — bold, in the same words and the same size,
   with its options indented under it — rather than as a band of small grey capitals. */
.combo-group {
    padding: var(--space-2) var(--space-2) var(--space-1);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--ink-800);
}

.combo-group + .combo-option,
.combo-group ~ .combo-option { padding-inline-start: var(--space-5); }

.field-heading {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-700);
    margin-block: var(--space-4) var(--space-2);
}

/* The card is the tap target, not just the radio — this is filled in on a phone more often
   than on a desktop. The label alone covers only its own text, so it is stretched over the
   card below; the comment here used to claim the card was already the target when the padding
   and the space beside the text were both dead. */
.choice {
    position: relative;
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-3);
    cursor: pointer;
    background: var(--surface);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

.choice:hover { border-color: var(--green-500); background: var(--green-50); }

/* :has() is unavailable on older WebViews. The native radio is always rendered, so selection
   remains visible there — this only adds the card-level highlight where it is supported. */
.choice:has(input:checked) {
    border-color: var(--green-600);
    background: var(--green-50);
    box-shadow: inset 0 0 0 1px var(--green-600);
}

.choice:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* The label's hit area covers the whole card, padding included. It is transparent, so
   nothing moves and the radio keeps its own appearance; a click anywhere lands on the label,
   which is what reaches the control. */
.choice > label {
    flex: 1;
    cursor: pointer;
}

.choice > label::before,
.choice-option .form-check-label::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.choice-name { font-weight: 500; color: var(--ink-900); }

.choice-help {
    display: block;
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.review-list { margin: 0; }

.review-row {
    display: grid;
    grid-template-columns: 12rem 1fr auto;
    gap: var(--space-3);
    padding-block: var(--space-3);
    border-block-end: 1px solid var(--border);
    align-items: baseline;
}

.review-row:last-child { border-block-end: 0; }

.review-body { color: var(--ink-900); white-space: pre-wrap; }

.review-change { font-size: var(--text-sm); }

@media (max-width: 36rem) {
    .review-row { grid-template-columns: 1fr auto; }
    .review-body { grid-column: 1 / -1; }
}

/* What the complainant themselves wrote, shown back to them. Preserved line breaks, because
   somebody who typed three paragraphs should see three paragraphs. */
/* -- Tracking a complaint without signing in ---------------------------------------------- */

/* The form and what it gets you, side by side. One column on anything narrow, and the panel
   goes under the form there rather than above it: the form is what they came for. */
.track-page {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-5);
    align-items: start;
    margin-block: var(--space-4) var(--space-6);
}

@media (max-width: 58rem) {
    .track-page { grid-template-columns: 1fr; gap: var(--space-4); }
}

.track-card {
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.track-card h1 { margin-block-end: var(--space-2); }

.track-lead {
    color: var(--ink-600);
    margin-block-end: var(--space-4);
}

.track-form { display: grid; gap: var(--space-4); }

/* The tracking number is a code read off a piece of paper, so it is set like one. */
.track-number-input {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.track-identity { margin: 0; }

.track-identity legend {
    margin-block-end: var(--space-2);
    color: var(--ink-700);
}

.track-identity .field-grid { margin-block-end: var(--space-1); }

.track-submit { justify-self: start; }

/* What answering the form gets you, in the words of what the next screen actually offers. */
.track-aside {
    padding: var(--space-5);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.track-aside h2 { color: var(--ink-700); }

.track-points {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: grid;
    gap: var(--space-3);
}

.track-points li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    color: var(--ink-700);
}

.track-points svg {
    flex: none;
    inline-size: 1.125rem;
    block-size: 1.125rem;
    margin-block-start: 0.15em;
    color: var(--link);
}

.track-lost {
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
}

.track-lost-title {
    font-weight: 600;
    color: var(--ink-800);
    margin-block-end: var(--space-1);
}

.track-lost-help {
    font-size: var(--text-sm);
    color: var(--ink-600);
    margin-block-end: var(--space-2);
}

.track-body {
    white-space: pre-wrap;
    color: var(--ink-800);
    background: var(--surface-muted);
    border-inline-start: 3px solid var(--border-strong);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-block-end: var(--space-4);
}

.track-evidence {
    list-style: none;
    margin: 0 0 var(--space-4);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.track-evidence li {
    padding: var(--space-2) var(--space-3);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

/* One point on the satisfaction scale. Generous targets: this is answered on a handset, often
   one-handed, by somebody who has already had a frustrating few months. */
/* A radio or checkbox that carries a real decision: the whole row is the target, not the
   8px circle beside it. Used on the portal where a citizen chooses who may see their
   identity, and for the declaration the complaint is made under. */
.choice-option {
    position: relative;
    padding: var(--space-3) var(--space-4);
    padding-inline-start: 2.75rem;
    margin-block-end: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

.choice-option .form-check-input {
    margin-inline-start: -1.75rem;
    margin-block-start: 0.2rem;
}

.choice-option:hover {
    border-color: var(--green-500);
    background: var(--green-50);
}

.choice-option:has(input:checked) {
    border-color: var(--green-600);
    background: var(--green-50);
}

.choice-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }

.choice-option .form-check-label {
    display: block;
    cursor: pointer;
}

.choice-option-title {
    display: block;
    font-weight: 600;
    color: var(--ink-900);
}

.choice-option-help {
    display: block;
    margin-block-start: var(--space-1);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--ink-600);
}

/* The declaration is not one of a set, so it stands on its own rather than in a stack. */
.choice-option-consent {
    margin-block: var(--space-5) var(--space-4);
    border-color: var(--border-strong);
}

.satisfaction-option {
    padding: var(--space-3) var(--space-4);
    margin-block-end: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.satisfaction-option:hover { border-color: var(--green-500); background: var(--green-50); }

.satisfaction-option:has(input:checked) {
    border-color: var(--green-600);
    background: var(--green-50);
    box-shadow: var(--focus-ring);
}

.satisfaction-option .form-check-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    font-size: var(--text-md);
    cursor: pointer;
}

.satisfaction-option i { font-size: var(--text-lg); }

.satisfaction-option .form-text { inline-size: 100%; margin: 0; }

/* ==========================================================================================
   Tracking number — the one thing a complainant must not lose
   ========================================================================================== */

.tracking-number-panel {
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-inline-start: 4px solid var(--green-600);
    border-radius: var(--radius);
    padding: var(--space-5);
    text-align: center;
    margin-block: var(--space-4);
}

.tracking-number-label {
    display: block;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-text);
    font-weight: 600;
}

/* Always left-to-right and monospaced, even in the Urdu UI: a reference number read back over
   the telephone must not be reordered by the bidirectional algorithm. */
.tracking-number {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--brand-text);
    direction: ltr;
    unicode-bidi: isolate;
    margin-block-start: var(--space-2);
}

.submitted { max-inline-size: 40rem; margin-inline: auto; text-align: center; }

.submitted-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-block-start: var(--space-5);
}

.registered-panel { margin-block-start: var(--space-4); }

.track-form { max-inline-size: 30rem; }

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.track-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-4);
    margin-block: var(--space-4);
}

.track-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-block-start: var(--space-4);
}

/* ==========================================================================================
   Status chips and SLA countdowns
   ========================================================================================== */

/* The colour comes from the status row's own ColourHex, passed in as --chip, so an
   administrator who adds a status gets a correctly coloured chip with no CSS change. */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.1875rem var(--space-3);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;

    /* Plain fallback first: an Android WebView without color-mix still gets a legible chip
       with a neutral background rather than coloured text floating on the page. */
    color: var(--chip, var(--ink-700));
    background: var(--ink-100);
    border: 1px solid var(--border);

    /* The status colours are master data, picked to be recognised rather than to be read on
       a wash of themselves: #f59e0b on a 12% wash of #f59e0b is 1.96:1. The chip keeps the
       hue and carries the word most of the way to black, which holds every colour on the
       list above 4.9:1 and still reads as amber, as indigo, as grey. */
    color: color-mix(in srgb, var(--chip, var(--ink-500)) 60%, black);
    background: color-mix(in srgb, var(--chip, var(--ink-500)) 12%, white);
    border: 1px solid color-mix(in srgb, var(--chip, var(--ink-500)) 30%, white);
}

.status-chip-sm { font-size: var(--text-xs); padding: 0.0625rem var(--space-2); }

.countdown {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: var(--text-sm);
    padding: 0.125rem var(--space-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.countdown-ok        { color: var(--ok); background: var(--ok-bg); }
.countdown-warning   { color: var(--warning); background: var(--warning-bg); }
.countdown-critical  { color: var(--critical); background: var(--critical-bg); }
.countdown-breached  { color: var(--danger); background: var(--danger-bg); }
.countdown-none      { color: var(--ink-500); background: var(--ink-100); }

.countdown-label {
    font-size: var(--text-xs);
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================================================================
   Admin shell
   ========================================================================================== */

body.admin { background: var(--surface-muted); }

.admin-header {
    height: var(--admin-header-height);
    background: var(--green-800);
    color: #fff;
    display: flex;
    align-items: center;
    padding-inline: var(--space-4);
    box-shadow: var(--shadow);
    border-block-end: 1px solid var(--header-rule);
    position: sticky;
    inset-block-start: 0;
    z-index: 20;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .admin-header {
        background: linear-gradient(180deg, var(--header-top), var(--header-bottom));
        -webkit-backdrop-filter: blur(18px) saturate(180%);
        backdrop-filter: blur(18px) saturate(180%);
        box-shadow: inset 0 1px 0 var(--header-sheen), 0 10px 30px rgba(0, 0, 0, 0.22);
    }
}

.admin-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-4);

    /* One line, always. The bar is what every page below it is positioned against, so a
       second line here moves the whole application down by a line. */
    flex-wrap: nowrap;
    min-inline-size: 0;
}

.admin-brand {
    flex: 0 0 auto;
    white-space: nowrap;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.admin-brand:hover { color: #fff; opacity: 0.9; }

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 0 0 auto;
    min-inline-size: 0;
}

/* "Sign out" was coming out as two lines of one word each. */
.admin-header-actions .btn { white-space: nowrap; }

.admin-body {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--admin-header-height));
}

.admin-nav {
    inline-size: var(--admin-nav-width);
    flex: 0 0 var(--admin-nav-width);
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    min-block-size: calc(100vh - var(--admin-header-height));
    padding-block: var(--space-2);
    overflow-y: auto;
    position: sticky;
    inset-block-start: var(--admin-header-height);
    max-block-size: calc(100vh - var(--admin-header-height));
}

.admin-main {
    flex: 1 1 auto;
    padding: var(--space-5);
    min-inline-size: 0;
    max-inline-size: 90rem;
}

/* The menu of forty masters collapses to a drawer on a phone; a district officer opening
   this on a cheap Android should not get a sidebar taking half the screen. */
@media (max-width: 48rem) {
    .admin-body { flex-direction: column; }

    .admin-nav {
        inline-size: 100%;
        flex-basis: auto;
        min-block-size: 0;
        max-block-size: 14rem;
        border-inline-end: 0;
        border-block-end: 1px solid var(--border);
        position: static;
    }

    .admin-main { padding: var(--space-4); }
}

/* -- Menu -------------------------------------------------------------------------------- */

.admin-menu,
.admin-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-menu-group + .admin-menu-group { border-block-start: 1px solid var(--ink-100); }

.admin-menu-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    inline-size: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: 0;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--ink-700);
    text-align: start;
}

.admin-menu-group-toggle:hover { background: var(--ink-50); color: var(--ink-900); }

.admin-menu-count {
    font-weight: 500;
    font-size: var(--text-xs);
    color: var(--ink-500);
    background: var(--ink-100);
    border-radius: var(--radius-pill);
    padding: 0.0625rem var(--space-2);
}

.admin-menu-items a,
.admin-menu-single {
    display: block;
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-6);
    color: var(--ink-700);
    text-decoration: none;
    font-size: var(--text-sm);
    border-inline-start: 3px solid transparent;
}

.admin-menu-single { padding-inline-start: var(--space-4); font-weight: 600; }

.admin-menu-items a:hover,
.admin-menu-single:hover { background: var(--ink-50); color: var(--ink-900); }

.admin-menu-items a.active {
    background: var(--green-50);
    color: var(--brand-text);
    font-weight: 600;
    border-inline-start-color: var(--green-600);
}

/* ==========================================================================================
   Officer and operator shells
   ========================================================================================== */

body.officer,
body.operator { background: var(--surface-muted); }

.officer-main,
/* Tighter than the officer's screen above it on purpose: this is the one console somebody
   works with a caller waiting, and the margin was a field's worth of height. */
.operator-main {
    padding: var(--space-3) var(--space-5);
    max-inline-size: 90rem;
    margin-inline: auto;
}

@media (max-width: 48rem) {
    .officer-main,
    .operator-main { padding: var(--space-4); }
}

/* The consoles an officer may reach, in the header bar. Links rather than tabs, because
   they leave the page rather than filtering it. */
.officer-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-inline-start: var(--space-4);

    /* The links take what is left between the name and the actions. Where there are more of
       them than there is room -- a focal person who is also an operator sees five -- they
       scroll sideways rather than wrapping the bar onto a second line. */
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-inline-size: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.officer-nav::-webkit-scrollbar { display: none; }

.officer-nav a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    padding: 0.4rem var(--space-3);
    border-radius: var(--radius-pill);
    transition: background 120ms ease, color 120ms ease;
}

.officer-nav a:hover,
.officer-nav a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

/* Where you are, said by the navigation rather than only by the heading. */
.officer-nav a[aria-current="page"] {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .officer-nav a { transition: none; }
}

@media (max-width: 62rem) {
    .officer-nav {
        gap: var(--space-3);
        margin-inline-start: 0;
        font-size: var(--text-sm);
    }
}

/* The title and standfirst a console screen opens with. */
.inbox-header {
    margin-block-end: var(--space-5);
}

.inbox-header h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--ink-900);
    margin-block-end: var(--space-1);
}

.inbox-header p {
    color: var(--ink-600);
    font-size: var(--text-base);
    max-inline-size: 60rem;
    margin-block-end: 0;
}

/* -- Inbox ------------------------------------------------------------------------------- */

.inbox-tabs {
    display: flex;
    gap: var(--space-1);
    border-block-end: 1px solid var(--border);
    margin-block-end: var(--space-4);
    overflow-x: auto;
}

.inbox-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--ink-600);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--text-base);
    white-space: nowrap;
    border-block-end: 2px solid transparent;
    margin-block-end: -1px;
}

.inbox-tab:hover { color: var(--brand-text); background: var(--green-50); }

.inbox-tab.active {
    color: var(--brand-text);
    border-block-end-color: var(--green-600);
    font-weight: 600;
}

.inbox-tab-count {
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--ink-100);
    color: var(--ink-600);
    border-radius: var(--radius-pill);
    padding: 0.0625rem var(--space-2);
    font-variant-numeric: tabular-nums;
}

.inbox-tab.active .inbox-tab-count { background: var(--green-100); color: var(--brand-text); }

.inbox-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.inbox-subject {
    font-weight: 600;
    color: var(--ink-900);
    text-decoration: none;
    display: block;
}

.inbox-subject:hover { color: var(--link); text-decoration: underline; }

/* A date reads as one token, so it is kept off the subject's wrapping and never split. */
.inbox-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--ink-600);
}

.inbox-meta {
    display: block;
    font-size: var(--text-xs);
    color: var(--ink-500);
    margin-block-start: 0.125rem;
}

/* Queue switchers on the focal and verification consoles. Pills rather than the inbox's
   underlined tabs, because these switch the whole queue rather than filter one. */
.inbox-scopes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
}

.inbox-scope {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-700);
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: 500;
    white-space: nowrap;
}

.inbox-scope:hover { border-color: var(--green-500); color: var(--green-800); }

.inbox-scope.active {
    background: var(--green-700);
    border-color: var(--green-700);
    color: #fff;
}

.inbox-scope-count {
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--ink-100);
    color: var(--ink-600);
    border-radius: var(--radius-pill);
    padding: 0.0625rem var(--space-2);
    font-variant-numeric: tabular-nums;
}

/* Darkening the fill rather than lightening it: a white veil over the brand green leaves
   white type at 4.47:1, which is under the line for type this small. */
.inbox-scope.active .inbox-scope-count { background: rgba(0, 0, 0, 0.26); color: #fff; }

/* Acting on several complaints at once. The bar sits above the table and stays put while it
   is scrolled, because the selection is made below it. */
.inbox-bulk { margin-block-end: var(--space-4); }

.inbox-bulk-bar {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-radius: var(--radius);
    margin-block-end: var(--space-3);
}

/* A filter somebody uses often, saved. */
.inbox-saved-views {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
}

.inbox-saved-view {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-700);
    text-decoration: none;
    font-size: var(--text-sm);
}

.inbox-saved-view:hover {
    border-style: solid;
    border-color: var(--green-500);
    color: var(--brand-text);
}

.inbox-save-view {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* -- Complaint detail -------------------------------------------------------------------- */

.complaint-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-block-end: var(--space-4);
    display: flex;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.complaint-subject {
    font-size: var(--text-xl);
    margin-block: var(--space-2) 0;
}

.complaint-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.complaint-countdown { text-align: end; }
.complaint-countdown .countdown { font-size: var(--text-lg); }

/*
    Label and value, two pairs to a row.

    The columns are stated as an alternating pair rather than as auto-fit tracks. A dt and its
    dd are separate elements, so an auto-fit grid lays them out as independent cells and the
    third column of the first row takes the second label while its value drops to the row
    below — "Category / Pesticide adulteration / Location" over "Mand / Arrived by / Web
    Portal". Every value was against the wrong label, and the page read as nonsense. An
    alternating track keeps each pair together because dt and dd strictly alternate in the
    markup.
*/
.complaint-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
    column-gap: var(--space-4);
    row-gap: var(--space-3);
    margin-block: var(--space-4) 0;
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
    inline-size: 100%;
}

.complaint-facts > dt {
    font-weight: 500;
    color: var(--ink-600);
    font-size: var(--text-sm);
    margin: 0;
}

.complaint-facts > dd {
    margin: 0;
    color: var(--ink-900);
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

/* One pair to a row once there is no longer room for two. */
@media (max-width: 62rem) {
    .complaint-facts { grid-template-columns: max-content minmax(0, 1fr); }
}

.complaint-body {
    white-space: pre-wrap;
    line-height: 1.7;
    color: var(--ink-800);
    max-inline-size: 60ch;
}

/* A withheld identity is not an error and should not read as one — it is the system working. */
.identity-withheld {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--ink-100);
    color: var(--ink-600);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}

/* -- Timeline ---------------------------------------------------------------------------- */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.timeline-item {
    position: relative;
    padding-inline-start: var(--space-6);
    padding-block-end: var(--space-5);
}

/* The spine is drawn by each item except the last, so it stops at the final marker instead of
   running past it. */
.timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    inset-inline-start: 0.4375rem;
    inset-block: 1rem 0;
    inline-size: 2px;
    background: var(--ink-200);
}

.timeline-item:last-child { padding-block-end: 0; }

.timeline-marker {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0.375rem;
    inline-size: 1rem;
    block-size: 1rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 3px solid var(--green-600);
}

.timeline-date {
    font-size: var(--text-xs);
    color: var(--ink-500);
    font-variant-numeric: tabular-nums;
}

.timeline-status { font-weight: 600; color: var(--ink-900); }

.timeline-content { display: flex; flex-direction: column; gap: var(--space-1); }

.timeline-remarks {
    color: var(--ink-700);
    font-size: var(--text-sm);
    white-space: pre-wrap;
    background: var(--ink-50);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
}

/* -- Movements and ATRs ------------------------------------------------------------------ */

.movement-chain { display: flex; flex-direction: column; gap: var(--space-3); }

.movement {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    background: var(--surface);
}

.movement-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-block-end: var(--space-2);
}

.movement-hop {
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--ink-100);
    color: var(--ink-600);
    border-radius: var(--radius-sm);
    padding: 0.0625rem var(--space-2);
}

.movement-direction,
.movement-mode {
    font-size: var(--text-xs);
    color: var(--ink-600);
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.0625rem var(--space-2);
}

.movement-route {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--ink-800);
    flex-wrap: wrap;
}

.movement-meta {
    font-size: var(--text-xs);
    color: var(--ink-500);
    margin-block-start: var(--space-1);
}

.movement-instructions {
    font-size: var(--text-sm);
    color: var(--ink-700);
    background: var(--info-bg);
    border-inline-start: 3px solid var(--info);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    margin-block-start: var(--space-2);
}

.movement-atr {
    margin-block-start: var(--space-3);
    padding-block-start: var(--space-3);
    border-block-start: 1px dashed var(--border-strong);
    font-size: var(--text-sm);
    white-space: pre-wrap;
}

.movement-atr-form { margin-block-start: var(--space-2); }

/* The action button names the status it leads to, so an officer can see the consequence
   before committing to it. */
.action-target {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--ink-500);
    margin-block-start: 0.125rem;
}

.btn:hover .action-target { color: inherit; opacity: 0.85; }

.action-form {
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--green-600);
    border-radius: var(--radius-sm);
    background: var(--ink-50);
    padding: var(--space-4);
}

/* ==========================================================================================
   Operator console
   ========================================================================================== */

/* The console is as tall as the window and no taller. What is left over after the fields
   goes to the details box rather than to a band of nothing under the card. */
.intake {
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    min-block-size: calc(100dvh - 3.5rem - 2 * var(--space-3));
}

.intake-layout { flex: 1 1 auto; }

/* Empty but for the callback count, and on most days empty altogether — so it takes no
   height of its own when there is nothing in it. */
.intake-top {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.intake-top:has(.intake-callbacks) { margin-block-end: var(--space-2); }

/* Not a button: it is a standing count, and a warning-coloured button beside the one button
   on the screen that matters drew the eye away from it. */
.intake-callbacks {
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--critical);
    background: var(--critical-bg);
    border: 1px solid color-mix(in srgb, var(--critical) 35%, transparent);
    border-radius: var(--radius-pill);
    padding: 0.125rem var(--space-3);
}

/* Form on the left, what the operator reads while typing on the right. It collapses to one
   column early: a call-centre screen is often 1366px wide. */
.intake-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-4);

    /* The form stretches to the full height of the console so the details box can grow into
       what is left; the panels beside it keep to their own height at the top.

       The row has to be told to take the height as well: a grid row is content-sized by
       default, so stretching the item inside a short row stretches it to nothing. */
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
}

@media (max-width: 68rem) {
    .intake-layout { grid-template-columns: 1fr; }
}

.intake-main {
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    block-size: 100%;
}

/* The one field that is worth more room when there is more room. Written with both of
   its classes because .intake-field is declared below this and sets display: block, which
   would otherwise win and leave the box the height of its rows attribute with the space
   sitting under it. */
.intake-field.intake-field-grow {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-block-size: 4rem;
}

.intake-field-grow textarea.form-control { flex: 1 1 auto; min-block-size: 2.75rem; }

.intake-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-2) var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 1 1 auto;
}

/* Every control on this one form is a little shorter than the site's own. A call-centre
   screen is 768px tall with a browser's furniture in the top sixth of it, and the difference
   between a form that fits and one that does not is about this much per field. */
.intake .form-control,
.intake .form-select { padding-block: 0.25rem; }

/* The picker names itself — "Category", "Location" — and then names its first rung as well.
   The second line says nothing the first has not, until a rung is chosen and the names start
   being Division, District, Tehsil. */
.intake .cascading-picker-level[data-depth="0"] > .form-label { display: none; }

/* A line of small type where there was a legend and a rule. On a form this dense the
   furniture was taking more height than the fields it was introducing. */
.intake-eyebrow {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--ink-500);
    margin: 0 0 calc(var(--space-1) * -1);
}

.intake-card > .intake-eyebrow:first-child { margin-block-start: 0; }

.intake-row { display: grid; gap: var(--space-3); }
.intake-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.intake-row-subject { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.intake-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 48rem) {
    .intake-row-3,
    .intake-row-2,
    .intake-row-subject { grid-template-columns: 1fr; }
}

.intake-field { display: block; min-inline-size: 0; }

/* A label with something small beside it, sharing its line. */
.intake-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.intake-sameas {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-xs);
    color: var(--ink-600);
    white-space: nowrap;
}

.intake-sameas label { margin: 0; cursor: pointer; }
.intake-sameas input { margin: 0; }

/* Copied rather than typed: it reads as filled in, not as a box waiting for something. */
.intake .form-control[readonly] {
    background: var(--surface-sunken);
    color: var(--ink-700);
}

/* The identity question. A row rather than a stack: it is one question with two answers and
   it sits above the fields it governs, where a fieldset's worth of furniture would push the
   form past the bottom of the screen. */
.intake-identity {
    display: flex;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    flex-wrap: wrap;
    margin: 0;
}

/* Carries the section as well as the question now, so it reads as the heading it is. */
.intake-identity > legend {
    float: none;
    inline-size: auto;
    margin: 0 var(--space-2) 0 0;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
}

.intake-identity-choice { display: inline-flex; align-items: center; gap: var(--space-2); }
.intake-identity-choice label { font-size: var(--text-sm); margin: 0; }

/* The fields the answer governs, sharing the row with the number that is always taken. */
.intake-identity-fields {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

@media (max-width: 48rem) {
    .intake-identity-fields { grid-column: auto; grid-template-columns: 1fr; }
}

/* The console's own density. Every control on the site carries a bottom margin so that a
   form reads as a column of separated questions; here the grid does the separating, and the
   margins were adding a field's worth of height every three fields. */
.intake .form-label,
.intake .cascading-picker-label {
    margin-block-end: 0.0625rem;
    font-size: var(--text-xs);
}

.intake .form-control,
.intake .form-select { margin-block: 0; }

.intake .cascading-picker { gap: var(--space-2); margin-block: 0; }

.intake textarea.form-control { resize: vertical; }

/* The long tail: a dak reference, a father's name, a priority somebody asked for. Closed on
   a telephone call and opened for the few intakes that need it. */
.intake-more {
    border-block-start: 1px dashed var(--border);
    padding-block-start: var(--space-1);
}

.intake-more > summary {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--link);
}

.intake-more > *:not(summary) { margin-block-start: var(--space-3); }

/* Stays on the screen when the disclosure below it is opened. The button that registers
   the complaint is the one thing on this console that must never be hunted for, and opening
   "anything else" was pushing it off the bottom. */
.intake-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    position: sticky;
    inset-block-end: 0;
    z-index: 2;
    padding-block: var(--space-2);
    margin-block-start: calc(var(--space-2) * -1);
    background: var(--surface-muted);
    box-shadow: 0 -0.5rem 0.75rem -0.5rem rgba(0, 0, 0, 0.25);
}

.intake-actions > .btn { margin-inline-start: auto; }

.intake-nocomplaint { flex: 1 1 18rem; }

.intake-nocomplaint > summary {
    font-size: var(--text-sm);
    color: var(--ink-600);
    padding-block: var(--space-1);
}

.intake-nocomplaint[open] {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
}

.intake-nocomplaint form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-start: var(--space-3);
}

.intake-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-self: start;
    position: sticky;
    inset-block-start: var(--space-3);
}

.intake-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3) var(--space-4);
}

.intake-panel h2 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    margin-block-end: var(--space-2);
}

/* A call-centre panel is 768px tall and the browser's own furniture takes the top sixth of
   it. Below that the form is squeezed rather than scrolled: an operator with somebody on the
   line should not be reaching for a scroll wheel to find the button. */
@media (max-height: 46rem) {
    .intake-card { gap: 0.125rem; padding-block: var(--space-1) var(--space-2); }
    .intake-row { gap: var(--space-2); }
    .intake .form-control,
    .intake .form-select { padding-block: 0.1875rem; }
    .intake-eyebrow { margin-block-end: 0; }
    .intake-identity { gap: 0 var(--space-3); }
    .intake-field-grow textarea.form-control { min-block-size: 2.25rem; }
    .intake-more { padding-block-start: 0; }
    .intake-nocomplaint > summary { padding-block: 0; }
}


/* ------------------------------------------------------------------------------------------
   Looking one up for a caller
   ------------------------------------------------------------------------------------------ */

.lookup { max-inline-size: 60rem; }

.lookup-search {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-block-end: var(--space-4);
}

.lookup-search h1 { font-size: var(--text-xl); margin-block: 0 var(--space-1); }
.lookup-lead { color: var(--ink-600); margin-block-end: var(--space-4); }

.lookup-box { display: flex; gap: var(--space-2); }

.lookup-box .form-control {
    margin-block: 0;
    font-size: var(--text-lg);
    padding-block: var(--space-2);
}

.lookup-box .btn { flex: 0 0 auto; }

.lookup-hint {
    font-size: var(--text-xs);
    color: var(--ink-500);
    margin-block: var(--space-2) 0;
}

.lookup-count {
    font-size: var(--text-sm);
    color: var(--ink-600);
    margin-block-end: var(--space-2);
}

.lookup-results { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }

/* The whole row is the link. An agent reading a number off a screen should not have to find
   a word in it to click. */
.lookup-result {
    display: grid;
    gap: var(--space-1);
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
}

.lookup-result:hover {
    border-inline-start-color: var(--green-600);
    box-shadow: var(--shadow-sm);
}

.lookup-result-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.lookup-result-subject { font-weight: 500; }

.lookup-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    color: var(--ink-600);
}

.lookup-late {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--danger);
}

.lookup-empty {
    background: var(--surface-muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-5);
    text-align: center;
}

.lookup-empty-title { font-weight: 600; margin-block-end: var(--space-1); }

.lookup-detail { max-inline-size: 64rem; }
.lookup-back { margin-block-end: var(--space-3); font-size: var(--text-sm); }

.lookup-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-block-end: var(--space-4);
}

.lookup-eyebrow {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    margin: 0;
}

.lookup-head h1 { font-size: var(--text-xl); font-family: var(--font-mono); margin-block: 0; }
.lookup-subject { font-size: var(--text-md); margin-block: var(--space-1) 0; }
.lookup-head-state { display: flex; align-items: center; gap: var(--space-2); }

.lookup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-3);
    margin-block-end: var(--space-3);
    align-items: start;
}

.lookup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
    margin-block-end: var(--space-3);
}

.lookup-grid > .lookup-card { margin-block-end: 0; height: 100%; }

.lookup-card h2 {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    font-size: var(--text-xs);
    margin-block-end: var(--space-3);
}

.lookup-facts { margin: 0; display: grid; gap: var(--space-2); }
.lookup-facts dt { font-size: var(--text-xs); color: var(--ink-500); font-weight: 500; }
.lookup-facts dd { margin: 0; font-size: var(--text-sm); }

/* Beside the file name on the case screen, quieter than it: looking at a document is the
   common act, keeping a copy of it on a shared counter machine is not. */
/* The file on one screen. On a desk monitor the four panels an officer reads — what the
   complaint is, who made it, what is attached, what has happened — go two across instead of
   four down, which is the difference between a screen and a scroll. The working column
   beside them is left alone: it is a column of things to do, and it reads downwards. */
@media (min-width: 85rem) {
    .complaint-main {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
        align-content: start;
    }

    .complaint-main > .panel { margin-block-end: 0; }

    /* Four columns of label-and-value do not fit in half the width: the values were coming
       out one word per line. Two columns, and the facts read across again. */
    .complaint-main .complaint-facts {
        grid-template-columns: max-content minmax(0, 1fr);
        row-gap: var(--space-2);
    }
}

/* The tracking number is a reference, not a headline: it was set at the size of a page
   title and took a sixth of the screen with the subject under it. */
/* The number, the subject and the chips on one line, with the print button at the end of
   it. They were three stacked lines inside a band of padding, which left a hand's width of
   nothing beside them and took a sixth of the screen to say what the complaint is called. */
.complaint-header {
    padding: var(--space-3) var(--space-4);
    margin-block-end: var(--space-3);
    align-items: center;
    gap: var(--space-3);
}

/* The two ways out of this screen, side by side at the end of the heading row. */
.complaint-header .complaint-countdown {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.complaint-identity {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    min-inline-size: 0;
}

.complaint-header h1 { font-size: var(--text-lg); margin: 0; }
.complaint-header .complaint-subject { margin: 0; font-weight: 600; }
.complaint-header .complaint-meta { margin: 0; display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* A little tighter than a panel elsewhere. Eight panels on one screen is what this page is,
   and a fifth of each one was its own margin. */
.complaint-main > .panel,
.complaint-side > .panel { padding: var(--space-4); }

/* An action, closed. The summary is the button it used to be; opening it is what used to
   be pressing it. */
.action-list { display: grid; gap: var(--space-2); }

.action-choice > summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-weight: 600;
    color: var(--link);
    cursor: pointer;
}

.action-choice > summary:hover {
    border-color: var(--green-600);
    background: var(--green-50);
}

.action-choice[open] > summary {
    border-start-start-radius: var(--radius);
    border-start-end-radius: var(--radius);
    border-end-start-radius: 0;
    border-end-end-radius: 0;
    background: var(--green-50);
}

.action-choice > .action-form {
    border: 1px solid var(--border-strong);
    border-block-start: 0;
    border-end-start-radius: var(--radius);
    border-end-end-radius: var(--radius);
    padding: var(--space-3);
}

.action-choice .action-target { font-weight: 400; font-size: var(--text-xs); color: var(--ink-600); }

/* A complaint worked for a year has a history a year long, and the screen is meant to be
   one screen. The list scrolls inside its own panel rather than pushing everything below it
   off the bottom of the page; the newest is at the top, which is what somebody opening the
   file came to see. */
.complaint-main .timeline,
.complaint-side .history-list,
.complaint-main .evidence-list {
    max-block-size: 15rem;
    overflow-y: auto;
}

/* A complainant has asked for their complaint to be ended and is waiting on a telephone
   call about it. It reads as the interruption it is. */
.withdrawal-request {
    border-inline-start: 3px solid var(--critical);
}

.withdrawal-request h2 { color: var(--critical); }

.withdrawal-when { font-size: var(--text-xs); color: var(--ink-600); margin-block-end: var(--space-2); }

.withdrawal-reason {
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    margin-block-end: var(--space-2);
}

.withdrawal-request > details > summary {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--link);
    cursor: pointer;
    padding-block: var(--space-1);
}

.withdrawal-request > details[open] > summary { margin-block-end: var(--space-2); }

/* A panel heading with the one thing the panel does at the end of it. */
.panel-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.panel-heading-row > h2 { margin-block-end: 0; }

/* The form the heading's button opens. No script: a checkbox the label toggles, and the form
   shown from it by the sibling selector. */
.panel-toggle:not(:checked) ~ .evidence-upload { display: none; }
.panel-toggle:checked ~ .evidence-upload { margin-block-start: var(--space-3); }

.panel-toggle:focus-visible ~ .panel-heading-row label { box-shadow: var(--focus-ring); }

.note-form > summary {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--link);
    cursor: pointer;
    padding-block: var(--space-1);
}

.evidence-attach[open] > summary,
.note-form[open] > summary { margin-block-end: var(--space-2); }

.evidence-download {
    margin-inline-start: var(--space-2);
    font-size: var(--text-xs);
    color: var(--ink-600);
}

/* The officer under the seat they sit in, so the two read as one answer. */
.lookup-officer {
    display: block;
    font-weight: 600;
    color: var(--brand-text);
}

.lookup-charge {
    font-weight: 400;
    font-size: var(--text-xs);
    color: var(--ink-600);
}

.lookup-charge::before { content: " — "; }

.lookup-body { white-space: pre-wrap; margin: 0; }

.known-caller {
    background: var(--ok-bg);
    border: 1px solid #a9e3c4;
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    font-size: var(--text-sm);
}

.duplicate-candidate {
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--critical);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    margin-block-end: var(--space-2);
    background: var(--surface);
}

.duplicate-reasons {
    font-size: var(--text-xs);
    color: var(--ink-600);
    margin-block-start: var(--space-1);
}

.history-list { list-style: none; margin: 0; padding: 0; }

.history-line {
    padding-block: var(--space-2);
    border-block-end: 1px solid var(--border);
}

.history-line:last-child { border-block-end: 0; }

.history-subject { font-weight: 500; color: var(--ink-900); font-size: var(--text-sm); }

.history-meta { font-size: var(--text-xs); color: var(--ink-500); }

/* ==========================================================================================
   Master data screens
   ========================================================================================== */

.master-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-block-end: var(--space-4);
}

.master-header h1 { font-size: var(--text-2xl); margin: 0; }

.master-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-block-end: var(--space-4);
}

.master-filter-row {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: end;
}

.master-filter-row + .master-filter-row { margin-block-start: var(--space-3); }

.master-filter-row input[type="search"] { max-inline-size: 22rem; }
.master-filter-row select { max-inline-size: 12rem; }

/* A label that belongs to the control beside it rather than above the row. */
.master-filter-row > .form-label {
    margin-block-end: var(--space-2);
    font-size: var(--text-sm);
    color: var(--ink-700);
    white-space: nowrap;
}

/* A cascading picker is itself a row of selects with its own label above them, so inside a
   filter row it needs to be a column of its own rather than sized to its content. Without
   this, a picker that has opened three levels squeezes the one beside it to the far edge. */
.master-filter-row > .cascading-picker {
    flex: 1 1 20rem;
    min-inline-size: 0;
}

.master-filter-row > .cascading-picker select { max-inline-size: none; }

.master-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.master-table th a { color: inherit; text-decoration: none; }
.master-table th a:hover { color: var(--link-hover); }

.row-inactive { opacity: 0.55; }

.row-actions { white-space: nowrap; text-align: end; }

/* The indent comes from the row's own depth column, so the tree renders at whatever depth
   the data happens to have. */
.tree-indent {
    display: inline-block;
    inline-size: calc(var(--depth, 0) * 1.25rem);
}

.colour-swatch {
    display: inline-block;
    inline-size: 1rem;
    block-size: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--swatch, transparent);
    vertical-align: text-bottom;
    margin-inline-end: var(--space-1);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block: var(--space-3);
    flex-wrap: wrap;
}

.pager-summary { font-size: var(--text-sm); color: var(--ink-600); }

.pager-links { display: flex; gap: var(--space-2); align-items: center; }

.master-form fieldset {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin-block: var(--space-4);
    box-shadow: var(--shadow-sm);
}

.master-form legend {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-600);
    inline-size: auto;
    padding-inline: var(--space-2);
}

.master-form .row > [class^="col-"] { margin-block-end: var(--space-3); }

.form-actions {
    display: flex;
    gap: var(--space-2);
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
}

.required { color: var(--danger); margin-inline-start: 0.15em; }

/* The pager under a long grid. Position in the middle so it stays put as the buttons come
   and go at the first and last page. */
.grid-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-block: var(--space-4);
}

.grid-pager-position {
    font-size: var(--text-sm);
    color: var(--ink-600);
    font-variant-numeric: tabular-nums;
    min-inline-size: 8rem;
    text-align: center;
}

/* ==========================================================================================
   Audit, retention, delegations and integration screens
   ========================================================================================== */

/* What changed, column by column, on one audit line. A definition list rather than a nested
   table, so a row with twenty changed columns does not force the grid wider than the screen. */
.audit-changes {
    margin-block-end: 0;
    font-size: var(--text-xs);
    display: grid;
    grid-template-columns: minmax(6rem, auto) 1fr;
    gap: 0 var(--space-3);
    max-block-size: 12rem;
    overflow-y: auto;
}

.audit-changes dt {
    font-weight: 600;
    color: var(--ink-600);
    font-family: var(--font-mono);
}

.audit-changes dd {
    margin-block-end: var(--space-1);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: baseline;
}

/* Before and after. Both are shown, because a trail that records only the new value cannot
   answer what it was changed from. */
.audit-changes del {
    color: var(--danger);
    background: var(--danger-bg);
    text-decoration: line-through;
    padding: 0 var(--space-1);
    border-radius: var(--radius-sm);
}

.audit-changes ins {
    color: var(--ok);
    background: var(--ok-bg);
    text-decoration: none;
    padding: 0 var(--space-1);
    border-radius: var(--radius-sm);
}

/* Long lists of permissions and events, on the delegation and webhook forms. Columns, because
   fifty tick boxes in one column is a scroll nobody finishes. */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-3) var(--space-5);
    max-block-size: 24rem;
    overflow-y: auto;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.permission-grid fieldset { margin-block-end: var(--space-2); }

.permission-grid legend {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    float: none;
    inline-size: auto;
}

.permission-grid code { font-size: var(--text-xs); color: var(--ink-500); }

/* A provider's payload, kept verbatim. Wrapped rather than scrolled sideways: somebody
   reading a dead-lettered message needs to see all of it. */
.inbound-payload {
    margin-block-end: 0;
    padding: var(--space-3);
    background: var(--ink-900);
    color: var(--ink-100);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    white-space: pre-wrap;
    word-break: break-all;
    max-block-size: 18rem;
    overflow-y: auto;
}

/* ==========================================================================================
   Statistics and dashboard tiles
   ========================================================================================== */

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-4);
    margin-block: var(--space-4);
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--brand-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.stat-table { inline-size: 100%; }

/* A proportion bar, width set inline from the data as --value. */
.stat-bar {
    display: block;
    block-size: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--ink-100);
    overflow: hidden;
    min-inline-size: 6rem;
}

.stat-bar::after {
    content: "";
    display: block;
    block-size: 100%;
    inline-size: var(--value, 0%);
    background: var(--green-600);
    border-radius: var(--radius-pill);
}

/* -- Headline figures --------------------------------------------------------------------- */

/* The row of numbers a dashboard opens with. Most are links into the list behind them, which
   is why the tile is styled as an anchor as well as a block. */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--space-3);
    margin-block: var(--space-4) var(--space-5);
}

.kpi-tile {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
}

a.kpi-tile:hover,
a.kpi-tile:focus-visible {
    border-inline-start-color: var(--green-600);
    box-shadow: var(--shadow);
    color: inherit;
}

.kpi-value {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-block-end: 0;
}

.kpi-label {
    font-size: var(--text-sm);
    color: var(--ink-600);
    margin-block-end: 0;
}

/* State is carried on the rule and the figure, never on the whole tile: a red panel for two
   overdue complaints reads as an emergency. */
.kpi-danger { border-inline-start-color: var(--danger); }
.kpi-danger .kpi-value { color: var(--danger); }

.kpi-warning { border-inline-start-color: var(--warning); }
.kpi-warning .kpi-value { color: var(--warning); }

.kpi-success { border-inline-start-color: var(--ok); }
.kpi-success .kpi-value { color: var(--ok); }

/* A second figure on the same line as the label: the count's share, which is the difference
   between six of six and six of sixty. */
.kpi-aside {
    margin-inline-start: var(--space-2);
    color: var(--ink-500);
    font-variant-numeric: tabular-nums;
}

/* The same tiles above a table that is already filtered, where they are a summary rather than
   the point of the page. */
.kpi-row-compact {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    margin-block: var(--space-3) var(--space-4);
}

.kpi-row-compact .kpi-tile { padding: var(--space-3); }
.kpi-row-compact .kpi-value { font-size: var(--text-xl); }

/* -- The Secretary's board of heads ----------------------------------------------------------- */

/* One card per wing, and the whole card is the link. A card that shows a wing in trouble and
   then asks the reader to find a small button in its corner has wasted the glance it gets. */
.head-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-3);
    margin-block: var(--space-3);
}

/* Tinted by how much of the wing's work is overdue, so fourteen cards read as a field of
   colour before a single figure is read. The tint fades to paper under the figures, which
   have to stay as legible as a printed return. */
.head-card {
    --head-accent: var(--ink-400);
    --head-hue: var(--green-700);
    --head-tint: var(--green-50);

    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    background: linear-gradient(180deg, var(--head-tint) 0%, var(--surface) 60%);
    border: 1px solid var(--border);
    border-block-start: 4px solid var(--head-hue);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: box-shadow 140ms ease, transform 140ms ease;
}

/* The wing's own colour carries identity: the band, the dot and the tint. State is carried
   only by the ring and the line of overdue beneath it. Keeping them apart is what stops a
   province where almost everything is late from turning into fourteen red rectangles, which
   is a colour scheme rather than a signal. */
.head-hue-0 { --head-hue: #1c6b3c; --head-tint: #eef6f1; }
.head-hue-1 { --head-hue: #b45309; --head-tint: #fdf4e9; }
.head-hue-2 { --head-hue: #1d4ed8; --head-tint: #eef2fd; }
.head-hue-3 { --head-hue: #9d174d; --head-tint: #fdeff4; }
.head-hue-4 { --head-hue: #0f766e; --head-tint: #ecf6f5; }
.head-hue-5 { --head-hue: #7c2d12; --head-tint: #fbefeb; }
.head-hue-6 { --head-hue: #4338ca; --head-tint: #f0effc; }

.head-card:hover,
.head-card:focus-visible {
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    .head-card { transition: none; }
    .head-card:hover, .head-card:focus-visible { transform: none; }
}

/* Three bands rather than a gradient: a Secretary scanning fourteen cards is reading a
   signal, not a measurement — and the percentage is printed inside the ring, so nothing here
   depends on telling red from amber. */
.head-danger { --head-accent: var(--danger); }
.head-warning { --head-accent: var(--critical); }
.head-ok { --head-accent: var(--ok); }
.head-clear { --head-accent: var(--ink-300); }

/* Three lines' worth, reserved: "DG Agriculture Research Institute (ARI)" wraps to three and
   would otherwise push its own figures a line below everything beside it. */
.head-top {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    min-block-size: 3.7rem;
}

.head-dot {
    flex: none;
    margin-block-start: 0.4em;
    inline-size: 0.625rem;
    block-size: 0.625rem;
    border-radius: 50%;
    background: var(--head-hue);
}

.head-name {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--ink-900);
    line-height: 1.25;
}

.head-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.head-figure {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.head-figure-value {
    font-size: clamp(1.9rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 650;
    line-height: 1;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.head-figure-label {
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.head-subjects {
    margin-inline-start: auto;
    padding-block-start: 0.15rem;
    font-size: var(--text-xs);
    color: var(--ink-500);
    white-space: nowrap;
}

/* The ring and its number share one grid cell, so the figure sits in the middle of the
   shape without anything being positioned absolutely. */
.head-gauge {
    display: grid;
    flex: none;
    inline-size: 3.25rem;
    block-size: 3.25rem;
}

.head-gauge > * { grid-area: 1 / 1; }

.head-gauge svg {
    inline-size: 100%;
    block-size: 100%;
    transform: rotate(-90deg);
}

.head-gauge-track {
    fill: none;
    stroke: var(--ink-200);
    stroke-width: 8;
}

.head-gauge-fill {
    fill: none;
    stroke: var(--head-accent);
    stroke-width: 8;
    stroke-linecap: round;
}

.head-gauge-value {
    place-self: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--head-accent);
    font-variant-numeric: tabular-nums;
}

.head-overdue {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--head-accent);
}

/* Label against value, one to a line, set tight: three figures across a card this narrow put
   "Closed this month" on three lines of its own and left the card looking unfinished. */
.head-stats {
    display: grid;
    margin-block-start: auto;
    border-block-start: 1px solid var(--border);
}

.head-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    padding-block: 0.3rem;
}

.head-stat + .head-stat { border-block-start: 1px dashed var(--border); }

.head-stat-label {
    font-size: var(--text-xs);
    color: var(--ink-600);
    line-height: 1.3;
}

.head-stat-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-800);
    font-variant-numeric: tabular-nums;
}

/* Completes the tile tones beside danger, warning and success. */
.kpi-info { border-inline-start-color: var(--info); }
.kpi-info .kpi-value { color: var(--info); }

.head-order-note {
    margin-block-end: 0;
    font-size: var(--text-sm);
}

/* One head and no choice to make: a band across the width, saying more than a card has room
   for rather than stretching a card's worth of figures across a screen. */
/* No fallbacks for --head-accent, --head-hue or --head-tint here: the tone and hue classes
   are always both applied, they are declared earlier in this file, and a default set here
   would win on source order and paint every band the same grey-green. */
.head-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    margin-block: var(--space-3);
    background: linear-gradient(180deg, var(--head-tint) 0%, var(--surface) 70%);
    border: 1px solid var(--border);
    border-block-start: 4px solid var(--head-hue);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 140ms ease;
}

.head-band:hover,
.head-band:focus-visible {
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
}

@media (prefers-reduced-motion: reduce) {
    .head-band { transition: none; }
}

.head-band-name {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-inline-size: 14rem;
}

.head-band-name .head-subjects { margin-inline-start: 0; }

.head-band .head-gauge {
    inline-size: 3.75rem;
    block-size: 3.75rem;
}

/* The figures take the width the card could not: five of them, evenly spread, with the one
   that matters picked out in the state's own colour. */
.head-band-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
    gap: var(--space-3);
    flex: 1;
    min-inline-size: 18rem;
}

.head-band-figure { display: block; }

.head-band-value {
    display: block;
    font-size: var(--text-2xl);
    font-weight: 650;
    line-height: 1.1;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.head-band-overdue .head-band-value { color: var(--head-accent); }

.head-band-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--ink-600);
    line-height: 1.3;
}

/* What the cards cannot say, side by side underneath them: whether the department is keeping
   up, and which files have waited longest. One column on anything narrow. */
.board-below {
    display: grid;
    grid-template-columns: minmax(16rem, 2fr) 3fr;
    gap: var(--space-3);
}

@media (max-width: 62rem) {
    .board-below { grid-template-columns: 1fr; }
}

/* The three questions the figures raise: where, how stale, and stuck at what stage. */
.board-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: var(--space-3);
    margin-block-start: var(--space-3);
}

.board-panel {
    padding: var(--space-3) var(--space-3) var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.board-panel h2 {
    margin-block-end: var(--space-1);
    color: var(--ink-700);
}

.board-chart { min-block-size: 0; }

/* A number written inside a bar is always on the bar's own colour, so it is always white.
   ApexCharts sets the fill as an SVG attribute and its dark theme overrides what we pass in
   options; a stylesheet rule beats a presentation attribute and settles it. */
.board-chart .apexcharts-datalabels text,
.board-chart .apexcharts-datalabel { fill: #fff; }

/* No header row: every line is the same two things, and a heading over six rows is a heading
   that costs more than it says. */
.board-waiting { margin-block-end: var(--space-2); }

.board-waiting td {
    padding-block: 0.22rem;
    vertical-align: baseline;
    font-size: var(--text-sm);
    line-height: 1.35;
}

.board-waiting .inbox-meta { font-size: var(--text-xs); }

.board-waiting tr:first-child td { border-block-start: 0; }

.board-waiting-age {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--ink-700);
}

/* The heading and the way out of the panel share a line, which costs no height. */
.board-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}

.board-panel-more {
    font-size: var(--text-xs);
    white-space: nowrap;
}

/* The way back up. Plain text for where you are, links for everything above it. */
.board-trail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-block-end: var(--space-3);
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.board-trail [aria-current="page"] { color: var(--ink-800); font-weight: 600; }

.board-table th a {
    color: inherit;
    text-decoration: none;
    border-block-end: 1px dotted var(--border-strong);
}

.board-table th a:hover { color: var(--link); }

.board-table td { font-variant-numeric: tabular-nums; }

.board-aside td:first-child { font-style: italic; }

.board-overdue-tag {
    display: inline-block;
    margin-inline-start: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--danger);
}

.board-filters .board-range {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.board-filters .board-range .form-label { margin-block-end: 0; }

.board-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-inline-start: 0;
}

.board-check .form-check-input { margin: 0; float: none; }

.board-reset { align-self: center; }

/* -- Charts and the map ------------------------------------------------------------------- */

/* A minimum height matters twice over: it stops the page reflowing as ApexCharts draws, and
   it gives the empty-state label somewhere to sit when there is no data at all. */
.chart {
    display: block;
    min-block-size: 17.5rem;
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);

    /* Only ever seen on the empty-state label: ApexCharts draws an SVG that ignores both. */
    text-align: center;
    color: var(--ink-500);
    font-size: var(--text-sm);
}

/* Leaflet measures its container, so an explicit height is not decoration: without one the
   map initialises at zero pixels and nothing is drawn at all. */
.dashboard-map {
    block-size: 26rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    margin-block-end: var(--space-5);
}

/* ==========================================================================================
   Routing trace
   ========================================================================================== */

.trace {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--text-sm);
}

.trace li {
    padding: var(--space-2) var(--space-3);
    border-inline-start: 2px solid var(--border-strong);
    color: var(--ink-700);
}

.trace-decisive {
    border-inline-start-color: var(--green-600);
    background: var(--green-50);
    color: var(--ink-900);
}

.trace-stage {
    display: inline-block;
    min-inline-size: 7rem;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500);
}

/* ==========================================================================================
   Routing rule builder
   A rule is a nested tree, and the nesting is the meaning: the indent is set inline from the
   node's own depth, so the styles here only have to make each level readable.
   ========================================================================================== */

.rule-group {
    padding: var(--space-3);
    margin-block-end: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--green-500);
    border-radius: var(--radius);
}

.rule-condition,
.rule-action {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-2);
    background: var(--surface-muted);
}

.rule-action { border-inline-start: 3px solid var(--info) !important; }

/* The row that adds another condition or action. Dashed, so it reads as an invitation rather
   than as something that is already there. */
.rule-add {
    padding: var(--space-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

/* ==========================================================================================
   FAQ and content
   ========================================================================================== */

.faq-list { display: flex; flex-direction: column; gap: var(--space-2); }

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.faq-item > summary { font-weight: 600; color: var(--ink-900); }

.faq-answer {
    margin-block-start: var(--space-3);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--border);
    color: var(--ink-700);
}

/* ==========================================================================================
   Cascading picker
   ========================================================================================== */

.cascading-picker {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: flex-end;
}

.cascading-picker-label {
    inline-size: 100%;
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--ink-700);
    margin-block-end: var(--space-1);
}

.cascading-picker-level { min-inline-size: 12rem; flex: 1 1 12rem; }

/* ==========================================================================================
   Dynamic fields
   ========================================================================================== */

.dynamic-form { display: flex; flex-direction: column; gap: var(--space-4); }

.dynamic-form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.field { margin-block-end: var(--space-3); }

/* The value is withheld server-side; this only styles the placeholder that stands in for it. */
.field-masked {
    font-family: var(--font-mono);
    letter-spacing: 0.2em;
    color: var(--ink-500);
    background: var(--ink-100);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    display: inline-block;
}

.field-geopoint { display: flex; flex-direction: column; gap: var(--space-2); }

.field-geopoint-inputs { display: flex; gap: var(--space-2); }

.field-geopoint-map {
    block-size: 16rem;
    margin-block-start: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.field-files {
    list-style: none;
    padding: 0;
    margin-block-start: var(--space-2);
    font-size: var(--text-sm);
}

.field-signature canvas {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    touch-action: none;
    background: var(--surface);
}

.attachment-table { font-size: var(--text-sm); }

.upload-form {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-4);
    background: var(--surface-muted);
}

/* The subject, the file and the button on one line, with their labels level. The button has
   no label of its own, so it is pushed to the bottom of the row to sit on the controls'
   baseline rather than floating against their labels. */
.upload-fields {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) minmax(12rem, 1.6fr) auto;
    gap: var(--space-3);
    align-items: end;
}

.upload-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-inline-size: 0;
}

.upload-field .form-label { margin-block-end: 0; }

.upload-submit { white-space: nowrap; }

/* What may be attached, under the whole row rather than under the file box: it describes the
   upload, not that one control. */
.upload-limits {
    margin-block: var(--space-2) 0;
}

/* On a phone the three stack, and the button goes full width because it is the only thing on
   its line and a half-width button there reads as unfinished. */
@media (max-width: 40rem) {
    .upload-fields { grid-template-columns: 1fr; }
    .upload-submit { inline-size: 100%; }
}

/* ==========================================================================================
   Switchers
   ========================================================================================== */

/* A segmented control: every choice visible, the one in force filled in. Both switchers sit
   on the department's green in either theme, so their colours are literal rather than tokens
   — a token here would turn the label dark on dark the moment the page did. */
.switch-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-pill);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .switch-group {
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
}

.switch-icon {
    display: inline-flex;
    padding-inline-start: var(--space-2);
    padding-inline-end: var(--space-1);
    color: rgba(255, 255, 255, 0.7);
}

.switch-icon svg {
    inline-size: 1rem;
    block-size: 1rem;
}

.switch-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 2rem;
    block-size: 1.75rem;
    padding-inline: var(--space-2);
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font-family: inherit;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.switch-option svg {
    inline-size: 1.0625rem;
    block-size: 1.0625rem;
}

.switch-option:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.switch-option:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* The one in force is filled rather than outlined: on a translucent bar an outline reads as
   another border and disappears into the one around the group. */
.switch-option[aria-pressed="true"] {
    background: #fff;
    color: var(--green-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    .switch-option { transition: none; }
}

/* Who is signed in, and what they are acting as.

   Three things used to run together on one line -- the account name, the role with its
   office, and the sign-out button -- so none of them read as a heading, a subtitle or an
   action. The name leads, the role sits under it in a quieter weight, and sign-out is
   separated by a rule so it reads as something you do rather than the end of the sentence. */
.context-switcher {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-inline-size: 0;
}

.context-avatar {
    flex: none;
    inline-size: 2rem;
    block-size: 2rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

.context-identity {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-inline-size: 0;
}

.context-user {
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 650;
    line-height: 1.2;
}

/* The office name runs long -- "Focal Person — Agriculture Extension, East Quetta" -- and the
   header has no room to grow, so it is clipped rather than allowed to push the nav about.
   The whole thing is on the element's title attribute. */
.context-role {
    /* Gives way before the links do: a designation can be read in full on the users screen,
       and the console links cannot be read at all once they have scrolled out of reach. */
    max-inline-size: min(22rem, 20vw);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    /* Literal, like everything else on the green bar: a token here turned the designation
       near-black on dark green the moment the page did. */
    color: rgba(255, 255, 255, 0.72);
    font-size: var(--text-xs);
    line-height: 1.3;
}

/* Beside sign-out, and the same size as it: a quiet icon, because it is something you do
   twice a year rather than every visit. */
.context-password {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 2rem;
    block-size: 2rem;
    border-radius: var(--radius-pill);
    color: rgba(255, 255, 255, 0.8);
}

.context-password svg { inline-size: 1.125rem; block-size: 1.125rem; }

.context-password:hover,
.context-password:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.context-switch-form { margin: 0; }

.context-select {
    max-inline-size: 22rem;
    padding-block: 0;
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: var(--text-xs);
}

/* The chevron is a dark SVG baked into Bootstrap's own rule, invisible on this background. */
.context-select option { color: var(--ink-900); }

.context-signout {
    margin: 0;
    padding-inline-start: var(--space-3);
    border-inline-start: 1px solid rgba(255, 255, 255, 0.22);
}

/* On a narrow screen the role is the first thing to go: the name and the way out matter
   more, and the role is on every page's own heading anyway. */
@media (max-width: 62rem) {
    .context-role,
    .context-select { display: none; }
}

/* ==========================================================================================
   Generated documents — receipts, referral letters, ATR sheets
   These are printed and filed, so they are set as documents rather than as web pages.
   ========================================================================================== */

.doc-header {
    text-align: center;
    border-block-end: 2px solid var(--ink-900);
    padding-block-end: var(--space-4);
    margin-block-end: var(--space-5);
}

.doc-title {
    font-size: var(--text-xl);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.doc-refs {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: var(--text-sm);
    margin-block-end: var(--space-5);
}

.doc-ref-value { font-family: var(--font-mono); font-weight: 600; direction: ltr; unicode-bidi: isolate; }

.diary-number { font-family: var(--font-mono); font-weight: 600; }

.doc-section { margin-block-end: var(--space-5); break-inside: avoid; }

.doc-fields {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-base);
}

.doc-signatures {
    display: flex;
    justify-content: space-between;
    gap: var(--space-6);
    margin-block-start: var(--space-7);
}

.doc-signature {
    flex: 1 1 0;
    border-block-start: 1px solid var(--ink-900);
    padding-block-start: var(--space-2);
    text-align: center;
    font-size: var(--text-sm);
}

.doc-footer {
    margin-block-start: var(--space-6);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--ink-500);
    text-align: center;
}

.print-actions { margin-block-end: var(--space-4); display: flex; gap: var(--space-2); }

/* ==========================================================================================
   Print
   ========================================================================================== */

@media print {
    .admin-header,
    .admin-nav,
    .public-header,
    .public-footer,
    .form-actions,
    .master-filters,
    .pager,
    .row-actions,
    .print-actions,
    .inbox-tabs,
    .skip-link {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 11pt;
    }

    .admin-main,
    .officer-main,
    .operator-main { padding: 0; max-inline-size: none; }

    .panel,
    .master-table,
    .inbox-table,
    .complaint-header {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    a { text-decoration: none; color: #000; }

    /* A printed file should not break a complaint across two sheets where it can be helped. */
    .movement,
    .timeline-item,
    .doc-section { break-inside: avoid; }
}

/* The identity fields follow the identity question, and only when the answer is yes. This is
   appearance only: the controller decides what is actually recorded, because a browser without
   :has() support shows the fields and would otherwise post an identity that was declined. */
.identity-form:has(#identity-no:checked) .identity-fields {
    display: none;
}

/* Asking to have the complaint looked at again belongs to somebody who is unhappy with how
   it went. Offered to somebody who has just said they are satisfied it reads as though the
   department did not believe them — and a box that is there gets ticked by accident.

   Appearance only, as above: the service ignores the request where the verdict is not one of
   the unhappy rungs, so a browser without :has() cannot send one by showing the box. */
.satisfaction-form .reopen-request { display: none; }
.satisfaction-form:has(.is-unhappy:checked) .reopen-request { display: block; }

/* ==========================================================================================
   The inauguration page
   ==========================================================================================
   Shown once, on a projector, in a hall, behind somebody holding a microphone, with cameras
   in the room. So it is sized to be read from the back rather than from a desk, it says what
   the occasion is before it says anything else, and the one thing to do on it is impossible
   to miss.

   Wheat gold against the department's green. The gold appears nowhere else in the system and
   is not a brand colour — it belongs to this page, to the drawn ear of wheat, and to the
   ribbons, and it goes when the page does.
   ========================================================================================== */

body.launch {
    --wheat: #e9c46a;
    --wheat-deep: #d4a339;

    margin: 0;
    min-block-size: 100vh;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse at 50% -10%, rgba(233, 196, 106, 0.16), transparent 58%),
        linear-gradient(165deg, #0a3a1e, var(--green-800, #14532d) 55%, #0d4524);
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.launch-stage {
    inline-size: min(64rem, 92vw);
    padding-block: clamp(2rem, 5vh, 4rem);
    text-align: center;
}

/* The one drawn thing on the page: an ear of wheat, which belongs to this department and to
   this province, and which no photograph was available to carry. */
.launch-wheat {
    display: block;
    margin-inline: auto;
    margin-block-end: clamp(0.5rem, 2vh, 1.5rem);
    inline-size: clamp(2.5rem, 5vh, 4rem);
    color: var(--wheat);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.launch-wheat svg { inline-size: 100%; block-size: auto; }

/* The occasion. It was only in the page title before, where nobody in a hall can read it. */
.launch-occasion {
    margin: 0 0 clamp(1rem, 3vh, 2rem);
    font-size: clamp(0.9rem, 1.3vw, 1.4rem);
    font-weight: 600;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
    text-transform: uppercase;
    color: var(--wheat);
}

.launch-eyebrow {
    margin: 0 0 clamp(0.5rem, 1.5vh, 1rem);
    font-size: clamp(0.95rem, 1.3vw, 1.5rem);
    font-weight: 500;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.78);
}

/* Sixty characters of name. It is meant to take two lines, so it is measured in characters
   and capped well below the width of the stage rather than left to fill it.

   The colour is set here on purpose: the global heading rule paints every h1 in near-black
   ink, which on this green left the one line the room has come to read almost invisible. */
.launch-title {
    margin: 0 auto clamp(0.75rem, 2vh, 1.25rem);
    max-inline-size: 24ch;
    font-size: clamp(1.75rem, 4vw, 3.5rem);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -0.015em;
    color: var(--wheat);
}

/* Gold leaf: a sheen across the letters rather than a flat fill, which is what the name on an
   inaugural plaque looks like under lights. Only where the browser can clip a background to
   the text — everywhere else the solid gold above stands, and the line is still gold and
   still legible rather than transparent and gone. */
@supports (-webkit-background-clip: text) or (background-clip: text) {
    .launch-title {
        background-image: linear-gradient(
            125deg,
            #fff6dc 0%,
            var(--wheat) 26%,
            #f6e2a8 44%,
            var(--wheat-deep) 62%,
            var(--wheat) 80%,
            #fff6dc 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;

        /* Applied to the element rather than as a text-shadow: the text is a clipped
           background, and a drop-shadow follows the shape the clip leaves behind. */
        filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45));
    }
}

.launch-lead {
    margin: 0 auto;
    max-inline-size: 46ch;
    font-size: clamp(0.95rem, 1.4vw, 1.4rem);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
}

/* The two things that date the occasion. Either may be absent; the rule above them is drawn
   by the block itself, so an empty block leaves no stray line behind. */
.launch-occasion-detail {
    margin-block: clamp(1.25rem, 3vh, 2rem) 0;
    padding-block-start: clamp(1rem, 2.5vh, 1.75rem);
    border-block-start: 1px solid rgba(233, 196, 106, 0.38);
}

.launch-date {
    margin: 0;
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--wheat);
}

.launch-guest {
    margin: clamp(0.4rem, 1vh, 0.75rem) 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: clamp(0.95rem, 1.3vw, 1.35rem);
    line-height: 1.4;
}

.launch-guest-label {
    font-size: 0.78em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.launch-guest-name { font-weight: 650; }
.launch-guest-title { color: rgba(255, 255, 255, 0.72); font-size: 0.9em; }

/* -- The press ------------------------------------------------------------------------------ */

.launch-pad {
    position: relative;
    display: inline-grid;
    justify-items: center;
    margin-block-start: clamp(1.5rem, 4vh, 3rem);
}

.launch-button {
    position: relative;
    display: inline-block;
    margin-block-start: 0.6rem;
    padding: clamp(0.85rem, 1.6vh, 1.5rem) clamp(2.25rem, 5vw, 5rem);
    border-radius: 999px;
    background: var(--wheat);
    color: #0a3a1e;
    font-size: clamp(1.05rem, 1.9vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.launch-button:hover,
.launch-button:focus-visible {
    background: #f2d489;
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.launch-button:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.launch-button:active { transform: translateY(1px); }

/* A ring that keeps leaving the button, so it reads as live rather than painted on. */
.launch-button::after {
    content: "";
    position: absolute;
    inset: -0.6rem;
    border: 2px solid rgba(233, 196, 106, 0.6);
    border-radius: 999px;
    animation: launch-ring 2.1s ease-out infinite;
    pointer-events: none;
}

@keyframes launch-ring {
    0%   { transform: scale(0.96); opacity: 0.9; }
    70%  { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* -- The moment ------------------------------------------------------------------------------
   One word, large, after the press. This is what a photograph of the screen will carry, so it
   arrives quickly and then stays while the ribbons are still falling. */

.launch-done {
    position: fixed;
    inset-block-start: 50%;
    inset-inline: 0;
    margin: 0;
    transform: translateY(-50%) scale(0.9);
    font-size: clamp(2.5rem, 9vw, 7rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--wheat);
    text-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
}

.launch-stage:target .launch-done,
body.is-launching .launch-done {
    animation: launch-stamp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

@keyframes launch-stamp {
    to { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* The stage steps back so the word owns the screen. */
body.is-launching .launch-stage > :not(.launch-done):not(.launch-ribbon),
.launch-stage:target > :not(.launch-done):not(.launch-ribbon):not(.launch-after) {
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
    opacity: 0.12;
    transform: scale(0.98);
}

/* -- The ribbons ---------------------------------------------------------------------------- */

.launch-ribbon {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    overflow: hidden;
}

.launch-ribbon span {
    position: absolute;
    inset-block-start: -10vh;
    inline-size: 0.6rem;
    block-size: 1.4rem;
    border-radius: 2px;
    background: #fff;
}

/* Spread across the width, and varied in colour, size and timing so the fall reads as a
   shower rather than twenty-four identical rectangles released at once. */
.launch-ribbon span:nth-child(3n)   { background: var(--wheat); }
.launch-ribbon span:nth-child(3n+1) { background: #8ce99a; }
.launch-ribbon span:nth-child(4n)   { inline-size: 0.4rem; block-size: 1rem; }
.launch-ribbon span:nth-child(5n)   { inline-size: 0.85rem; block-size: 0.45rem; }

.launch-ribbon span:nth-child(1)  { inset-inline-start:  2%; animation-delay: 0.05s; }
.launch-ribbon span:nth-child(2)  { inset-inline-start:  6%; animation-delay: 0.62s; }
.launch-ribbon span:nth-child(3)  { inset-inline-start: 10%; animation-delay: 0.21s; }
.launch-ribbon span:nth-child(4)  { inset-inline-start: 15%; animation-delay: 0.95s; }
.launch-ribbon span:nth-child(5)  { inset-inline-start: 19%; animation-delay: 0.38s; }
.launch-ribbon span:nth-child(6)  { inset-inline-start: 23%; animation-delay: 1.18s; }
.launch-ribbon span:nth-child(7)  { inset-inline-start: 28%; animation-delay: 0.12s; }
.launch-ribbon span:nth-child(8)  { inset-inline-start: 32%; animation-delay: 0.74s; }
.launch-ribbon span:nth-child(9)  { inset-inline-start: 36%; animation-delay: 0.29s; }
.launch-ribbon span:nth-child(10) { inset-inline-start: 41%; animation-delay: 1.02s; }
.launch-ribbon span:nth-child(11) { inset-inline-start: 45%; animation-delay: 0.48s; }
.launch-ribbon span:nth-child(12) { inset-inline-start: 49%; animation-delay: 0.85s; }
.launch-ribbon span:nth-child(13) { inset-inline-start: 53%; animation-delay: 0.17s; }
.launch-ribbon span:nth-child(14) { inset-inline-start: 58%; animation-delay: 1.26s; }
.launch-ribbon span:nth-child(15) { inset-inline-start: 62%; animation-delay: 0.55s; }
.launch-ribbon span:nth-child(16) { inset-inline-start: 66%; animation-delay: 0.08s; }
.launch-ribbon span:nth-child(17) { inset-inline-start: 71%; animation-delay: 0.93s; }
.launch-ribbon span:nth-child(18) { inset-inline-start: 75%; animation-delay: 0.34s; }
.launch-ribbon span:nth-child(19) { inset-inline-start: 79%; animation-delay: 1.11s; }
.launch-ribbon span:nth-child(20) { inset-inline-start: 84%; animation-delay: 0.67s; }
.launch-ribbon span:nth-child(21) { inset-inline-start: 88%; animation-delay: 0.25s; }
.launch-ribbon span:nth-child(22) { inset-inline-start: 92%; animation-delay: 1.33s; }
.launch-ribbon span:nth-child(23) { inset-inline-start: 96%; animation-delay: 0.44s; }
.launch-ribbon span:nth-child(24) { inset-inline-start: 99%; animation-delay: 0.79s; }

/* :target for the no-script path, the body class for the scripted one. */
.launch-stage:target .launch-ribbon,
body.is-launching .launch-ribbon { opacity: 1; }

.launch-stage:target .launch-ribbon span,
body.is-launching .launch-ribbon span {
    animation-name: launch-fall;
    animation-duration: 3.2s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes launch-fall {
    to { transform: translateY(120vh) rotate(720deg); opacity: 0.25; }
}

/* The way in, for a browser that ran no script. Only offered once the button is pressed. */
.launch-after {
    position: relative;
    margin-block-start: clamp(1.5rem, 4vh, 3rem);
    opacity: 0;
    transition: opacity 0.4s ease 1s;
}

.launch-stage:target .launch-after { opacity: 1; }

.launch-after a {
    color: var(--wheat);
    font-size: clamp(1rem, 1.4vw, 1.4rem);
    text-underline-offset: 0.35em;
}

body.is-launching .launch-button::after { animation: none; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .launch-button::after,
    .launch-ribbon span,
    .launch-done { animation: none; }

    .launch-stage:target .launch-done,
    body.is-launching .launch-done { opacity: 1; transform: translateY(-50%); }

    .launch-stage:target .launch-after { opacity: 1; transition: none; }

    body.is-launching .launch-stage > :not(.launch-done):not(.launch-ribbon),
    .launch-stage:target > :not(.launch-done):not(.launch-ribbon):not(.launch-after) {
        transition: none;
    }
}

/* The complainant's own verdict, on the tracking page and on the complaint. Colour carries
   the sense, but never alone: the tick or cross and the wording say it too. */
.rating-given {
    margin-block-start: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-inline-start-width: 4px;
    border-radius: var(--radius);
    background: var(--surface);
}

.rating-given.is-positive { border-inline-start-color: var(--green-600); }
.rating-given.is-negative { border-inline-start-color: #b42318; }

.rating-given h2 {
    margin: 0 0 var(--space-2);
    color: var(--ink-600);
    font-size: var(--text-sm);
    font-weight: 500;
}

.rating-verdict {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    font-weight: 600;
    color: var(--ink-900);
}

.rating-mark {
    display: inline-grid;
    place-items: center;
    inline-size: 1.5rem;
    block-size: 1.5rem;
    border-radius: 50%;
    font-size: 0.85rem;
    color: #fff;
}

.is-positive .rating-mark { background: var(--green-600); }
.is-negative .rating-mark { background: #b42318; }

.rating-when {
    margin-inline-start: auto;
    font-weight: 400;
    font-size: var(--text-sm);
    color: var(--ink-600);
}

.rating-comment {
    margin: var(--space-2) 0 0;
    color: var(--ink-700);
}

/* ==========================================================================================
   The crests
   ==========================================================================================
   Both are dark green on transparency, so they read on white and disappear on the
   department's own green. Where one has to sit on green it goes in a white roundel, which is
   what a seal does on a letterhead; the roundel is never used on a light surface, where the
   crest can simply sit on the page.
   ========================================================================================== */

.crest {
    display: block;
    block-size: auto;
    object-fit: contain;
}

/* Square, so the roundel is a circle and not an ellipse. The two crests are drawn to
   different proportions — the province's arms are wider than they are tall, the department's
   are square — so each is fitted inside an identical box rather than given the same width and
   left to take whatever height it came with. */
.crest-roundel {
    aspect-ratio: 1;
    background: #fff;
    border-radius: 50%;
    padding: 0.35rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* The header. Small enough not to compete with the name beside it, and the pair is laid out
   as a row so the name stays vertically centred against it. */
.public-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.public-brand .crest {
    inline-size: 2.25rem;
    padding: 0.2rem;
    flex: none;
}

/* The landing band, above the department's own name. */
.desk-crest {
    inline-size: clamp(3.5rem, 6vw, 4.75rem);
    margin-inline: auto;
    margin-block-end: var(--space-4);
}

/* The inauguration page: the province's crest and the department's, side by side. */
.launch-crests {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    margin-block-end: clamp(1rem, 3vh, 2rem);
}

.launch-crest {
    inline-size: clamp(3.25rem, 7vh, 5.5rem);
    padding: 0.5rem;
}
