
    :root {
        --font-sans: "IBM Plex Sans", "Noto Sans Tamil", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

        /* Brand: one deep navy for buttons, links and highlights, with a
           lighter navy partner (--accent-2) for the logo mark. */
        --navy: #1e3a6e;
        --navy-hover: #172e58;
        --navy-deep: #13233f;
        --accent-2: #2c4d85;
        --white: #ffffff;
        --black: #1c2533;

        /* What the theme swaps: the background of cards, panels and
           menus, body text, and text on a dark fill (tooltips, Import CSV). */
        --surface: #ffffff;
        --text: #1c2533;
        --inverse-text: #ffffff;

        /* The blue jobs dark mode separates: --navy fills buttons, while
           blue text and links use --navy-text, outlined buttons
           --btn-outline; the navbar uses --bar (its hovers --bar-hover and
           --bar-deep) and list table headings --table-head. In light mode
           buttons are deep navy, links a steel blue, the navbar navy ink
           (#13233f) and table headings a quiet tint of the page; in dark
           mode they're all bright blue (#3b82f6). --on-navy is text and
           icons on a --navy fill. */
        --navy-text: #24508f;
        --btn-outline: var(--navy);
        --on-navy: var(--white);
        --bar: #13233f;
        --bar-hover: #1d3257;
        --bar-deep: #26406c;
        --bar-line: transparent;
        /* The navbar's dropdown menus, which sit over the page. */
        --bar-menu: var(--bar-hover);
        /* The line under the menu of the page being shown. */
        --nav-active: #7fa3dc;
        /* Toasts (ui-enhancements.html): their fill and the tick before the text. */
        --toast-bg: #13233f;
        --toast-icon: #6fcf97;
        /* The navbar's menu links and icons: pale blue-grey on the bar, the
           button colour in dark. */
        --nav-link: #c8d2e3;
        --table-head: #f7f8fb;
        --table-head-text: var(--gray-500);
        /* Secondary buttons: white with navy text and a grey ring
           (--btn-soft-ring), outlined in the button colour in dark mode. */
        --btn-soft-bg: #ffffff;
        --btn-soft-text: var(--navy);
        --btn-soft-ring: var(--gray-200);
        /* The glow under a solid button while it's hovered: none in light
           mode. */
        --btn-glow: transparent;
        /* A solid button's fill: the button colour (a gradient in dark). */
        --btn-fill: var(--navy);

        /* Shape: one set for both themes (the dark block below changes
           colours only). Text buttons and fields 8px, cards (list tables,
           form cards and sections, windows) 12px, badges pills, plus the
           card shadow and a field's resting ring. */
        --radius-btn: 8px;
        --radius-card: 12px;
        --radius-badge: 999px;
        --radius-field: 8px;
        /* Small things: chips, icon buttons, small boxes. */
        --radius-sm: 6px;
        /* The text scale: every page uses these sizes, not its own. xs for
           captions, table headings and hints, sm for labels and badges,
           base (and md, the same size) for body text, buttons, menus and
           table cells, lg for section headings, xl for panel and window
           titles and 2xl for page titles. --text-scale is the user's font
           size (User Settings), which multiplies them all. */
        --text-scale: 1;
        --text-xs: calc(12px * var(--text-scale));
        --text-sm: calc(13px * var(--text-scale));
        --text-base: calc(14px * var(--text-scale));
        --text-md: calc(14px * var(--text-scale));
        --text-lg: calc(16px * var(--text-scale));
        --text-xl: calc(20px * var(--text-scale));
        --text-2xl: calc(24px * var(--text-scale));
        --card-shadow: none; /* cards are set off by their hairline; only things that float (drawers, menus) cast a shadow */
        --field-ring: inset 0 0 0 1px var(--gray-200);
        /* The track behind a segmented control's pills. */
        --segment-track: var(--gray-100);
        /* Type and density: text button weight, list table headings (size,
           case, letter spacing), list table row padding, and the dot before
           a form section's title. */
        --btn-weight: 600;
        --th-size: 12px;
        --th-case: none;
        --th-tracking: normal;
        --row-pad: 10px;
        --row-h: 44px;
        --section-dot: var(--navy);
        /* A switch: grey when off, the button colour when on. Red and green
           are for real status (failed, posted), not for a setting that's
           simply off. */
        --switch-off: var(--gray-250);
        --switch-on: var(--navy);

        /* The page background and the two shades list table rows alternate. */
        --page-bg: #f4f6f9;
        /* A search box and type chips on the page: a soft fill with no outline. */
        --soft-fill: #e8ecf2;
        --soft-fill-hover: #dfe4ec;
        --row-stripe: #eef1f5;
        --row-stripe-alt: #f8f9fb;

        /* Greys, dark to light: neutral slate */
        --gray-900: #1c2533;
        --gray-800: #2b3543;
        --gray-700: #3b4554;
        --gray-600: #4a5566;
        --gray-500: #5f6b7b;
        --gray-450: #6b7686;
        --gray-400: #808a99;
        --gray-350: #8a94a3;
        --gray-300: #a3acb9;
        --gray-250: #b8c0cb;
        --gray-200: #cdd4de;
        --gray-150: #dde2ea;
        --gray-125: #e3e7ee;
        --gray-100: #eef1f5;
        /* The line between a list table's rows: fainter than the other hairlines. */
        --row-line: #f1f3f7;
        --gray-75: #f1f3f7;
        --gray-50: #f5f7fa;
        --gray-25: #f8f9fb;

        /* Blue-greys and blue tints (table rows, hovers, panels) */
        --slate-900: #1f2937;
        --slate-500: #9aa5b1;
        --slate-400: #c5c9d1;
        --slate-300: #d6dbe6;
        --slate-200: #e3e6ef;
        --slate-100: #f0f2f6;
        --blue-ink: #24508f;
        --blue-300: #c9d7ee;
        --blue-200: #e3ebf7;
        --blue-150: #ebf1fa;
        --blue-100: #f0f4fb;
        --blue-75: #f5f8fd;
        --blue-50: #fafbfe;

        /* Status */
        --danger: #c0392b;
        --danger-strong: #8b0000;
        --success: #2e7d32;
        --invalid: #d70015;

        /* Greens and teals */
        --green-700: #1e6b34;
        --green-600: #1e8449;
        --green-300: #8fdc9a;
        --green-200: #cfe9d6;
        --green-100: #dff3e3;
        --green-50: #eaf7ee;
        --teal-400: #3ce1d0;
        --teal-200: #d7ece8;
        --teal-100: #eef8f6;
        --teal-75: #f3f6f6;
        --teal-50: #f4faf9;

        /* Reds */
        --red-600: #d32f2f;
        --red-200: #f4a6a6;
        --red-150: #f3c6c0;
        --red-100: #fde2e1;
        --red-50: #fdecea;
        --red-25: #fff5f5;

        /* Ambers */
        --amber-800: #8a6d1d;
        --amber-700: #8a5a00;
        --amber-600: #a15c00;
        --amber-500: #b9770e;
        --amber-300: #f3dcb9;
        --amber-250: #f0dca0;
        --amber-200: #f3e3b5;
        --amber-150: #fff1cf;
        --amber-100: #fdf3e6;
        --amber-75: #fdf6e3;
        --amber-50: #fff8e1;

        /* Purples */
        --purple-700: #6c3fa0;
        --purple-200: #e3d6f2;
        --purple-50: #f5effb;

        /* See-through colours: overlays, shadows, field fills, focus rings */
        --scrim: rgba(0, 0, 0, 0.45);
        --shade-06: rgba(0, 0, 0, 0.06);
        --shade-15: rgba(0, 0, 0, 0.15);
        --shade-20: rgba(0, 0, 0, 0.2);
        --shade-25: rgba(0, 0, 0, 0.25);
        --shade-30: rgba(0, 0, 0, 0.3);
        --white-35: rgba(255, 255, 255, 0.35);
        --field-fill: #ffffff;
        --field-fill-hover: #ffffff;
        --field-fill-disabled: var(--gray-75);
        --focus-halo: rgba(44, 90, 160, 0.2);
        /* Extra light around a focused field: none, except in dark mode. */
        --focus-glow: 0 0 0 0 transparent;
        --invalid-halo: rgba(215, 0, 21, 0.14);
    }

    /* Dark mode (User Settings): the same tokens, redefined as colours
       only. A blue-black canvas with blue-tinted surfaces and lines, and
       one bright blue (#3b82f6) for filled buttons, links and outlines.
       Shapes, type sizes and spacing are the light theme's (the shape
       tokens above aren't redefined here), so switching theme changes how
       the page is coloured and nothing else. The grey scale flips, so
       gray-900 is still the strongest text and gray-25 the quietest fill.
       The pale tints become low-key dark fills, and the status tints keep
       just enough colour to tell them apart. */
    :root[data-theme="dark"] {
        color-scheme: dark;

        --navy: #3b82f6;
        --navy-hover: #60a5fa;
        --navy-deep: #102a52;
        --accent-2: #22d3ee;
        --navy-text: #93c5fd;
        --btn-outline: #60a5fa;
        --on-navy: #ffffff;
        --black: #f1f3f4;
        --btn-soft-bg: transparent;
        --btn-soft-text: var(--navy-text);
        --btn-soft-ring: rgba(255, 255, 255, 0.18);

        --bar: #0a1322;
        --bar-hover: rgba(96, 165, 250, 0.14);
        --bar-deep: rgba(96, 165, 250, 0.24);
        --bar-line: rgba(96, 165, 250, 0.26);
        --bar-menu: #0d1a2e;
        --nav-active: #60a5fa;
        --toast-bg: #13294d;
        --toast-icon: #6fcf97;
        --nav-link: #c7d8f2;
        --table-head: #0d1a2e;
        --table-head-text: #8aa6cc;

        --field-ring: inset 0 0 0 1px var(--blue-300);
        --segment-track: var(--field-fill);
        --switch-off: var(--gray-200);

        --page-bg: #050a14;
        --soft-fill: #101d33;
        --soft-fill-hover: #162742;
        --row-stripe: #0d1a2e;
        --row-stripe-alt: #0a1524;

        --surface: #0b1424;
        --text: #e3ecfb;
        --inverse-text: #050a14;

        --gray-900: #e8eaed;
        --gray-800: #dadce0;
        --gray-700: #c8cbd0;
        --gray-600: #b4b8be;
        --gray-500: #a0a4ab;
        --gray-450: #92969d;
        --gray-400: #81858c;
        --gray-350: #70747b;
        --gray-300: #5f636a;
        --gray-250: #50535a;
        --gray-200: #42454c;
        --gray-150: #1e3050;
        --gray-125: #182a45;
        --gray-100: #15243c;
        --row-line: #15243c;
        --gray-75: #070e1a;
        --gray-50: #122038;
        --gray-25: #101c32;

        --slate-900: #e8eaed;
        --slate-500: #5b6b85;
        --slate-400: #3d4c66;
        --slate-300: #283a57;
        --slate-200: #1a2c48;
        --slate-100: #15253e;
        --blue-ink: #93c5fd;
        --blue-300: #1e3f75;
        --blue-200: #12284a;
        --blue-150: #142c52;
        --blue-100: #0d1a2e;
        --blue-75: #11213a;
        --blue-50: #0e1a30;

        --danger: #f28b82;
        --danger-strong: #b3362c;
        --success: #81c995;
        --invalid: #f28b82;

        --green-700: #81c995;
        --green-600: #6dbf86;
        --green-300: #2e7d4a;
        --green-200: #27412f;
        --green-100: #213628;
        --green-50: #1e2f24;
        --teal-400: #3ccfbf;
        --teal-200: #2c4a46;
        --teal-100: #20302e;
        --teal-75: #272a30;
        --teal-50: #1f2827;

        --red-600: #f28b82;
        --red-200: #7a3a36;
        --red-150: #5c2f2b;
        --red-100: #432624;
        --red-50: #3a2321;
        --red-25: #2c1f1e;

        --amber-800: #fdd663;
        --amber-700: #f6c15b;
        --amber-600: #f5a35b;
        --amber-500: #f0b04a;
        --amber-300: #5a4627;
        --amber-250: #574a24;
        --amber-200: #4a3f22;
        --amber-150: #43391f;
        --amber-100: #3a2f20;
        --amber-75: #352e1d;
        --amber-50: #2f291c;

        --purple-700: #c58af9;
        --purple-200: #3f3152;
        --purple-50: #2a2433;

        --shade-06: rgba(0, 0, 0, 0.3);
        --shade-15: rgba(0, 0, 0, 0.4);
        --shade-20: rgba(0, 0, 0, 0.45);
        --shade-25: rgba(0, 0, 0, 0.5);
        --shade-30: rgba(0, 0, 0, 0.55);
        --scrim: rgba(2, 5, 12, 0.7);
        --field-fill: rgba(255, 255, 255, 0.05);
        --field-fill-hover: rgba(255, 255, 255, 0.08);
        --field-fill-disabled: rgba(255, 255, 255, 0.025);
        --focus-halo: rgba(59, 130, 246, 0.35);
        --invalid-halo: rgba(242, 139, 130, 0.2);
    }

    html { font-size: calc(100% * var(--text-scale)); }
    /* Table rows (User Settings): compact rows fit more of a list on the
       screen. base-styles' script sets data-density before the page paints. */
    :root[data-density="compact"] { --row-pad: 4px; --row-h: 34px; }
    body { font-family: var(--font-sans); color: var(--text); }
    :where(button, input, select, textarea) { font-family: inherit; }
    /* Fields a page doesn't size itself are 14px (the browser's own is about 13px). */
    :where(input, select, textarea) { font-size: var(--text-base); }

    /* Text buttons and their variants. */
    /* Every button takes the page's typeface and size, rather than the
       browser's own 13.33px, unless its style sets one. */
    :where(button) { font-family: inherit; font-size: inherit; }
    /* A plain button has none of the browser's border or fill unless its
       page gives it some. */
    :where(button.plain-btn) { border: 0; background: none; cursor: pointer; }
    :where(button:not(.icon-btn, .burger-btn, .tab-btn, .chip-remove, .remove-line, .toggle-btn, .plain-btn)) {
        padding: 11px 24px;
        font-size: var(--text-base);
        font-weight: var(--btn-weight);
        background: var(--btn-fill);
        color: var(--on-navy);
        border: none;
        border-radius: var(--radius-btn);
        cursor: pointer;
        transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    }
    /* A solid button glows softly while hovered and dips when pressed. */
    :where(button:not(.icon-btn, .burger-btn, .tab-btn, .chip-remove, .remove-line, .toggle-btn, .plain-btn, .btn-secondary, .btn-cancel, .btn-export):not(:disabled)):hover { box-shadow: 0 4px 16px var(--btn-glow); }
    :where(button:not(.icon-btn, .burger-btn, .tab-btn, .chip-remove, .remove-line, .toggle-btn, .plain-btn):not(:disabled)):active { transform: translateY(1px); }
    /* The smaller size, for buttons inside table rows and secondary
       controls next to a form (Edit, Expand all, + Add component). */
    :where(button.btn-sm) { padding: 7px 16px; font-size: var(--text-sm); }
    /* Delete buttons are dark red. */
    :where(button.btn-delete) { background: var(--danger-strong); color: var(--white); }
    /* Secondary buttons: everything in a toolbar or form that isn't its
       one main action (type lists, Stock count, Print, + Add line, ...).
       White with a grey ring (an outline in dark mode), so the solid button is
       the one to press. */
    :where(button.btn-secondary) { background: var(--btn-soft-bg); color: var(--btn-soft-text); box-shadow: inset 0 0 0 1.5px var(--btn-soft-ring); }
    :where(button.btn-secondary:not(:disabled)):hover { box-shadow: inset 0 0 0 1.5px var(--btn-outline); }
    /* Cancel buttons are outlined in the button colour (--btn-outline).
       The outline is an inset shadow rather than a border so they stay
       the size of the buttons beside them. */
    :where(button.btn-cancel) { background: transparent; color: var(--btn-outline); box-shadow: inset 0 0 0 1.5px var(--btn-outline); }
    /* Download CSV buttons are outlined in black, Import CSV ones black. */
    :where(button.btn-export) { background: transparent; color: var(--black); box-shadow: inset 0 0 0 1.5px var(--black); }
    :where(button.btn-import) { background: var(--black); color: var(--inverse-text); }
    :where(button:not(.icon-btn, .burger-btn, .tab-btn, .chip-remove, .remove-line, .toggle-btn, .plain-btn):disabled) {
        background: var(--slate-500);
        color: var(--white);
        box-shadow: none;
        cursor: not-allowed;
    }

    /* Icons. */
    .icon {
        display: inline-block;
        flex-shrink: 0;
        width: 1em;
        height: 1em;
        vertical-align: -0.125em;
        background-color: currentColor;
        -webkit-mask: var(--icon) center / contain no-repeat;
        mask: var(--icon) center / contain no-repeat;
    }
    /* In dark mode every icon (the .icon set and the inline SVG icons,
       which draw in currentColor) takes the button colour. Icons on a
       filled text button keep its text colour, and the icons in error and
       success messages keep their red and green. */
    :root[data-theme="dark"] :is(.icon, svg) { color: var(--navy); }
    :root[data-theme="dark"] :is(button:not(.icon-btn, .burger-btn, .tab-btn, .chip-remove, .remove-line, .toggle-btn, .plain-btn, .fs-cog, .table-settings-bar > button), .error, .success) :is(.icon, svg) { color: inherit; }
    .icon-chevron-down { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
    .icon-chevron-up { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15l6-6 6 6'/%3E%3C/svg%3E"); }
    .icon-chevron-right { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"); }
    .icon-chevron-left { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E"); }
    .icon-upload { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7.5 8.5L12 4l4.5 4.5M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E"); }
    .icon-x { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
    .icon-grip { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='9' cy='6' r='1.6'/%3E%3Ccircle cx='15' cy='6' r='1.6'/%3E%3Ccircle cx='9' cy='12' r='1.6'/%3E%3Ccircle cx='15' cy='12' r='1.6'/%3E%3Ccircle cx='9' cy='18' r='1.6'/%3E%3Ccircle cx='15' cy='18' r='1.6'/%3E%3C/svg%3E"); }
    .icon-more { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E"); }
    .icon-alert { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E"); }
    .icon-circle { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E"); }
    .icon-check { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.7 2.7L16 9.8'/%3E%3C/svg%3E"); }
    .icon-repeat { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 5.7'/%3E%3Cpath d='M20 4v7h-7'/%3E%3C/svg%3E"); }

    /* Keyboard focus: one 2px ring on everything you can tab to (fields
       have their own ring in field-styles). It only shows for keyboard
       use (:focus-visible), and turns white on the dark navbar, where
       blue wouldn't show. */
    :where(a, button, summary, [tabindex], input[type="checkbox"], input[type="radio"], input[type="file"]):focus-visible {
        outline: 2px solid var(--navy-text);
        outline-offset: 2px;
    }
    :where(.navbar, .side-drawer) :where(a, button, input):focus-visible {
        outline-color: var(--white);
        outline-offset: -2px;
    }

    /* Links. */
    :where(a) { color: var(--navy-text); text-decoration: none; }
    :where(a):hover { text-decoration: underline; }
    :where(p, li) :where(a) { text-decoration: underline; }

    /* Messages: a page's ?error= / ?success= and other notices. */
    :where(.error, .success) {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        margin: 0 0 16px;
        padding: 10px 14px;
        border: 1px solid;
        border-radius: var(--radius-card);
        font-size: var(--text-md);
        line-height: 1.4;
    }
    :where(.error, .success)::before {
        content: "";
        flex-shrink: 0;
        width: 18px;
        height: 18px;
        margin-top: 0.5px;
        background-color: currentColor;
        -webkit-mask: var(--icon) center / contain no-repeat;
        mask: var(--icon) center / contain no-repeat;
    }
    :where(.error) { color: var(--danger); background: var(--red-50); border-color: var(--red-150); }
    :where(.error)::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E"); }
    :where(.success) { color: var(--success); background: var(--green-50); border-color: var(--green-200); }
    :where(.success)::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.7 2.7L16 9.8'/%3E%3C/svg%3E"); }

    /* A date field not being typed in shows its data-shown text (the script
       at the top) instead of the browser's own format. */
    @supports selector(::-webkit-datetime-edit) {
        input[type="date"][data-shown]:not(:focus)::-webkit-datetime-edit { opacity: 0; }
        input[type="date"][data-shown] { position: relative; }
        input[type="date"][data-shown]:not(:focus)::before { content: attr(data-shown); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
        input[type="date"][data-empty]:not(:focus)::before { color: var(--gray-500); }
    }

    /* File inputs: the file name beside an outlined Choose file button. */
    :where(input[type="file"]) { font-size: var(--text-base); color: var(--gray-600); max-width: 100%; }
    :where(input[type="file"])::file-selector-button {
        margin-right: 12px;
        padding: 8px 18px;
        font: inherit;
        font-size: var(--text-sm);
        font-weight: 600;
        color: var(--btn-soft-text);
        background: var(--btn-soft-bg);
        border: none;
        border-radius: var(--radius-btn);
        box-shadow: inset 0 0 0 1.5px var(--btn-soft-ring);
        cursor: pointer;
    }

    /* A drop zone (the drop-zones script above): a dashed box around a file
       input, which lies invisibly over the whole box so a click opens the
       file picker and a dropped file lands in it. */
    .drop-zone { position: relative; display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: 100%; max-width: 480px; min-height: 52px; padding: 12px 16px; border: 1.5px dashed var(--gray-300); border-radius: var(--radius-card); background: var(--surface); color: var(--gray-600); font-size: var(--text-sm); cursor: pointer; }
    .drop-zone:hover, .drop-zone.over { border-color: var(--navy-text); background: var(--blue-100); color: var(--navy-text); }
    .drop-zone:focus-within { outline: 2px solid var(--navy-text); outline-offset: 2px; }
    .drop-zone .icon { flex-shrink: 0; }
    .drop-zone .dz-text { min-width: 0; }
    .drop-zone .dz-file { min-width: 0; margin-left: auto; overflow: hidden; color: var(--gray-900); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
    .drop-zone.has-file { border-style: solid; }
    .drop-zone.has-file .dz-text { display: none; }
    .drop-zone.has-file .dz-file { margin-left: 0; }
    .drop-zone > input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }

    /* Required fields: the label of a required field (marked .is-required
       by the label script above) ends in a red asterisk, which screen
       readers skip since the field itself says it's required. */
    :where(label.is-required)::after { content: " *"; content: " *" / ""; color: var(--danger); }
    /* A field's own message, in a red line under it (the field-messages
       script above). */
    :where(.field-error) { margin: 4px 0 0; font-size: var(--text-sm); line-height: 16px; color: var(--danger); }
    /* A submit button while its form is on its way: a spinner after the
       label, and no more clicks (the busy-buttons script above). */
    :where(button.is-busy) { cursor: progress; pointer-events: none; }
    :where(button.is-busy)::after {
        content: "";
        display: inline-block;
        width: 0.9em;
        height: 0.9em;
        margin-left: 8px;
        vertical-align: -0.15em;
        border: 2px solid currentColor;
        border-right-color: transparent;
        border-radius: 50%;
        box-sizing: border-box;
        animation: busy-spin 0.7s linear infinite;
    }
    @keyframes busy-spin { to { transform: rotate(360deg); } }
    @media (prefers-reduced-motion: reduce) { :where(button.is-busy)::after { animation-duration: 2s; } }
