/* ============================================================================
   Easy — application shell & design tokens
   ----------------------------------------------------------------------------
   Palette is Project Five's, taken from the real logo files in /branding
   (see docs/PROJECT-ROADMAP.md §1.1):

     --brand-red   #CE152C   sampled from the logo — primary / committing actions
     --brand-slate #596475   sampled from the logo — secondary text, muted chrome

   DELIBERATE DEVIATION: the dark app chrome (sidebar, wizard bar) uses charcoal
   #14181D, not the brand slate. Charcoal reads better as a dark UI surface than
   the lighter slate, and it matches the published wireframes. This is a recorded
   design choice, not drift — revisit only if the brand system later mandates the
   exact slate everywhere. The wireframes' accent #E5342A is superseded here by
   the exact logo red #CE152C.

   LIGHT AND DARK (owner decision 2026-09-29: dark mode is supported on every page).
   A colour is written once, as a token here; every rule below uses var(--token), so a
   theme is nothing but a second set of values. `ThemeColourGuardTests` fails on a colour
   literal anywhere else. The dark set is built from the same brand: the charcoal chrome
   becomes the page, the logo red stays the committing fill (white on it is 5.6:1) and a
   lighter red carries red TEXT, which the logo red cannot on charcoal. Documents stay
   paper-white in both (they are printed): see the --paper tokens.

   Which theme applies: the person's choice (Profile → Appearance, a cookie read by
   App.razor into <html data-theme>), else the operating system. So the dark values sit in
   two blocks with the same body, one per route in; `ThemeColourGuardTests` keeps them
   identical. Change a dark value? Change it in both.
   ========================================================================== */

:root {
    color-scheme: light;

    --brand-red: #CE152C;           /* red TEXT and marks: links, active tabs, focus outlines */
    --brand-red-hover: #AE1125;
    --brand-red-wash: rgba(206, 21, 44, 0.10);
    --brand-red-soft: rgba(206, 21, 44, 0.12);   /* the 3px "picked" halo round a chosen card */
    --brand-red-line: rgba(206, 21, 44, 0.24);   /* a red hairline: danger badges, a hovered card */
    --brand-fill: #CE152C;          /* red FILL behind white text: the primary button, badges, steps */
    --brand-fill-hover: #AE1125;
    --on-fill: #FFFFFF;             /* text on any saturated fill (red, green, the charcoal chrome) */
    --brand-slate: #596475;
    --focus-ring: rgba(206, 21, 44, 0.14);

    --chrome-dark: #14181D;      /* wizard top bar (see note above) */
    --chrome-dark-muted: #8A8F98;
    --chrome-dark-faint: #4A4E55;
    /* "Inverted" marks — a finished step, the chosen pill: charcoal on the light page, near-white on the dark one. */
    --inverse-bg: #14181D;
    --inverse-ink: #FFFFFF;

    /* Left rail. Light values here; the dark theme below gives it the charcoal chrome. */
    --sidebar-bg: var(--surface);
    --sidebar-border: var(--line);
    --sidebar-ink: var(--ink);              /* active label / icon */
    --sidebar-ink-muted: var(--ink-soft);   /* resting label / icon */
    --sidebar-hover-bg: var(--surface-sunk);
    --sidebar-hover-ink: var(--ink);
    --sidebar-active-ink: var(--brand-red);
    --sidebar-active-bg: var(--brand-red-wash);
    --sidebar-control-border: var(--line-strong);

    --ink: #1A1A1A;
    --ink-soft: #57595F;      /* was #6B6B68 — one step darker so it stays clearly stronger than --ink-faint below */
    /* Secondary text. Was #8A8F98 (3.1–3.25:1 on the white/off-white surfaces, under the 4.5:1 AA minimum for small
       text); #626977 clears it everywhere it is used — 5.4:1 on white, 5.1:1 on --surface-sunk and still 4.6:1 on the
       pink/green selected-row washes — and stays a step lighter than --ink. */
    --ink-faint: #626977;
    --ink-ghost: #C8C8C6;        /* the em dash standing in for a zero: deliberately quiet */
    --ink-placeholder: #A1A5AA;

    --surface: #FFFFFF;
    --surface-sunk: #FAFAFA;
    --surface-raised: #FFFFFF;   /* menus, popovers, dialogs: one step above a card in the dark theme */
    --line: #E2E2E0;
    --line-soft: #F0F0EE;
    --line-strong: #D8D8D6;
    --line-hover: #BFC3C7;
    --hover-tint: rgba(20, 24, 29, 0.04);
    --scrim: rgba(20, 24, 29, 0.42);
    --toggle-knob: #FFFFFF;
    /* The dropdown caret, drawn in --ink-soft's family. A data URI cannot read a custom property, so each theme has its own. */
    --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%236B6B68' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

    --ok: #1A8A5A;
    --ok-hover: #166B47;        /* the green fill, hovered (white on it 6.5:1) */
    --ok-ink: #166B47;
    --ok-wash: rgba(26, 138, 90, 0.10);
    --ok-line: rgba(26, 138, 90, 0.25);
    --warn: #8F6200;
    --warn-ink: #8F6200;
    --warn-wash: #FFF6E6;
    --warn-wash-hover: #FCEFD4;
    --warn-line: #F0DCA8;
    --warn-tint: rgba(154, 106, 0, 0.12);
    --danger-ink: #A31221;
    --danger-wash: rgba(206, 21, 44, 0.09);
    --danger-line: rgba(206, 21, 44, 0.22);
    --info-ink: #4B5668;
    --info-wash: rgba(89, 100, 117, 0.10);
    --info-line: rgba(89, 100, 117, 0.22);

    /* Top-of-page ribbons (support session, read-only, trial, two-factor): white on a dark band in both themes. */
    --ribbon-bg: #14181F;
    --ribbon-warn: #8A5F00;
    --ribbon-info: #1F4E79;
    --ribbon-ink: #FFFFFF;
    --ribbon-line: rgba(255, 255, 255, 0.10);
    --ribbon-tag: rgba(255, 255, 255, 0.16);

    /* Paper: a document preview, a document-layout thumbnail. Printed things stay white in both themes. */
    --paper: #FFFFFF;
    --paper-line: #CFD3DA;
    --paper-sunk: #F4F5F7;
    --paper-ink: #C3C9D1;
    --paper-rule: #E4E7EB;

    /* Chart marks. History is a mid grey that clears 3:1 on white and on the off-white page (3.4 / 3.2); "now" is ink.
       One pair, used by the sparklines and the financial-year strip, so "past grey, now black" means one thing. */
    --chart-past: #858C99;
    --chart-now: var(--ink);
    /* Budget vs actual: two categorical hues (blue actual, orange budget), validated as a pair for colour-vision
       deficiency (worst ΔE 24.7) and ≥ 3:1 on white. Deliberately not the brand red, which reads as "loss". */
    --chart-actual: #2A78D6;
    --chart-actual-soft: #A9C8EF;
    --chart-budget: #EB6834;
    --chart-hover: rgba(42, 120, 214, 0.06);
    /* Categorical series for the payroll analytics charts and the leave-type cards, in a fixed order. */
    --series-1: #CE152C;
    --series-2: #2563EB;
    --series-3: #D97706;
    --series-3-ink: #B45309;
    --series-4: #1A8A5A;
    --series-5: #596475;
    --series-6: #7C3AED;

    --radius: 8px;
    --radius-sm: 7px;
    --radius-lg: 10px;

    --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --type-page-title: 24px;
    --type-section-title: 16px;
    /* Primary reading and interaction text shares one size across navigation, forms and registers. */
    --type-body: 14px;
    --type-label: 13px;
    --type-helper: 13px;
    --type-table: 14px;
    --type-table-head: 12px;
    --leading-body: 1.48;
    --leading-data: 1.4;
    --control-height: 38px;
    --control-height-sm: 30px;   /* compact controls: buttons and inputs inside table rows */
    --shadow-drawer: -8px 0 24px rgba(0, 0, 0, 0.12);
}

/* ── Dark theme ────────────────────────────────────────────────────────────────
   Charcoal, not grey: the page is a step below the brand's #14181D chrome, cards a step above
   it, menus and dialogs one more. Hairlines carry the structure the light theme gives to
   shadows. Contrast (ThemeContrastTests): body ink 14.2:1 on a card, --ink-soft 8.7:1,
   --ink-faint 6.4:1, red text 5.5:1, white on the red fill 5.6:1. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --brand-red: #F4606E;
        --brand-red-hover: #FF8591;
        --brand-red-wash: rgba(244, 96, 110, 0.12);
        --brand-red-soft: rgba(244, 96, 110, 0.22);
        --brand-red-line: rgba(244, 96, 110, 0.42);
        --brand-fill: #CE152C;
        --brand-fill-hover: #B5122A;
        --on-fill: #FFFFFF;
        --brand-slate: #93A0B3;
        --focus-ring: rgba(244, 96, 110, 0.30);

        --chrome-dark: #0B0D10;
        --chrome-dark-muted: #9AA1AB;
        --chrome-dark-faint: #4A4E55;
        --inverse-bg: #E6E9ED;
        --inverse-ink: #14181D;

        --sidebar-bg: #14181D;
        --sidebar-border: rgba(255, 255, 255, 0.08);
        --sidebar-ink: #FFFFFF;
        --sidebar-ink-muted: #C7CBD1;
        --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
        --sidebar-hover-ink: #FFFFFF;
        --sidebar-active-ink: #FF8791;
        --sidebar-active-bg: rgba(255, 135, 145, 0.14);
        --sidebar-control-border: rgba(255, 255, 255, 0.16);

        --ink: #E8EAED;
        --ink-soft: #B3BAC4;
        --ink-faint: #979FAB;
        --ink-ghost: #4E555F;
        --ink-placeholder: #6E7682;

        --surface: #181C22;
        --surface-sunk: #101317;
        --surface-raised: #1F242B;
        --line: #2C323B;
        --line-soft: #232830;
        --line-strong: #3A424C;
        --line-hover: #525B67;
        --hover-tint: rgba(255, 255, 255, 0.04);
        --scrim: rgba(4, 6, 8, 0.66);
        --toggle-knob: #FFFFFF;
        --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23A3AAB5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

        --ok: #1A8A5A;
        --ok-hover: #157A50;
        --ok-ink: #5FD39A;
        --ok-wash: rgba(95, 211, 154, 0.12);
        --ok-line: rgba(95, 211, 154, 0.30);
        --warn: #F2B84B;
        --warn-ink: #F2B84B;
        --warn-wash: #2A2415;
        --warn-wash-hover: #342C18;
        --warn-line: #5C4A22;
        --warn-tint: rgba(242, 184, 75, 0.16);
        --danger-ink: #FF7A86;
        --danger-wash: rgba(255, 122, 134, 0.12);
        --danger-line: rgba(255, 122, 134, 0.36);
        --info-ink: #AEB8C8;
        --info-wash: rgba(174, 184, 200, 0.10);
        --info-line: rgba(174, 184, 200, 0.24);

        --ribbon-bg: #0B0D10;
        --ribbon-warn: #7A5300;
        --ribbon-info: #1F4E79;
        --ribbon-ink: #FFFFFF;
        --ribbon-line: rgba(255, 255, 255, 0.10);
        --ribbon-tag: rgba(255, 255, 255, 0.16);

        --paper: #FFFFFF;
        --paper-line: #CFD3DA;
        --paper-sunk: #F4F5F7;
        --paper-ink: #C3C9D1;
        --paper-rule: #E4E7EB;

        --chart-past: #6B7380;
        --chart-now: var(--ink);
        --chart-actual: #5C9EEB;
        --chart-actual-soft: #2B4868;
        --chart-budget: #F08050;
        --chart-hover: rgba(92, 158, 235, 0.10);
        --series-1: #F4606E;
        --series-2: #6EA8FF;
        --series-3: #F0A040;
        --series-3-ink: #F0A040;
        --series-4: #4CC38A;
        --series-5: #93A0B3;
        --series-6: #A98BFA;

        --shadow-drawer: -8px 0 28px rgba(0, 0, 0, 0.45);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;

    --brand-red: #F4606E;
    --brand-red-hover: #FF8591;
    --brand-red-wash: rgba(244, 96, 110, 0.12);
    --brand-red-soft: rgba(244, 96, 110, 0.22);
    --brand-red-line: rgba(244, 96, 110, 0.42);
    --brand-fill: #CE152C;
    --brand-fill-hover: #B5122A;
    --on-fill: #FFFFFF;
    --brand-slate: #93A0B3;
    --focus-ring: rgba(244, 96, 110, 0.30);

    --chrome-dark: #0B0D10;
    --chrome-dark-muted: #9AA1AB;
    --chrome-dark-faint: #4A4E55;
    --inverse-bg: #E6E9ED;
    --inverse-ink: #14181D;

    --sidebar-bg: #14181D;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-ink: #FFFFFF;
    --sidebar-ink-muted: #C7CBD1;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-hover-ink: #FFFFFF;
    --sidebar-active-ink: #FF8791;
    --sidebar-active-bg: rgba(255, 135, 145, 0.14);
    --sidebar-control-border: rgba(255, 255, 255, 0.16);

    --ink: #E8EAED;
    --ink-soft: #B3BAC4;
    --ink-faint: #979FAB;
    --ink-ghost: #4E555F;
    --ink-placeholder: #6E7682;

    --surface: #181C22;
    --surface-sunk: #101317;
    --surface-raised: #1F242B;
    --line: #2C323B;
    --line-soft: #232830;
    --line-strong: #3A424C;
    --line-hover: #525B67;
    --hover-tint: rgba(255, 255, 255, 0.04);
    --scrim: rgba(4, 6, 8, 0.66);
    --toggle-knob: #FFFFFF;
    --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23A3AAB5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

    --ok: #1A8A5A;
    --ok-hover: #157A50;
    --ok-ink: #5FD39A;
    --ok-wash: rgba(95, 211, 154, 0.12);
    --ok-line: rgba(95, 211, 154, 0.30);
    --warn: #F2B84B;
    --warn-ink: #F2B84B;
    --warn-wash: #2A2415;
    --warn-wash-hover: #342C18;
    --warn-line: #5C4A22;
    --warn-tint: rgba(242, 184, 75, 0.16);
    --danger-ink: #FF7A86;
    --danger-wash: rgba(255, 122, 134, 0.12);
    --danger-line: rgba(255, 122, 134, 0.36);
    --info-ink: #AEB8C8;
    --info-wash: rgba(174, 184, 200, 0.10);
    --info-line: rgba(174, 184, 200, 0.24);

    --ribbon-bg: #0B0D10;
    --ribbon-warn: #7A5300;
    --ribbon-info: #1F4E79;
    --ribbon-ink: #FFFFFF;
    --ribbon-line: rgba(255, 255, 255, 0.10);
    --ribbon-tag: rgba(255, 255, 255, 0.16);

    --paper: #FFFFFF;
    --paper-line: #CFD3DA;
    --paper-sunk: #F4F5F7;
    --paper-ink: #C3C9D1;
    --paper-rule: #E4E7EB;

    --chart-past: #6B7380;
    --chart-now: var(--ink);
    --chart-actual: #5C9EEB;
    --chart-actual-soft: #2B4868;
    --chart-budget: #F08050;
    --chart-hover: rgba(92, 158, 235, 0.10);
    --series-1: #F4606E;
    --series-2: #6EA8FF;
    --series-3: #F0A040;
    --series-3-ink: #F0A040;
    --series-4: #4CC38A;
    --series-5: #93A0B3;
    --series-6: #A98BFA;

    --shadow-drawer: -8px 0 28px rgba(0, 0, 0, 0.45);
}

/* A logo drawn for one background: the page carries both and the other theme's is hidden (AuthBrand.razor). These only
   ever hide, so the element keeps whatever display its own rule gives it. */
:root[data-theme="light"] .theme-dark-only,
:root[data-theme="dark"] .theme-light-only { display: none !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .theme-dark-only { display: none !important; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .theme-light-only { display: none !important; } }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--surface-sunk);
    font-size: 14px;
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-red); text-decoration: none; }
a:hover { color: var(--brand-red-hover); }
/* One visible keyboard focus ring for anything that does not draw its own (UI-22): the browser default is thin and
   blue-grey on the charcoal chrome. Components with their own focus look set it more specifically. */
:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }
/* A link inside running text is underlined, so it is not told apart by colour alone (WCAG 1.4.1, UI-22); a link that
   stands on its own (a button, a nav item, a "Guide →" line) keeps the plain look. */
p a:not(.btn):not(.badge):not(.filter-chip),
span > a.help-link,
.invoice-audit-meta a,
.record-audit-meta a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

h1, h2, h3 { font-weight: 700; margin: 0; }

/* ── App shell ─────────────────────────────────────────────────────────────── */

/* 100dvh tracks the collapsing mobile address bar; 100vh is the pre-dvh fallback and is
   deliberately first so the later declaration wins wherever dvh is understood. */
.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* Installed-PWA mode draws under the notch / home indicator; the shell chrome takes the
   insets as extra padding (see .app-topbar below and .app-nav in the drawer block). */

/* ── Navigation tree ──────────────────────────────────────────────────────── */
.app-nav {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    gap: 3px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
.app-nav-spacer { flex: 1; min-height: 12px; }

/* ── Narrow-viewport navigation drawer ────────────────────────────────────────
   Below 900px the 232px rail would leave ~143px of content at 375px, so it slides in
   over the page instead. Above the breakpoint the toggle and backdrop never render and
   the rail is docked exactly as before.

   This block must stay *after* the base .app-nav rule above: both selectors have equal
   specificity, so the media query only wins by coming later in the cascade. */
.nav-drawer-toggle { display: none; }
.nav-drawer-backdrop { display: none; }

@media (max-width: 900px) {
    .nav-drawer-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        flex: 0 0 auto; width: 34px; height: 34px; margin-right: 4px;
        border: 1px solid var(--line); border-radius: 8px;
        background: transparent; color: var(--ink-soft); cursor: pointer;
    }
    .nav-drawer-toggle:hover { background: var(--surface-sunk); color: var(--ink); }
    .nav-drawer-toggle:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }

    .app-nav {
        position: fixed; inset: 0 auto 0 0; z-index: 40;
        width: min(280px, 86vw);
        transform: translateX(-100%);
        transition: transform 160ms ease;
        box-shadow: 0 0 0 1px var(--sidebar-border);
        /* Installed-PWA safe areas, now that the rail is no longer a flex child. */
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        padding-left: calc(10px + env(safe-area-inset-left));
    }
    .app-shell.nav-drawer-open .app-nav { transform: translateX(0); }

    .nav-drawer-backdrop {
        display: block; position: fixed; inset: 0; z-index: 39;
        background: var(--scrim);
        touch-action: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-nav { transition: none; }
}

.app-nav-group { display: flex; flex-direction: column; }

.app-nav-row {
    display: flex; align-items: center;
    border-radius: var(--radius);
    color: var(--sidebar-ink-muted);
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.app-nav-row:hover { background: var(--sidebar-hover-bg); box-shadow: 0 1px 2px rgba(26, 26, 26, 0.025); }
.app-nav-row.active { background: var(--sidebar-active-bg); }
.app-nav-row.active .app-nav-label,
.app-nav-row.active .app-nav-ic { color: var(--sidebar-active-ink); }
.app-nav-group.current > .app-nav-row { box-shadow: inset 2px 0 0 var(--brand-red); }
.app-nav-group.current > .app-nav-row .app-nav-ic { color: var(--sidebar-active-ink); }

.app-nav-link {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 11px;
    padding: 9px 8px;
    color: inherit; text-decoration: none;
    font-size: var(--type-body); font-weight: 600; line-height: 1.35;
}
.app-nav-link:hover { color: var(--sidebar-hover-ink); }
.app-nav-ic { display: flex; flex-shrink: 0; color: var(--sidebar-ink-muted); }
.app-nav-ic svg { width: 20px; height: 20px; }
.app-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "Lite" marker on the Payroll rail entry while full Payroll isn't entitled. */
.app-nav-pill {
    flex-shrink: 0; margin-left: auto;
    font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 1px 5px; border-radius: 999px;
    /* The text keeps full strength (opacity .7 dropped it to 3.4:1); only the outline is softened. */
    color: var(--sidebar-ink-muted); border: 1px solid color-mix(in srgb, currentColor 55%, transparent);
}

.app-nav-chevron {
    flex-shrink: 0;
    width: 26px; height: 30px; margin-right: 2px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; cursor: pointer;
    color: var(--sidebar-ink-muted); border-radius: 7px;
    transition: transform .18s cubic-bezier(.2, .8, .2, 1), color .16s ease, background .16s ease;
}
.app-nav-chevron:hover { color: var(--sidebar-hover-ink); background: var(--sidebar-hover-bg); }
.app-nav-chevron.open { transform: rotate(180deg); }

/* Subtree open/close — animate the row track from 0fr→1fr so it slides,
   with the content fading in. The inner wrapper clips during the slide. */
.app-nav-sub {
    display: grid;
    grid-template-rows: 0fr;
    margin-bottom: 0;
    will-change: grid-template-rows;
    transition: grid-template-rows .2s cubic-bezier(.2, .8, .2, 1), margin-bottom .2s cubic-bezier(.2, .8, .2, 1);
}
.app-nav-sub.open { grid-template-rows: 1fr; margin-bottom: 6px; }
.app-nav-sub-inner {
    min-height: 0;
    overflow: hidden;
    display: flex; flex-direction: column; gap: 2px;
    padding-left: 31px;
    opacity: 0;
    transition: opacity .14s ease;
}
.app-nav-sub.open .app-nav-sub-inner { opacity: 1; transition-delay: .04s; }

.app-nav-subitem {
    padding: 7px 9px;
    font-size: var(--type-body); font-weight: 550; line-height: 1.4;
    color: var(--sidebar-ink-muted);
    text-decoration: none;
    border-radius: 7px;
    border-left: 2px solid transparent;
    transition: background .12s ease, color .12s ease;
}
.app-nav-subitem:hover { color: var(--sidebar-hover-ink); background: var(--sidebar-hover-bg); }
.app-nav-subitem.active {
    color: var(--sidebar-active-ink);
    background: var(--sidebar-active-bg);
    border-left-color: var(--brand-red);
}

@media (prefers-reduced-motion: reduce) {
    .app-nav-sub, .app-nav-sub-inner, .app-nav-chevron,
    .app-nav-row, .app-nav-subitem { transition: none; }
}

/* ── Account access ───────────────────────────────────────────────────────── */

.auth-form { width: 100%; }

.auth-form-heading { margin-bottom: 30px; }
.auth-eyebrow {
    margin: 0 0 8px;
    color: var(--brand-red);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.auth-form-heading h1 {
    color: var(--ink);
    font-size: clamp(28px, 3vw, 38px);
    letter-spacing: -.05em;
    line-height: 1.08;
}
.auth-form-heading > p:last-child {
    margin: 13px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.55;
}
.auth-form-login .auth-form-heading {
    margin-bottom: 26px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--line);
}
.auth-login-brand {
    display: flex;
    min-height: 52px;
    align-items: center;
    gap: 16px;
}
.auth-login-brand img {
    display: block;
    width: 52px;
    height: 50px;
    object-fit: contain;
}
.auth-login-brand-rule {
    height: 40px;
    border-left: 1px solid var(--line);
}
.auth-brand-name {
    color: var(--ink);
    font-size: clamp(38px, 3.5vw, 49px);
    font-weight: 800;
    letter-spacing: -.05em;
    line-height: 1;
}
.auth-form-heading-featured {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.auth-page-intro { margin-top: 28px; }
.auth-page-intro .auth-eyebrow { margin-bottom: 10px; }
.auth-page-intro > p:last-child {
    margin: 11px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.55;
}
.auth-page-intro strong { overflow-wrap: anywhere; }
.auth-form-section {
    margin: 25px 0 0;
    color: var(--brand-slate);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.auth-form-section:first-of-type { margin-top: 0; }
.auth-form-register .auth-field { margin-top: 15px; }
.auth-form-section + .auth-field { margin-top: 13px; }
.auth-form-register .auth-field input { height: 46px; }
.auth-form-register .auth-form-section:not(:first-of-type) {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.auth-form-verify #code {
    font-size: 19px;
    letter-spacing: .12em;
    font-variant-numeric: tabular-nums;
}
.auth-recovery {
    margin-top: 24px;
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 13px;
}
.auth-recovery summary { cursor: pointer; line-height: 1.5; }
.auth-recovery summary span { color: var(--brand-red); font-weight: 700; }
.auth-recovery summary:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 4px; }
.auth-recovery form { padding: 2px 0 4px; }
.auth-recovery .auth-secondary-action { margin-top: 18px; }
.auth-form-verify .auth-switch { margin-top: 22px; }
.auth-field { margin-top: 17px; }
.auth-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}
.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.auth-label-row a { font-size: 12px; font-weight: 650; }
.auth-field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-field input::placeholder { color: var(--ink-placeholder); }
.auth-hint { margin: 6px 2px 0; color: var(--ink-faint); font-size: 12px; }
/* Sign-up: business or personal finances (Wave F). Two cards, the chosen one outlined in the brand red. */
.auth-kind { border: 0; padding: 0; margin: 17px 0 0; min-width: 0; }
.auth-kind legend { padding: 0; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.auth-field .auth-kind-option {
    display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 9px; font-weight: 400; cursor: pointer;
}
.auth-field .auth-kind-option:has(input:checked) { border-color: var(--brand-red); }
.auth-field .auth-kind-option input { width: auto; height: auto; margin: 3px 0 0; accent-color: var(--brand-red); }
.auth-kind-option strong { display: block; font-size: 13.5px; }
.auth-kind-option .auth-hint { display: block; margin: 2px 0 0; font-weight: 400; }
.auth-field input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 4px var(--brand-red-wash);
}
.auth-submit:focus-visible,
.auth-secondary-action:focus-visible,
.auth-external-action:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 3px;
}
.auth-submit,
.auth-secondary-action {
    display: flex;
    width: 100%;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}
.auth-submit {
    margin-top: 25px;
    border: 1px solid var(--brand-fill);
    background: var(--brand-fill);
    color: var(--on-fill);
    box-shadow: 0 7px 14px rgba(206, 21, 44, .16);
}
.auth-submit:hover { border-color: var(--brand-fill-hover); background: var(--brand-fill-hover); }
.auth-secondary-action {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
}
.auth-secondary-action:hover { border-color: var(--line-hover); color: var(--ink); }
.auth-external {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-external form { margin: 0; }
.auth-external-action {
    display: flex;
    width: 100%;
    height: 48px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 9px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}
.auth-external-action:hover { border-color: var(--line-hover); color: var(--ink); }
.auth-form-login .auth-divider { margin: 21px 0; }
.auth-form-login .auth-external { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.auth-form-login .auth-external-action { height: 46px; font-size: 13px; }
.auth-login-register {
    margin: 25px 0 0;
    color: var(--ink-soft);
    font-size: 13px;
    text-align: center;
}
.auth-login-register a { margin-left: 4px; font-weight: 750; }
.auth-provider-icon { width: 18px; height: 18px; flex-shrink: 0; }
.auth-inline-link {
    margin: 0 0 18px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-sunk);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-all;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 25px 0;
    color: var(--ink-faint);
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}
.auth-build-note, .auth-terms, .auth-switch {
    margin: 20px 0 0;
    color: var(--ink-faint);
    font-size: 12px;
    line-height: 1.55;
}
.auth-error {
    margin: 0 0 18px;
    padding: 11px 12px;
    border: 1px solid var(--danger-line);
    border-radius: 8px;
    background: var(--danger-wash);
    color: var(--danger-ink);
    font-size: 13px;
    line-height: 1.45;
}
.auth-note {
    margin: 0 0 18px;
    padding: 11px 12px;
    border: 1px solid var(--ok-line);
    border-radius: 8px;
    background: var(--ok-wash);
    color: var(--ok-ink);
    font-size: 13px;
    line-height: 1.45;
}
.auth-terms { margin-top: 16px; }
.auth-switch { text-align: center; }
.auth-switch a { font-weight: 700; }

.ledger-eyebrow {
    margin-bottom: 3px;
    color: var(--brand-red);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .055em;
    text-transform: uppercase;
}
.ledger-inquiry-card { overflow-x: auto; }

.ledger-row-link { color: inherit; text-decoration: none; }
.ledger-row-link:hover { color: inherit; }
.ledger-period-filter { min-width: 210px; }
.ledger-balance-summary {
    display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 0; margin-bottom: 14px; padding: 0;
}
.ledger-balance-summary > div { display: grid; gap: 3px; padding: 13px 16px; border-right: 1px solid var(--line); }
.ledger-balance-summary > div:last-child { border-right: 0; }
.ledger-balance-summary span { color: var(--ink-soft); font-size: var(--type-label); font-weight: 600; }
.ledger-balance-summary strong { font-size: var(--type-section); font-variant-numeric: tabular-nums; }
.ledger-transaction-card { padding: 0; }
.ledger-transaction-table { min-width: 760px; }
.ledger-running-balance { font-weight: 650; }
.ledger-dimension {
    display: inline-block; margin-left: 6px; padding: 1px 5px;
    color: var(--ink-soft); font-size: 10.5px; line-height: 1.4;
    border: 1px solid var(--line-strong); border-radius: 4px;
}
@media (max-width: 640px) {
    .ledger-balance-summary { grid-template-columns: 1fr; }
    .ledger-balance-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .ledger-balance-summary > div:last-child { border-bottom: 0; }
}
.ledger-row-action { color: var(--brand-red); font-size: 12px; font-weight: 650; text-align: right; white-space: nowrap; }
.ledger-source { font-size: 11px; }

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

.app-topbar {
    height: 52px; flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center;
    /* Safe-area insets add to the 20px gutter rather than replacing it, so an installed
       PWA on a notched device keeps its normal spacing. */
    padding: 0 20px;
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    gap: 14px;
}

.business-switcher {
    display: inline-flex; align-items: center; gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 8px 12px 8px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 13px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-sunk) 100%);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(26, 26, 26, 0.04);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.business-switcher:hover {
    border-color: var(--brand-red-line);
    box-shadow: 0 4px 14px rgba(26, 26, 26, 0.06);
    transform: translateY(-1px);
}
.business-switcher:focus-within {
    border-color: var(--brand-red-line);
    box-shadow: 0 0 0 4px var(--brand-red-wash);
}

.business-switcher-badge {
    width: 30px; height: 30px;
    border-radius: 10px;
    background: var(--brand-red-wash);
    color: var(--brand-red);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.business-switcher-body {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}
.business-switcher select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    outline: none;
    padding: 0;
}
.business-switcher-select {
    width: 100%;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.business-switcher-caret {
    color: var(--ink-faint);
    flex-shrink: 0;
}

/* Module title, promoted into the topbar next to the company switcher. Every page in a
   module shows the module name here; the active tab below names the page within it. */
.app-topbar-divider { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }
.app-topbar-title {
    font-size: 15px; font-weight: 700; color: var(--ink);
    letter-spacing: -.01em; white-space: nowrap;
}

.topbar-spacer { flex: 1; }

/* Icon-button pair (approvals inbox, support access) between the spacer and the account
   menu — a small, always-present affordance with an optional count/status badge, rather
   than text that only appears once something is pending. */
.topbar-icon-btn {
    position: relative;
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease;
}
.topbar-icon-btn:hover { background: var(--surface-sunk); color: var(--ink); }
.topbar-icon-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 15px; height: 15px; padding: 0 3px;
    border-radius: 8px;
    background: var(--brand-fill); color: var(--on-fill);
    font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}
.topbar-icon-dot.warn { background: var(--warn-ink); }
.topbar-icon-dot {
    position: absolute; top: 5px; right: 5px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok-ink);
    box-shadow: 0 0 0 2px var(--surface);
}

.avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--brand-fill); color: var(--on-fill);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
}
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu-panel {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 224px;
    padding: 8px; background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: 12px;
    box-shadow: 0 12px 28px rgba(26,26,26,.14);
}
.account-menu-user { padding: 8px 10px 10px; font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.account-menu-panel a, .account-menu-panel button { display: block; box-sizing: border-box; width: 100%; padding: 9px 10px; border: 0; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: var(--type-body); text-decoration: none; border-radius: 7px; cursor: pointer; }
.account-menu-panel a:hover, .account-menu-panel button:hover { background: var(--surface-sunk); }
.account-menu-panel form { margin: 0; }
/* Appearance (ThemeChoice) in the account menu: its label, then the three choices across the panel. The panel's own
   full-width button rule is undone for the segmented control. */
.account-menu-theme { display: grid; gap: 6px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12px; color: var(--ink-faint); }
.account-menu-theme .theme-choice { display: flex; }
.account-menu-panel .theme-choice button { flex: 1 1 0; width: auto; padding: 6px 4px; border-radius: 0; text-align: center; font-size: var(--type-body); color: var(--ink-soft); background: var(--surface-raised); }
.account-menu-panel .theme-choice button:hover { background: var(--surface-sunk); color: var(--ink); }
.account-menu-panel .theme-choice button.active { background: var(--inverse-bg); color: var(--inverse-ink); }
/* Profile → Appearance: the words on the left, the choice on the right; stacked on a phone. */
.theme-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.theme-card > div:first-child { flex: 1 1 260px; min-width: 0; }
.seg button:focus-visible { outline: 2px solid var(--brand-red); outline-offset: -2px; }

/* Company workspace switcher — a real popover keyed to the app's surfaces, replacing the
   native <select> whose OS-drawn option list never matched the styled trigger. */
.business-menu { position: relative; display: inline-flex; }
.business-menu > summary { list-style: none; }
.business-menu > summary::-webkit-details-marker { display: none; }
.business-menu[open] .business-switcher-caret { transform: rotate(180deg); }
.business-switcher-caret { transition: transform .15s ease; }
.business-switcher-select { display: block; font-weight: 700; line-height: 1.25; }
.business-menu-panel {
    position: absolute; left: 0; top: calc(100% + 10px); z-index: 30;
    width: min(320px, calc(100vw - 32px)); max-height: 62vh; overflow: auto;
    padding: 6px; background: var(--surface-raised); border: 1px solid var(--line-strong);
    border-radius: 12px; box-shadow: 0 12px 28px rgba(26, 26, 26, .14);
}
.business-menu-head {
    padding: 8px 10px 9px; font-size: 10px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--ink-faint); border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.business-menu-item {
    display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: 100%;
    padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
    font: inherit; font-size: var(--type-body); color: var(--ink); text-align: left; cursor: pointer;
}
.business-menu-item:hover { background: var(--surface-sunk); }
.business-menu-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.business-menu-item[aria-current="true"] { font-weight: 700; }
.business-menu-item .tick { margin-left: auto; color: var(--brand-red); flex-shrink: 0; }
.business-menu-head-sub {
    margin-top: 6px; border-top: 1px solid var(--line); border-bottom: 0; padding-top: 10px;
}
.business-menu-empty { padding: 4px 10px 9px; font-size: 12px; color: var(--ink-faint); }
.business-menu-item-closed > span:first-child { color: var(--ink-soft); }
.business-menu-tag {
    margin-left: auto; flex-shrink: 0; font-size: 10px; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ink-faint);
    background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
}
.business-menu-item-closed .tick { margin-left: 8px; }
.business-menu-foot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.business-menu-foot a {
    display: block; padding: 9px 10px; border-radius: 8px; font-size: var(--type-body);
    font-weight: 600; color: var(--brand-red); text-decoration: none;
}
.business-menu-foot a:hover { background: var(--brand-red-wash); }

/* ── Operator Console ─────────────────────────────────────────────────────────
   A deliberately separate surface from the customer workspace: cooler, denser,
   internal-tool aesthetic (think a control panel, not the branded product).
   Its own token set so it can never drift into the customer app's styling. */
.pc {
    --pc-bg: #0f1115;
    --pc-panel: #ffffff;
    --pc-ink: #1a1f29;
    --pc-ink-soft: #5b6472;
    --pc-ink-faint: #6b7482;
    --pc-line: #e4e7ec;
    --pc-line-soft: #eef0f3;
    --pc-accent: #4f46e5;
    --pc-rail: #14181f;
    --pc-rail-ink: #aab3c1;
    --pc-rail-ink-dim: #8b94a3;
    --pc-ok: #157a4a;
    --pc-warn: #8a5f00;
    --pc-danger: #b3261e;

    /* Derived surface/state tokens (OC-17) — one name per recurring colour so the console
       never re-hardcodes a tint. */
    --pc-shell: #f4f6f9;
    --pc-on-dark: #ffffff;
    --pc-accent-hover: #4338ca;
    --pc-wash: #f7f8fa;
    --pc-surface-sunk: #f2f4f7;
    --pc-th: #fafbfc;
    --pc-row-hover: #f7f9fc;
    --pc-active-wash: #eef0f4;
    --pc-border-hover: #c9ced7;
    --pc-avatar-wash: #eef0ff;
    --pc-brand-soft: #ff8791;
    --pc-info: #1f4e79;
    /* Theme-aware tints (dark values in the dark-theme .pc blocks below). */
    --pc-accent-ink: #4f46e5;     /* the accent as TEXT; --pc-accent stays the fill behind white text */
    --pc-header-bg: rgba(255, 255, 255, 0.96);
    --pc-subnav-bg: rgba(255, 255, 255, 0.94);
    --pc-focus: rgba(79, 70, 229, 0.12);
    --pc-ok-wash: rgba(21, 122, 74, 0.10);
    --pc-warn-wash: rgba(154, 106, 0, 0.12);
    --pc-danger-wash: rgba(179, 38, 30, 0.08);
    --pc-danger-line: rgba(179, 38, 30, 0.35);
    /* The rail is dark in both themes. */
    --pc-rail-hover: rgba(255, 255, 255, 0.05);
    --pc-rail-active: rgba(255, 255, 255, 0.09);
    --pc-rail-line: rgba(255, 255, 255, 0.08);
}
/* The console in the dark theme: same cool control-panel character, on charcoal. Two blocks, one per route in (see the
   token header); ThemeColourGuardTests keeps them identical. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pc {
        --pc-panel: #181C22;
        --pc-ink: #E8EAED;
        --pc-ink-soft: #AEB6C2;
        --pc-ink-faint: #979FAB;
        --pc-line: #2C323B;
        --pc-line-soft: #232830;
        --pc-accent: #5B53E8;
        --pc-rail: #0B0D10;
        --pc-ok: #5FD39A;
        --pc-warn: #F2B84B;
        --pc-danger: #FF7A86;
        --pc-shell: #101317;
        --pc-accent-hover: #6D66F0;
        --pc-wash: #1C2128;
        --pc-surface-sunk: #1C2128;
        --pc-th: #1C2027;
        --pc-row-hover: #1F242B;
        --pc-active-wash: #252B33;
        --pc-border-hover: #525B67;
        --pc-avatar-wash: #2A2850;
        --pc-accent-ink: #A9A4FF;
        --pc-header-bg: rgba(24, 28, 34, 0.96);
        --pc-subnav-bg: rgba(24, 28, 34, 0.94);
        --pc-focus: rgba(169, 164, 255, 0.28);
        --pc-ok-wash: rgba(95, 211, 154, 0.12);
        --pc-warn-wash: rgba(242, 184, 75, 0.14);
        --pc-danger-wash: rgba(255, 122, 134, 0.12);
        --pc-danger-line: rgba(255, 122, 134, 0.40);
    }
}
:root[data-theme="dark"] .pc {
    --pc-panel: #181C22;
    --pc-ink: #E8EAED;
    --pc-ink-soft: #AEB6C2;
    --pc-ink-faint: #979FAB;
    --pc-line: #2C323B;
    --pc-line-soft: #232830;
    --pc-accent: #5B53E8;
    --pc-rail: #0B0D10;
    --pc-ok: #5FD39A;
    --pc-warn: #F2B84B;
    --pc-danger: #FF7A86;
    --pc-shell: #101317;
    --pc-accent-hover: #6D66F0;
    --pc-wash: #1C2128;
    --pc-surface-sunk: #1C2128;
    --pc-th: #1C2027;
    --pc-row-hover: #1F242B;
    --pc-active-wash: #252B33;
    --pc-border-hover: #525B67;
    --pc-avatar-wash: #2A2850;
    --pc-accent-ink: #A9A4FF;
    --pc-header-bg: rgba(24, 28, 34, 0.96);
    --pc-subnav-bg: rgba(24, 28, 34, 0.94);
    --pc-focus: rgba(169, 164, 255, 0.28);
    --pc-ok-wash: rgba(95, 211, 154, 0.12);
    --pc-warn-wash: rgba(242, 184, 75, 0.14);
    --pc-danger-wash: rgba(255, 122, 134, 0.12);
    --pc-danger-line: rgba(255, 122, 134, 0.40);
}

.pc-shell { height: 100vh; overflow: hidden; display: flex; background: var(--pc-shell); color: var(--pc-ink); }
.pc-skip-link {
    position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-160%);
    padding: 8px 12px; border-radius: 7px; background: var(--pc-panel); color: var(--pc-ink);
    box-shadow: 0 3px 14px rgba(15,23,42,.2); font-size: 13px; font-weight: 700;
}
.pc-skip-link:focus { transform: translateY(0); }

.pc-rail {
    width: 248px; flex-shrink: 0; background: var(--pc-rail); color: var(--pc-rail-ink);
    display: flex; flex-direction: column; padding: 16px 12px;
    overflow-y: auto; overflow-x: hidden;
}
.pc-rail-brand { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 16px; }
.pc-rail-brand strong { color: var(--pc-on-dark); font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.pc-rail-brand span {
    font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: var(--pc-brand-soft);
}
.pc-rail nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.pc-rail nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 7px;
    color: var(--pc-rail-ink); text-decoration: none; font-size: 14px; font-weight: 550;
}
.pc-rail nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.pc-rail nav a:hover { background: var(--pc-rail-hover); color: var(--pc-on-dark); }
.pc-rail nav a.active { background: var(--pc-rail-active); color: var(--pc-on-dark); }
.pc-rail-spacer { flex: 1; }
.pc-rail-foot { border-top: 1px solid var(--pc-rail-line); padding-top: 10px; margin-top: 10px; }
.pc-rail-foot a {
    display: flex; align-items: center; gap: 8px; padding: 10px 11px; border-radius: 7px;
    color: var(--pc-rail-ink-dim); text-decoration: none; font-size: 13px; font-weight: 600;
}
.pc-rail-foot a svg { width: 17px; height: 17px; flex-shrink: 0; }
.pc-rail-foot a:hover { color: var(--pc-on-dark); background: var(--pc-rail-hover); }

.pc-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pc-header {
    height: 60px; flex-shrink: 0; background: var(--pc-header-bg); border-bottom: 1px solid var(--pc-line);
    display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.pc-header-context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-header-section { color: var(--pc-ink-soft); font-size: 13px; font-weight: 650; white-space: nowrap; }
.pc-badge {
    font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: var(--inverse-ink); background: var(--inverse-bg); border-radius: 5px; padding: 3px 7px;
}
.pc-header-spacer { flex: 1; }
.pc-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-avatar {
    width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto;
    border-radius: 50%; background: var(--pc-avatar-wash); color: var(--pc-accent-ink); font-size: 11px; font-weight: 800;
}
.pc-header .pc-user { font-size: 13px; color: var(--pc-ink-soft); font-weight: 600; }
.pc-header form { margin: 0; }
.pc-header button {
    border: 1px solid var(--pc-line); background: var(--pc-panel); color: var(--pc-ink-soft);
    font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 7px; cursor: pointer;
}
.pc-header button:hover { border-color: var(--pc-ink-faint); color: var(--pc-ink); }

.pc-mobile-nav { display: none; }
.pc-content { flex: 1; min-height: 0; overflow: auto; padding: 30px 32px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }
.pc-content:focus { outline: none; }
.pc-page-head { margin-bottom: 22px; }
.pc-page-head h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
.pc-page-head p { margin: 5px 0 0; color: var(--pc-ink-soft); font-size: 13.5px; max-width: 70ch; }
.pc-page-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.pc-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }

.pc-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.pc-kpi {
    background: var(--pc-panel); border: 1px solid var(--pc-line); border-radius: 10px; padding: 15px 16px;
    display: flex; flex-direction: column; gap: 3px; box-shadow: 0 1px 2px rgba(15,23,42,.025);
}
.pc-kpi .k-label { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pc-ink-faint); }
.pc-kpi .k-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.pc-kpi .k-sub { font-size: 12px; color: var(--pc-ink-soft); }

.pc-panel { background: var(--pc-panel); border: 1px solid var(--pc-line); border-radius: 11px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(15,23,42,.025); overflow: hidden; }
.pc-panel-head { padding: 16px 18px; border-bottom: 1px solid var(--pc-line-soft); }
.pc-panel-head h2 { font-size: 15px; }
.pc-panel-head p { margin: 3px 0 0; color: var(--pc-ink-soft); font-size: 12.5px; }
.pc-panel-body { padding: 16px 18px; }

.pc-table { width: 100%; overflow-x: auto; }
.pc-table .tr {
    display: grid; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--pc-line-soft);
    align-items: center; font-size: 13.5px;
}
.pc-table .tr:last-child { border-bottom: none; }
.pc-table .tr.th {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--pc-ink-faint); background: var(--pc-th);
}
.pc-table .tr small { display: block; color: var(--pc-ink-faint); font-size: 11px; margin-top: 2px; }
/* Releases tab (operator console): fixed column layouts, so the page carries no inline styles. */
.pc-table .tr.rel-row { grid-template-columns: 9.5rem 1fr; }
.pc-table .tr.rel-db { grid-template-columns: 2fr .6fr 3fr; }
.pc-table .tr.rel-hist { grid-template-columns: 1.5fr 1.3fr 1fr .9fr 1.7fr .6fr; }
.pc-table .tr.rel-detail { grid-template-columns: 1fr; padding-top: 0; }
/* A client's subscription invoices, and the "record payment" form that opens under one. */
.pc-table .tr.inv-row { grid-template-columns: 130px 1fr 110px 110px 130px; }
.pc-table .tr.inv-pay { grid-template-columns: 1fr; background: var(--pc-th); }
/* A boxed step inside a panel (purge, reset to sample data, reset for migration). */
.pc-subpanel { margin-top: 14px; border: 1px solid var(--pc-line); border-radius: 8px; padding: 14px; background: var(--pc-th); }
.rel-command { margin-top: 6px; }
/* A commit hash is an identifier, not a call to action: monospace and the surrounding ink, underlined on hover. */
a.rel-commit { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: inherit; text-decoration: none; }
a.rel-commit:hover, a.rel-commit:focus-visible { text-decoration: underline; }
.rel-foot { padding: 0 18px 12px; margin: 8px 0 0; font-size: 12px; }
.pc-table a.pc-row-link { color: inherit; text-decoration: none; cursor: pointer; }
.pc-table a.pc-row-link:hover { background: var(--pc-row-hover); }
.pc-table a.pc-row-link:focus-visible { outline: 2px solid var(--pc-accent); outline-offset: -2px; background: var(--pc-row-hover); }

.pc-tag {
    display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px;
    background: var(--pc-line-soft); color: var(--pc-ink-soft);
}
.pc-tag.ok { background: var(--pc-ok-wash); color: var(--pc-ok); }
.pc-tag.warn { background: var(--pc-warn-wash); color: var(--pc-warn); }
.pc-tag.danger { background: var(--pc-danger-wash); color: var(--pc-danger); }

/* Inline usage meter for the operator AI-usage view — a proportion of a monthly allowance. */
.pc-usage-bar { display: inline-block; width: 120px; height: 7px; border-radius: 4px; background: var(--pc-line-soft); overflow: hidden; vertical-align: middle; }
.pc-usage-bar span { display: block; height: 100%; border-radius: 4px; background: var(--pc-accent); }
.pc-usage-bar span.over { background: var(--pc-danger); }

.pc-soon { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-soon span {
    font-size: 12.5px; color: var(--pc-ink-soft); background: var(--pc-surface-sunk); border: 1px dashed var(--pc-line);
    border-radius: 7px; padding: 6px 10px;
}
.pc-note { display: flex; gap: 10px; font-size: 13px; color: var(--pc-ink-soft); background: var(--pc-wash); border: 1px solid var(--pc-line-soft); border-radius: 8px; padding: 12px 14px; }

.pc-btn {
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--pc-line);
    background: var(--pc-panel); color: var(--pc-ink); font: inherit; font-size: 13px; font-weight: 600;
    padding: 8px 13px; border-radius: 7px; cursor: pointer; text-decoration: none;
}
/* The operator console keeps its own look but shares the app's control height, so a filter and a button in one row line up. */
.pc-btn { min-height: var(--control-height); }
.pc-filter { height: var(--control-height); padding-block: 0; }
.pc-btn:hover { border-color: var(--pc-ink-faint); }
.pc-btn.primary { background: var(--pc-accent); border-color: var(--pc-accent); color: var(--pc-on-dark); }
.pc-btn.primary:hover { background: var(--pc-accent-hover); }
.pc-btn.danger { color: var(--pc-danger); border-color: var(--pc-danger-line); }
.pc-btn.danger:hover { border-color: var(--pc-danger); background: var(--pc-danger-wash); }
.pc-btn:disabled { opacity: .5; cursor: not-allowed; }
.pc-btn:focus-visible, .pc-header button:focus-visible, .pc-mobile-nav a:focus-visible, .pc-rail a:focus-visible {
    outline: 2px solid var(--pc-accent); outline-offset: 2px;
}

.pc-field { display: flex; flex-direction: column; gap: 5px; }
.pc-field label { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--pc-ink-faint); }
.pc-field input {
    border: 1px solid var(--pc-line); border-radius: 7px; padding: 8px 10px; font: inherit; font-size: 13.5px;
    background: var(--pc-panel); color: var(--pc-ink);
}
.pc-field input:focus { outline: none; border-color: var(--pc-accent); box-shadow: 0 0 0 3px var(--pc-focus); }
.pc-filter {
    width: 100%; max-width: 320px; border: 1px solid var(--pc-line); border-radius: 7px;
    padding: 8px 11px; font: inherit; font-size: 13px; background: var(--pc-panel); color: var(--pc-ink);
}
.pc-filter:focus { outline: none; border-color: var(--pc-accent); box-shadow: 0 0 0 3px var(--pc-focus); }
.pc-callout { border-radius: 8px; padding: 11px 13px; font-size: 12.5px; margin-top: 12px; }
.pc-callout.ok { background: var(--pc-ok-wash); color: var(--pc-ok); }
.pc-callout.warn { background: var(--warn-wash); color: var(--pc-warn); }
.pc-callout.danger { background: var(--pc-danger-wash); color: var(--pc-danger); }
.pc-empty { padding: 34px 20px; text-align: center; color: var(--pc-ink-soft); }
.pc-empty strong { display: block; margin-bottom: 4px; color: var(--pc-ink); font-size: 14px; }
.pc-loading { min-height: 180px; display: grid; place-items: center; color: var(--pc-ink-soft); font-size: 13px; }
.pc-quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 20px; }
.pc-quick-action {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px;
    border: 1px solid var(--pc-line); border-radius: 9px; background: var(--pc-panel); color: var(--pc-ink);
    text-decoration: none; font-size: 13px; font-weight: 700;
}
.pc-quick-action span { color: var(--pc-ink-faint); font-weight: 600; }
.pc-quick-action:hover { border-color: var(--pc-border-hover); background: var(--pc-th); }
.pc-subnav {
    position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto;
    margin: -10px 0 18px; padding: 8px; border: 1px solid var(--pc-line); border-radius: 10px;
    background: var(--pc-subnav-bg); box-shadow: 0 2px 8px rgba(15,23,42,.05); scrollbar-width: thin;
}
.pc-subnav a { padding: 7px 10px; border-radius: 7px; color: var(--pc-ink-soft); text-decoration: none; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pc-subnav a:hover { color: var(--pc-ink); background: var(--pc-surface-sunk); }
/* Highlight the section being read. Progressive enhancement (scroll markers, current Chrome): where it isn't
   supported the two rules below are simply ignored and the menu stays a plain list of anchors. */
.pc-subnav { scroll-target-group: auto; }
.pc-subnav a:target-current { color: var(--pc-accent-ink); background: var(--pc-surface-sunk); }
.pc-form-grid { display: grid; grid-template-columns: repeat(2,minmax(200px,1fr)); gap: 12px; max-width: 720px; }
.pc-form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
/* Action button/link row without a built-in margin — the flex/gap/align part of the old
   inline "display:flex;gap:…;flex-wrap:wrap;align-items:…" (OC-17). */
.pc-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.pc-actions.center { align-items: center; }
.pc-actions.start { align-items: flex-start; }
.pc-actions.gap8 { gap: 8px; }
.pc-inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
/* A list of radio or checkbox choices, each a label with its control on the left (Card payments: the provider, Go live).
   A choice that cannot be picked yet (a bank not built) is dimmed and says so with the cursor. */
.pc-choice-list { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.pc-choice { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; font-weight: 500; color: var(--pc-ink); cursor: pointer; }
.pc-choice.is-unavailable { cursor: not-allowed; opacity: .6; }
/* Reset two-factor (Operations → Sign-in security): the email takes one share, the reason two. */
.pc-reset-email { flex: 1 1 220px; min-width: min(200px, 100%); }
.pc-reset-reason { flex: 2 1 280px; min-width: min(220px, 100%); }
.pc-section-anchor { scroll-margin-top: 64px; }
.pc-plan-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 12px; margin-top: 12px; }
.pc-payment-review { padding: 14px 0; border-bottom: 1px solid var(--pc-line-soft); }
.pc-payment-review:last-child { border-bottom: 0; }
.pc-payment-summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pc-review-note { max-width: 380px; flex: 1 1 260px; }

@media (max-width: 900px) {
    .pc-rail { display: none; }
    .pc-header { height: 56px; padding-inline: 16px; }
    .pc-header-section { display: none; }
    .pc-mobile-nav {
        display: flex; flex: 0 0 auto; gap: 4px; overflow-x: auto; padding: 8px 12px;
        border-bottom: 1px solid var(--pc-line); background: var(--pc-panel); scrollbar-width: thin;
    }
    .pc-mobile-nav a { padding: 7px 10px; border-radius: 7px; color: var(--pc-ink-soft); text-decoration: none; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
    .pc-mobile-nav a.active { color: var(--pc-ink); background: var(--pc-active-wash); }
    .pc-content { padding: 22px 18px 40px; }
    .pc-kpis { grid-template-columns: repeat(2, 1fr); }
    .pc-quick-actions { grid-template-columns: 1fr; }
    .pc-table .tr { min-width: 640px; }
    .pc-page-head-row { align-items: stretch; }
}

@media (max-width: 640px) {
    .pc-header .pc-user { display: none; }
    .pc-content { padding-inline: 14px; }
    .pc-page-head-row { flex-direction: column; gap: 12px; }
    .pc-page-actions { width: 100%; }
    .pc-kpis { grid-template-columns: 1fr; }
    .pc-kpi { padding: 13px 14px; }
    .pc-form-grid { grid-template-columns: 1fr; }
    .pc-panel-head, .pc-panel-body { padding-inline: 14px; }
    /* Dense tables collapse to a stacked card/list at phone width instead of horizontal
       scrolling (OC-17). The header row is hidden; each cell becomes a block. */
    .pc-table .tr { display: block; min-width: 0; }
    .pc-table .tr.th { display: none; }
    .pc-table .tr > span { display: block; margin: 3px 0; }
}

.app-tabs {
    display: flex; gap: 22px;
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    background: var(--surface);
}

/* Support-access session / request ribbon — sits under the topbar, full width. */
.support-ribbon {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 8px 24px; font-size: 12.5px;
    background: var(--ribbon-bg); color: var(--ribbon-ink);
    border-bottom: 1px solid var(--ribbon-line);
}
.support-ribbon.pending { background: var(--ribbon-warn); }
.support-ribbon.info { background: var(--ribbon-info); }
.support-ribbon-tag {
    font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    background: var(--ribbon-tag); border-radius: 4px; padding: 2px 7px;
}
.support-ribbon a { color: var(--ribbon-ink); font-weight: 700; text-decoration: underline; margin-left: auto; }

/* "Finish setting up" nudge — slim strip under the topbar until onboarding completes.
   Segmented meter (one tick per step) keeps it distinct from a generic progress bar. */
.setup-nudge {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 24px; font-size: 12.5px;
    background: var(--warn-wash); color: var(--ink);
    border-bottom: 1px solid var(--warn-line);
}
.setup-nudge-meter { display: inline-flex; gap: 3px; }
.setup-nudge-meter span {
    width: 16px; height: 5px; border-radius: 2px;
    background: var(--warn-line);
}
.setup-nudge-meter span.on { background: var(--brand-red); }
.setup-nudge-copy { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.setup-nudge-copy strong { font-weight: 700; }
.setup-nudge-count { color: var(--warn-ink); font-size: 11.5px; }
.setup-nudge-go {
    margin-left: auto; font-weight: 700; color: var(--brand-red);
    text-decoration: none; white-space: nowrap;
}
.setup-nudge-go:hover { text-decoration: underline; }
.setup-nudge-dismiss {
    border: 0; background: transparent; cursor: pointer;
    color: var(--warn-ink); font-size: 12px; line-height: 1; padding: 4px;
}
.setup-nudge-dismiss:hover { color: var(--ink); }
@media (max-width: 640px) {
    .setup-nudge { padding-inline: 14px; }
    .setup-nudge-count { display: none; }
}

/* /onboarding checklist page */
.setup-progress {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 14px 16px; margin-bottom: 16px;
}
.setup-progress .btn { margin-left: auto; }
.setup-done {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 18px 18px;
}
.setup-done .btn { margin-left: auto; }
.setup-done-tick {
    display: grid; place-items: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--ok-wash); color: var(--ok-ink); font-weight: 800;
}
.setup-checklist { list-style: none; margin: 0; padding: 0; counter-reset: setup; }
.setup-checklist li {
    counter-increment: setup;
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line-soft);
}
.setup-checklist li:last-child { border-bottom: 0; }
.setup-checklist-dot {
    flex: none; display: grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid var(--line-strong); background: var(--surface);
    font-size: 12px; font-weight: 800; color: var(--ink-faint);
}
.setup-checklist-dot::before { content: counter(setup); }
.setup-checklist li.is-done .setup-checklist-dot {
    border-color: var(--ok); background: var(--ok); color: var(--on-fill);
}
.setup-checklist li.is-done .setup-checklist-dot::before { content: ""; }
.setup-checklist li.is-next .setup-checklist-dot {
    border-color: var(--brand-red); color: var(--brand-red);
}
.setup-checklist-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.setup-checklist-title { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.setup-checklist li.is-done .setup-checklist-title { color: var(--ink-soft); }
.setup-checklist-optional {
    font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--ink-faint); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px;
}
.setup-checklist-blurb { font-size: 12.5px; }
.setup-checklist li > .btn { flex: none; margin-top: 2px; }
.app-tabs a {
    padding: 11px 2px;
    font-size: 13px; font-weight: 600;
    color: var(--ink-faint);
    border-bottom: 2px solid transparent;
}
.app-tabs a:hover { color: var(--ink); }
.app-tabs a.active { color: var(--ink); border-bottom-color: var(--brand-red); }

.app-content { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px; }
/* The page's <main>: focused (tabindex -1) by the skip link, which is not a reason to draw a ring round the page. */
.app-content:focus { outline: none; }
/* "Skip to main content" (UI-22): off screen until a keyboard focuses it, then a button in the top-left corner. */
.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 1000;
    padding: 8px 14px; border-radius: 8px; background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; }
/* The opening balances wizard's page (WizardLayout): the full window, the wizard scrolling inside it. */
.wizard-layout-main { height: 100vh; overflow: hidden; }

/* Standard module-landing header (see ModuleLanding.razor — title is in the topbar). */
.module-landing { margin-bottom: 18px; }
.module-landing-desc { margin: 0 0 12px; color: var(--ink-faint); font-size: 12.5px; max-width: 72ch; }
.module-landing-desc:last-child { margin-bottom: 0; }
.module-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Subscription gate panel (ModuleGate.razor) shown when a module is not in the plan. */
.module-gate { max-width: 460px; margin: 40px auto; padding: 32px 28px; text-align: center; }
.module-gate-icon { color: var(--ink-soft); margin-bottom: 10px; }
.module-gate-icon svg { width: 28px; height: 28px; }
.module-gate h1, .module-gate h2 { font-size: 17px; margin-bottom: 8px; }
.module-gate p { color: var(--ink-faint); font-size: 12.5px; margin: 0 0 18px; }

/* Dashboard overview */
.dashboard-alert { margin: 0 0 14px; padding: 12px 15px; gap: 11px; border-radius: 10px; color: inherit; }
.dashboard-alert-icon {
    width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--warn-tint); color: var(--warn-ink); flex-shrink: 0;
}
.dashboard-alert-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dashboard-alert-copy span { font-weight: 500; font-size: 12px; }
.dashboard-alert-link { font-size: 12px; font-weight: 700; white-space: nowrap; }
.dashboard-alert-icon svg { width: 14px; height: 14px; }
/* Financial-year context stays first, but its track and secondary facts sit behind the cash position in the hierarchy. */
.dashboard-year { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 12px; font-size: 12px; color: var(--ink-soft); }
.dashboard-year-when { display: flex; align-items: baseline; gap: 8px; }
.dashboard-year-when strong { font-size: 13px; color: var(--ink); }
.dashboard-year-track { display: flex; align-items: center; gap: 8px; }
.dashboard-year-end { font-size: 11px; color: var(--ink-faint); }
.fy-months { display: flex; gap: 2px; }
/* A filled neutral track gives the year a visible length without outlining every month. */
.fy-month { box-sizing: border-box; width: 16px; height: 8px; border-radius: 2px; background: var(--line); }
.fy-month.is-past { background: var(--chart-past); }
.fy-month.is-now { background: linear-gradient(to right, var(--chart-now) var(--f), var(--line) var(--f)); }
.dashboard-year-facts { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.dashboard-year-facts strong { color: var(--ink-soft); font-weight: 600; }
.dashboard-year-facts a { color: var(--ink-faint); font-weight: 600; }
.dashboard-year-facts a:hover { color: var(--brand-red); }
.dashboard-inline-icon { display: inline-flex; vertical-align: -2px; }
.dashboard-inline-icon svg { width: 12px; height: 12px; }

/* Position — one panel. The hero band leads with cash and bank (the one big number on the page) and its
   six-month balance; the three figures under it are the rest of the picture, divided by hairlines. */
.dashboard-position { padding: 0; overflow: hidden; }
.dashboard-hero {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 18px 44px; align-items: end;
    padding: 20px 24px 18px;
}
.dashboard-hero-figure { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
/* Proportional figures at display size — tabular digits would all be as wide as a zero and read loose. */
.dashboard-hero-value { font-size: 48px; font-weight: 650; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.dashboard-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.dashboard-figure { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 16px 24px 15px; border-right: 1px solid var(--line-soft); }
.dashboard-figure:last-child { border-right: 0; }
.dashboard-figure-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--ink-soft); }
.dashboard-figure-value { font-size: 23px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.dashboard-figure-link { font-size: 11px; font-weight: 600; margin-top: auto; padding-top: 4px; }
/* Quiet navigation on the main dashboard. Every "go there" link and card arrow used to be brand red — the same red as the
   overdue alert — so the one thing needing attention competed with about ten links. Links are now neutral (6.7:1 on white)
   and turn red, with an underline so it is not colour alone, only when pointed at; red stays for what needs attention.
   Scoped to .dashboard-home, which the main dashboard and the Payroll landing both wear; the class names are reused
   elsewhere, so it is opt-in per page rather than hung off the class names alone. */
.dashboard-home .dashboard-figure-link,
.dashboard-home .dashboard-due-link,
.dashboard-home .dashboard-year-facts a { color: var(--ink-soft); }
.dashboard-home .dashboard-figure-link:hover,
.dashboard-home .dashboard-due-link:hover,
.dashboard-home .dashboard-year-facts a:hover { color: var(--brand-red); text-decoration: underline; text-underline-offset: 2px; }
/* A record named in a list (an employee, a setting) reads as content, not as an action: ink, red and underlined only on hover. */
.record-link { color: var(--ink); }
.record-link:hover { color: var(--brand-red); text-decoration: underline; text-underline-offset: 2px; }
.dashboard-home .dashboard-module-arrow { color: var(--ink-faint); transition: color .15s ease; }
.dashboard-home .dashboard-module:hover .dashboard-module-arrow,
.dashboard-home .dashboard-module-head:focus-visible .dashboard-module-arrow { color: var(--brand-red); }
.delta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 3px 6px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.delta-icon { display: inline-flex; }
.delta-icon svg { width: 14px; height: 14px; }
.delta.is-up { color: var(--ok-ink); }
.delta.is-down { color: var(--danger-ink); }
.delta-basis { font-weight: 500; color: var(--ink-faint); }

/* Monthly returns — the current-period call-to-action + year accordions. */
.return-current {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px; margin-bottom: 16px; cursor: pointer;
    border-left: 3px solid var(--brand-red); transition: border-color .15s ease, box-shadow .15s ease;
}
.return-current:hover { box-shadow: 0 6px 18px rgba(26,26,26,.06); }
/* Monthly returns: mark months lodged from another system (Manager) as filed outside Easy. */
.return-outside-easy {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-top: 18px;
}
.return-outside-easy-actions { display: flex; gap: 8px; align-items: center; }
.return-outside-easy-actions .field-input { width: auto; min-width: 190px; }
.return-empty-shell { max-width: 620px; }
.return-year { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.return-year > summary { cursor: pointer; font-weight: 650; font-size: 13px; list-style: none; }
.return-year > summary::-webkit-details-marker { display: none; }
.return-year > summary::before { content: '▸ '; color: var(--ink-soft); }
.return-year[open] > summary::before { content: '▾ '; }
.font-numeric { font-variant-numeric: tabular-nums; }

/* Dashboard — quick actions */
.dashboard-quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.dashboard-quick-action {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); font-size: 12px; font-weight: 600;
    transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.dashboard-quick-action span { color: var(--ink-faint); font-weight: 700; display: inline-flex; }
.dashboard-quick-action span svg { width: 15px; height: 15px; }
.dashboard-quick-action:hover { color: var(--brand-red); border-color: var(--brand-red-line); box-shadow: 0 4px 12px rgba(26,26,26,.05); }
.dashboard-quick-action:hover span { color: var(--brand-red); }

/* Dashboard — per-module KPI tiles. One hairline-divided panel like the position figures above it;
   every tile carries its own right/bottom rule and the inner grid is pulled 1px out of the clip, so
   the dividers stay even however the tiles wrap and a short last row leaves no ragged block. */
.dashboard-kpis { margin-top: 16px; padding: 0; overflow: hidden; }
.dashboard-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); margin: 0 -1px -1px 0; }
.dashboard-kpi {
    display: flex; flex-direction: column; gap: 5px; padding: 15px 18px 14px; min-height: 96px; color: inherit;
    border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
a.dashboard-kpi { transition: background-color .15s ease; }
a.dashboard-kpi:hover { color: inherit; background: var(--surface-sunk); }
.dashboard-kpi-label {
    display: flex; align-items: center; gap: 7px; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: .07em; font-weight: 700; color: var(--ink-soft);
}
.dashboard-kpi-label > span { display: inline-flex; color: var(--ink-faint); }
.dashboard-kpi-label svg { width: 14px; height: 14px; }
a.dashboard-kpi:hover .dashboard-kpi-label > span { color: var(--brand-red); }
.dashboard-kpi-value { font-size: 20px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.dashboard-kpi-detail { display: flex; align-items: flex-start; gap: 5px; font-size: 11.5px; color: var(--ink-faint); line-height: 1.35; }
.dashboard-kpi-flag { display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.dashboard-kpi-flag svg { width: 13px; height: 13px; }
.dashboard-kpi.is-attention .dashboard-kpi-detail { color: var(--warn-ink); }
.dashboard-kpi.is-unavailable .dashboard-kpi-value { color: var(--ink-faint); }
/* Static placeholder (no shimmer) while a tile's figure loads — holds the tile's height so nothing jumps. */
.dashboard-kpi-skeleton { display: block; height: 20px; width: 55%; margin-top: 3px; border-radius: 4px; background: var(--line-soft); }
@media (max-width: 520px) {
    .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-kpi { padding: 13px 14px 12px; }
    .dashboard-kpi-value { font-size: 18px; }
}

/* Dashboard — module overview cards (Sales / Purchases / Banking) */
.dashboard-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.dashboard-modules.dashboard-modules--solo { grid-template-columns: minmax(0, 1fr); }
.dashboard-module {
    position: relative; display: flex; flex-direction: column; padding: 17px 18px 15px; color: inherit;
    border-color: var(--line); transition: box-shadow .15s ease, border-color .15s ease;
}
/* The head is the card's one link, stretched over the whole card; the chart sits above it so its
   periods still take hover and focus. */
.dashboard-module-head::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.dashboard-module-head:focus-visible { outline: none; }
.dashboard-module-head:focus-visible::after { outline: 2px solid var(--brand-red); outline-offset: -2px; }
.dashboard-module .spark { position: relative; z-index: 1; margin-bottom: 14px; }
.dashboard-module-caption { display: block; margin: 16px 0 8px; font-size: 11px; color: var(--ink-faint); }
.dashboard-module:hover { color: inherit; border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(26,26,26,.04); }
.dashboard-module-head { display: flex; align-items: center; gap: 8px; }
.dashboard-module-icon { display: inline-flex; color: var(--ink-soft); }
.dashboard-module-icon svg { width: 16px; height: 16px; }
.dashboard-module-head h2 { font-size: 13px; color: var(--ink-soft); }
.dashboard-module-arrow { margin-left: auto; display: inline-flex; color: var(--brand-red); }
.dashboard-module-arrow svg { width: 15px; height: 15px; }
.dashboard-module:hover .dashboard-module-icon { color: var(--brand-red); }
/* Sparkline (Components/Shared/Sparkline.razor). History in a muted grey (3:1 on white), the current
   period in ink, brand red only for the period being pointed at — no red/green, so a bar never
   reads as good or bad. Bars are <= 24px with a 4px rounded top and a square base; lines are 2px. */
.spark { --spark-past: var(--chart-past); --spark-now: var(--chart-now); margin: 0; display: flex; flex-direction: column; gap: 6px; }
.spark-plot { position: relative; height: 72px; display: flex; }
.spark-col { position: relative; flex: 1 1 0; min-width: 24px; padding: 0 1px; display: flex; justify-content: center; align-items: flex-end; outline: none; }
.spark-col:focus-visible { outline: 2px solid var(--brand-red); outline-offset: -1px; border-radius: 4px; }
.spark-bar { display: block; width: 100%; max-width: 24px; height: var(--v); min-height: 2px; background: var(--spark-past); border-radius: 4px 4px 0 0; transition: background-color .12s ease; }
.spark-col.is-current .spark-bar { background: var(--spark-now); }
.spark-col:hover .spark-bar, .spark-col:focus-visible .spark-bar { background: var(--brand-red); }
.spark-baseline { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); }
.spark.is-signed .spark-baseline { bottom: 50%; background: var(--chart-past); }   /* zero matters here: it is what the bars are +/- of */
.spark.is-signed .spark-col { align-items: stretch; }
.spark.is-signed .spark-bar { position: absolute; left: 50%; transform: translateX(-50%); width: calc(100% - 2px); }
.spark.is-signed .spark-bar.pos { bottom: 50%; }
.spark.is-signed .spark-bar.neg { top: 50%; border-radius: 0 0 4px 4px; }
.spark-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.spark-path, .spark-path-now { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-path { stroke: var(--spark-past); }
.spark-path-now { stroke: var(--spark-now); }
.spark-area { fill: var(--spark-now); opacity: .06; }
.spark-line .spark-col { align-items: stretch; }
.spark-line .spark-col::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: 0; }
.spark-line .spark-col:hover::before, .spark-line .spark-col:focus-visible::before { opacity: 1; }
.spark-dot { position: absolute; left: 50%; bottom: var(--v); width: 8px; height: 8px; margin: 0 0 -4px -4px; border-radius: 50%; background: var(--spark-now); box-shadow: 0 0 0 2px var(--surface); opacity: 0; }
.spark-col.is-current .spark-dot { opacity: 1; }
.spark-col:hover .spark-dot, .spark-col:focus-visible .spark-dot { opacity: 1; background: var(--brand-red); }
/* Readout — value first, period second. Opens over the plot; the first and last periods clamp to the plot's edges. */
.spark-tip {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
    display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; white-space: nowrap; pointer-events: none;
    background: var(--surface-raised); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 16px rgba(26,26,26,.10);
    opacity: 0; transition: opacity .1s ease;
}
.spark-tip strong { font-size: 12px; color: var(--ink); }
.spark-tip span { font-size: 11px; color: var(--ink-faint); }
.spark-col:hover .spark-tip, .spark-col:focus-visible .spark-tip { opacity: 1; }
.spark-col:first-child .spark-tip { left: 0; transform: none; }
.spark-col:last-child .spark-tip { left: auto; right: 0; transform: none; }
.spark-axis { display: flex; }
.spark-axis span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--ink-faint); }
@media (prefers-reduced-motion: reduce) {
    .spark-bar, .spark-tip { transition: none; }
}
.dashboard-module-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.dashboard-module-figure { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dashboard-module-figure span { font-size: 11px; }
.dashboard-module-figure strong { font-size: 14px; letter-spacing: -.02em; }
.dashboard-module-figure strong { display: inline-flex; align-items: center; gap: 5px; }
.dashboard-module-figure strong.is-alert { color: var(--danger-ink); }
.dashboard-module-figure strong svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Dashboard — recent activity + due lists */
.dashboard-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.dashboard-lists.dashboard-lists--solo { grid-template-columns: minmax(0, 1fr); }
.dashboard-list { padding: 16px 18px; }
.dashboard-list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.dashboard-list-head h3,
.dashboard-home .dashboard-list-head h2 { font-size: 13px; }
.dashboard-list-head a { font-size: 11.5px; font-weight: 600; }
.dashboard-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dashboard-activity li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.dashboard-activity li:last-child { border-bottom: none; }
.dashboard-activity li a { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; color: inherit; }
.dashboard-activity-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-activity-meta { font-size: 11px; }
.dashboard-activity li a:hover .dashboard-activity-title { color: var(--brand-red); }
.dashboard-activity-amount { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dashboard-due { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dashboard-due li { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.dashboard-due li:last-child { border-bottom: none; }
.dashboard-due-icon {
    width: 22px; height: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--surface-sunk); color: var(--ink-soft);
}
.dashboard-due-icon svg { width: 12px; height: 12px; }
.dashboard-due li.is-alert .dashboard-due-icon { background: var(--danger-wash); color: var(--danger-ink); }
.dashboard-due-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dashboard-due-copy strong { font-size: 12.5px; }
.dashboard-due-copy span { font-size: 11px; }
.dashboard-due-link { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.dashboard-empty { font-size: 12.5px; }

/* Bank & Cash account overview */
.bank-account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; align-items: stretch; }
.bank-account-card {
    display: flex; flex-direction: column; min-height: 248px; padding: 18px 19px 16px;
    border-color: var(--line); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.bank-account-card:hover { transform: translateY(-2px); border-color: var(--brand-red-line); box-shadow: 0 8px 22px rgba(26,26,26,.06); }
.bank-account-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 43px; }
.bank-account-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.bank-account-type-icon {
    width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    border-radius: 10px; background: var(--brand-red-wash); color: var(--brand-red); font-size: 15px; font-weight: 800;
}
.bank-account-name-wrap { min-width: 0; }
.bank-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 750; }
.bank-account-meta { margin-top: 3px; color: var(--ink-faint); font-size: 11.5px; }
.bank-account-meta span { color: var(--line-strong); padding: 0 2px; }
.bank-status { flex-shrink: 0; white-space: nowrap; }
.bank-account-stats { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; margin-top: 22px; padding: 13px 0 12px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.bank-account-stat { min-width: 0; }
.bank-account-stat + .bank-account-stat { padding-left: 16px; border-left: 1px solid var(--line-soft); }
.bank-account-stat .kpi-label { min-height: 27px; line-height: 1.25; }
.bank-account-value { margin-top: 5px; color: var(--ink); font-size: 20px; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-account-note { min-height: 37px; padding-top: 11px; color: var(--ink-faint); font-size: 11.5px; line-height: 1.45; }
.bank-account-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; }
.bank-account-actions .btn { min-height: 31px; }
.bank-account-actions .btn-primary { box-shadow: 0 3px 9px rgba(206,21,44,.13); }

/* Start reconciliation — a balanced setup surface consistent with Banking cards. */
.recon-start-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, .85fr);
    gap: 16px;
    align-items: start;
}
.recon-start-card { overflow: hidden; }
.recon-start-heading { padding: 20px 22px 17px; border-bottom: 1px solid var(--line-soft); }
.recon-start-heading .page-kicker, .recon-start-guide .page-kicker { color: var(--brand-red); }
.recon-start-heading h2, .recon-start-guide h2, .recon-history-heading h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
}
.recon-start-heading p, .recon-start-guide p, .recon-history-heading p {
    margin: 5px 0 0;
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.5;
}
.recon-start-periods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.recon-start-period { min-width: 0; padding: 20px 22px 22px; }
.recon-start-period + .recon-start-period { border-left: 1px solid var(--line-soft); }
.recon-start-period-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 48px; }
.recon-start-period-heading h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.recon-start-period-heading p { margin: 3px 0 0; color: var(--ink-faint); font-size: 11.5px; }
.recon-start-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.recon-start-fields input { width: 100%; }
.recon-start-fields input[readonly] { color: var(--ink-soft); background: var(--surface-sunk); cursor: not-allowed; }
/* Currency inputs: a fixed "$" prefix over a right-aligned, tabular-numeral text field. */
.money-input { position: relative; }
.money-input .money-input-symbol {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--ink-soft); font-size: 13px; pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.money-input input { padding-left: 26px; text-align: right; font-variant-numeric: tabular-nums; }
/* A three-letter currency code in the prefix ("USD") needs more room than a "$". */
.money-input.money-input-code input { padding-left: 46px; }
/* Currency and exchange rate on a document editor (multi-currency). */
.fx-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.fx-field { max-width: 340px; }
.fx-rate { display: flex; align-items: center; gap: 8px; }
.fx-rate > span { white-space: nowrap; }
.fx-rate input { width: 130px; min-width: 0; }
.fx-note { margin-top: 8px; }
.fx-confirm { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-weight: 600; }
.doc-totals.fx-equivalent { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-soft); }
.doc-totals.fx-equivalent .grand { border-top-width: 1px; }
@media (max-width: 640px) { .fx-field { max-width: none; } .fx-rate input { flex: 1; width: auto; } }
.recon-start-source { margin-top: 10px; color: var(--ink-faint); font-size: 11.5px; line-height: 1.45; }
.recon-start-message { margin: 0 22px 18px; }
.recon-start-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface-sunk);
}
.recon-start-guide { display: grid; gap: 20px; padding: 20px; }
.recon-start-facts { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recon-start-facts > div { padding: 13px 14px; }
.recon-start-facts > div + div { border-top: 1px solid var(--line-soft); }
.recon-start-facts dt { color: var(--ink-soft); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.recon-start-facts dd { margin: 4px 0 0; color: var(--ink); font-size: 15px; font-weight: 700; text-align: left; }
.recon-start-facts dd.recon-start-asat { margin-top: 2px; color: var(--ink-faint); font-size: 11px; font-weight: 400; }
.recon-start-checklist { display: grid; gap: 12px; margin: 0; padding: 16px 0 0 24px; border-top: 1px solid var(--line-soft); color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }
.recon-start-checklist li { padding-left: 3px; }
.recon-start-checklist li::marker { color: var(--brand-red); font-weight: 750; }
.recon-history { margin-top: 16px; overflow: hidden; }
.recon-history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }

/* Active reconciliation workspace — balances, work tabs, and line-clearing tools. */
.recon-workspace-summary { margin-bottom: 16px; overflow: hidden; }
.recon-workspace-summary-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.recon-workspace-summary-head .page-kicker { color: var(--brand-red); }
.recon-workspace-summary-head h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.recon-balance-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; }
.recon-balance-grid > div { min-width: 0; padding: 15px 16px; border-right: 1px solid var(--line-soft); }
.recon-balance-grid > div:last-child { border-right: 0; }
.recon-balance-grid dt { color: var(--ink-faint); font-size: 10.5px; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.recon-balance-grid dd { margin: 5px 0 0; color: var(--ink); font-size: 15px; font-weight: 750; text-align: left; white-space: nowrap; }
.recon-balance-grid dd.positive { color: var(--ok-ink); }
.recon-balance-difference { background: var(--danger-wash); }
.recon-balance-difference dd { color: var(--brand-red); }
.recon-balance-difference.is-balanced { background: var(--ok-wash); }
.recon-balance-difference.is-balanced dd { color: var(--ok-ink); }
.recon-progress-row {
    display: flex; align-items: center; gap: 24px; padding: 16px 20px;
    border-top: 1px solid var(--line); background: var(--surface-sunk);
}
.recon-progress-copy { flex: 1; min-width: 0; }
.recon-progress-title { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 12px; }
.recon-progress-title span { font-weight: 700; }
.recon-progress-title strong { color: var(--ink-soft); font-weight: 600; }
.recon-progress-track { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--line); }
.recon-progress-value { height: 100%; border-radius: inherit; background: var(--brand-red); transition: width .2s ease; }
.recon-progress-value.is-balanced { background: var(--ok); }
.recon-progress-meta { margin-top: 7px; color: var(--ink-faint); font-size: 11px; line-height: 1.45; }
.recon-workspace-actions { display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0; }
.recon-workspace-actions > div { display: grid; justify-items: end; gap: 5px; }
.recon-workspace-actions span { color: var(--ink-faint); font-size: 10.5px; }
.recon-completed-callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recon-workspace { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.recon-workspace:has(.search-select.open) { overflow: visible; }
.recon-workspace-tabs { display: flex; gap: 0; overflow-x: auto; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.recon-workspace-tab {
    padding: 13px 14px 11px; border: 0; border-bottom: 2px solid transparent;
    background: transparent; color: var(--ink-soft); font: inherit; font-size: 12.5px; font-weight: 600;
    white-space: nowrap; cursor: pointer;
}
.recon-workspace-tab:hover { color: var(--ink); background: var(--surface-sunk); }
.recon-workspace-tab.active { border-bottom-color: var(--brand-red); color: var(--brand-red); font-weight: 750; }
.recon-workspace-message { margin: 16px 18px 0; }
.recon-workspace-body { padding: 18px; background: var(--surface-sunk); }
.recon-panel-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.recon-panel-toolbar h3 { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.35; }
.recon-panel-toolbar p { max-width: 680px; margin: 4px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.5; }
.recon-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.recon-table-card { overflow-x: auto; }
.recon-inline-editor { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-sunk); }
.recon-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.recon-empty-state { padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: center; }
.recon-empty-state p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.recon-panel-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.recon-match-bar {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 14px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: 0 4px 12px rgba(26,26,26,.05);
}
.recon-match-net { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--ink-soft); font-size: 12px; }
.recon-match-net strong { color: var(--ink); font-size: 16px; }
.recon-match-net strong.has-difference { color: var(--brand-red); }
.recon-match-net strong.is-balanced { color: var(--ok-ink); }
.recon-match-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.recon-match-column-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--ink); font-size: 12.5px; font-weight: 700; }
.recon-match-column-title span { color: var(--ink-faint); font-size: 11.5px; font-weight: 600; }
.recon-match-list { max-height: 62vh; overflow: auto; padding: 0; }
.recon-match-selected { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--ink-soft); font-size: 12px; }
.recon-match-selected strong { color: var(--ink); }

@media (max-width: 900px) {
    .dashboard-hero { grid-template-columns: minmax(0, 1fr); }
    .dashboard-hero-trend { max-width: 420px; }
    .dashboard-year-facts { margin-left: 0; width: 100%; }
    .fy-month { width: 12px; }
    .dashboard-modules { grid-template-columns: 1fr; }
    .dashboard-lists { grid-template-columns: 1fr; }
    .recon-start-layout { grid-template-columns: 1fr; }
    .recon-balance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recon-balance-grid > div:nth-child(3n) { border-right: 0; }
    .recon-balance-grid > div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
    .recon-match-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .app-topbar-title { display: none; }
    .business-switcher-badge { display: none; }
}
@media (max-width: 620px) {
    .app-content { padding: 16px; }
    .app-topbar { padding: 0 12px; gap: 8px; }
    /* The company switcher gives way first: it can shrink (its name ellipsises) so the Sent / Waiting-for-you /
       support icons and the account menu stay on screen. A long company name used to push them past the edge. */
    .business-menu { flex: 0 1 235px; min-width: 0; }
    .business-switcher { min-width: 0; max-width: none; width: 100%; }
    .app-topbar-divider { display: none; }
    .dashboard-figures, .bank-account-grid { grid-template-columns: 1fr; }
    .dashboard-figure { border-right: 0; border-bottom: 1px solid var(--line-soft); }
    .dashboard-figure:last-child { border-bottom: 0; }
    .dashboard-hero { padding: 18px 16px 16px; }
    .dashboard-hero-value { font-size: clamp(36px, 11vw, 48px); }
    .dashboard-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-quick-action { justify-content: flex-start; white-space: nowrap; min-width: 0; }
    .dashboard-alert { align-items: flex-start; flex-wrap: wrap; }
    .dashboard-alert-link { margin-left: 35px; }
    .bank-account-grid { gap: 12px; }
    .recon-start-periods, .recon-start-fields { grid-template-columns: 1fr; }
    .recon-start-period + .recon-start-period { border-left: 0; border-top: 1px solid var(--line-soft); }
    .recon-start-actions { justify-content: stretch; }
    .recon-start-actions .btn { flex: 1; }
    .recon-balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .recon-balance-grid > div { border-right: 1px solid var(--line-soft); }
    .recon-balance-grid > div:nth-child(even) { border-right: 0; }
    .recon-balance-grid > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
    .recon-progress-row, .recon-panel-toolbar { align-items: stretch; flex-direction: column; }
    .recon-workspace-actions { justify-content: space-between; }
    .recon-workspace-actions > div { flex: 1; justify-items: stretch; }
    .recon-workspace-actions .btn { flex: 1; }
    .recon-workspace-tabs { padding: 0 8px; }
    .recon-workspace-body { padding: 14px; }
    .recon-match-bar { align-items: stretch; flex-direction: column; }
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 14px;
    min-height: var(--control-height);
    border-radius: var(--radius-sm);
    font-size: var(--type-body); font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary, .btn-primary:visited { background: var(--brand-fill); color: var(--on-fill); }
.btn-primary:hover:not(:disabled), .btn-primary:focus-visible { background: var(--brand-fill-hover); color: var(--on-fill); }
.btn-ok, .btn-ok:visited { background: var(--ok); color: var(--on-fill); border-color: var(--ok); }
.btn-ok:hover:not(:disabled), .btn-ok:focus-visible { background: var(--ok-hover); border-color: var(--ok-hover); color: var(--on-fill); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunk); }
.btn-link { background: transparent; color: var(--ink-faint); border-color: transparent; font-weight: 600; padding: 0 8px; min-height: var(--control-height-sm); }
.btn-link:hover:not(:disabled) { color: var(--ink); text-decoration: underline; }
.btn-sm { padding: 0 11px; font-size: var(--type-body); min-height: var(--control-height-sm); }
/* Compact by default where rows are dense (table cells, row action menus). */
table .btn, .grid-table .btn, .table-actions .btn, .row-actions .btn { min-height: var(--control-height-sm); }

/* ── Cards, tables ─────────────────────────────────────────────────────────── */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.page-head h1 { font-size: var(--type-page-title); line-height: 1.2; letter-spacing: -.025em; }   /* the UX plan's 24px page title, everywhere */
.page-head .sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
/* Cards stacked directly on the page keep a steady 16px between them, whether or not each one
   remembered its own margin-bottom (block margins collapse, so existing gaps don't double). */
.app-content > .card ~ .card { margin-top: 16px; }   /* ~ not +: a component may render an empty wrapper between two cards */
.card:has(.search-select.open),
.card:has(.multi-select.open),
.card:has(details.row-actions[open]) {
    position: relative;
    z-index: 5;
    overflow: visible;
}

.grid-table { width: 100%; }
.grid-table .row {
    display: grid;
    align-items: center;
    column-gap: 10px;
    padding: 9px 14px;
    font-size: var(--type-body);
    border-top: 1px solid var(--line-soft);
}
.grid-table .row > input,
.grid-table .row > select,
.grid-table .row > textarea,
.grid-table .row > div { min-width: 0; }
.grid-table .row.head {
    border-top: none;
    border-bottom: 1px solid var(--line);
    font-size: 11px; font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase; letter-spacing: .03em;
}
.grid-table .row.group {
    background: var(--surface-sunk);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    color: var(--ink); letter-spacing: .02em;
    border-top: 1px solid var(--line);
}
.grid-table .row.total {
    background: var(--surface-sunk);
    font-weight: 700;
    border-top: 1.5px solid var(--line-strong);
}
.grid-table .row.clickable { cursor: pointer; }
.grid-table .row.clickable:hover { background: var(--brand-red-wash); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Leave-balances matrix (employees down, leave types across). A bounded first column keeps
   the header readable while the numeric columns share the remaining width. */
.leave-matrix .leave-matrix-employee { position: sticky; left: 0; background: var(--surface); min-width: 160px; vertical-align: top; padding-top: 13px; }
.leave-matrix td.num { padding: 8px 10px; }
.leave-matrix-cell {
    display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px;
    background: none; border: none; padding: 4px 6px; cursor: pointer; border-radius: 6px; font: inherit;
}
.leave-matrix-cell:hover { background: var(--brand-red-wash); }
.leave-matrix-balance { font-weight: 700; font-variant-numeric: tabular-nums; }
.leave-matrix-balance.warn { color: var(--warn-ink); }
.leave-matrix-sub { font-size: 11px; line-height: 1.25; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.dash { color: var(--ink-ghost); }

/* Accessible data-register foundation, piloted on Invoices. */
/* position: relative so an absolutely positioned child (the .visually-hidden column labels) is clipped by the scroller, not
   left sticking out past it and widening the whole page. */
.table-scroll { width: 100%; overflow-x: auto; position: relative; }
.table-scroll:focus-visible { outline: 3px solid var(--brand-red-wash); outline-offset: 2px; }
.data-table { width: 100%; border-collapse: collapse; color: var(--ink); font-size: var(--type-table); line-height: var(--leading-data); }
.data-table th,
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.data-table th {
    color: var(--ink-soft); font-size: var(--type-table-head); font-weight: 700;
    letter-spacing: .02em; text-transform: uppercase; background: var(--surface);
    border-bottom-color: var(--line); white-space: nowrap;
}
.data-table th.num,
.data-table td.num { text-align: right; white-space: nowrap; }
/* A header cell holds its own visually-hidden label (an "Actions" column): positioned, so the label stays inside the
   table's scroller instead of escaping a wrapper that is not .table-scroll and widening the page on a phone. */
.data-table th { position: relative; }
/* A row header in the body or footer (a day, a "Totals" label) reads as data, not as a column heading. */
.data-table tbody th,
.data-table tfoot th {
    color: var(--ink); font-size: inherit; font-weight: 600; letter-spacing: 0; text-transform: none;
    white-space: normal; background: transparent;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--brand-red-wash); }
.data-table a { font-weight: 600; }
.data-table .document-ref { white-space: nowrap; }
/* A <td> must stay a table-cell: display:flex on it dropped the cell out of the row's vertical
   alignment (buttons stuck to the top) and let section bands stop short of the last column. */
.data-table .table-actions { white-space: nowrap; }
.data-table td.table-actions { text-align: right; }
.data-table td.table-actions > * { vertical-align: middle; }
.data-table td.table-actions > *:not(.btn) { display: inline-block; }
.data-table td.table-actions > * + * { margin-left: 6px; }
.data-table .empty-cell { padding: 24px; color: var(--ink-soft); text-align: center; }

/* The row kinds the older .grid-table registers had, for the tables moved off it (UI-20). A band (a report section, a
   group of accounts), a total line, a dimmed row (reversed, rejected), and the denser spacing a report or a detail page's
   line list keeps. Bands colour their cells, not the row, so a row hover does not wash out a section heading. */
.data-table.compact th,
.data-table.compact td { padding: 9px 14px; }
.data-table.compact td,
.data-table.compact tbody th,
.data-table.compact tfoot th { font-size: 12.5px; }
.data-table tr.group > td,
.data-table tr.group > th {
    background: var(--surface-sunk); color: var(--ink);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
    border-top: 1px solid var(--line);
}
.data-table tr.total > td,
.data-table tr.total > th {
    background: var(--surface-sunk); color: var(--ink); font-weight: 700;
    border-top: 1.5px solid var(--line-strong); border-bottom: 0;
}
.data-table tr.total > th { text-transform: none; letter-spacing: 0; }
.data-table tr.cancelled { opacity: .6; }
.data-table tr.rejected { opacity: .7; }
/* A cell that holds a form control: the control fills it and the cell gives up some of its padding. */
.data-table td.cell-input { padding-top: 6px; padding-bottom: 6px; }
.data-table td.cell-input > .field-input,
.data-table td.cell-input > input,
.data-table td.cell-input > select { width: 100%; min-width: 0; }

/* ── Row selection + per-row overflow menu (list screens) ──────────────────── */
.select-col { text-align: center; }
.data-table .select-col { width: 40px; padding-left: 14px; padding-right: 0; }
.grid-table .select-col { display: flex; align-items: center; justify-content: center; }
.select-col input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; margin: 0; }
.data-table tr.is-selected,
.grid-table .row.is-selected { background: var(--brand-red-wash); }
/* Show the ⋯ trigger on row hover / focus / when its menu is open; always on touch. */
.row-actions .row-actions-trigger { opacity: 0; transition: opacity .12s; }
.data-table tr:hover .row-actions-trigger,
.data-table tr:focus-within .row-actions-trigger,
.grid-table .row:hover .row-actions-trigger,
.grid-table .row:focus-within .row-actions-trigger,
.row-actions[open] .row-actions-trigger { opacity: 1; }
@media (hover: none) { .row-actions .row-actions-trigger { opacity: 1; } }
.grid-table .row .table-actions { display: flex; justify-content: flex-end; }

.row-actions { position: relative; display: inline-flex; }
.row-actions > summary { list-style: none; cursor: pointer; }
.row-actions > summary::-webkit-details-marker { display: none; }
.row-actions-trigger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px; font-size: 16px; line-height: 1;
    color: var(--ink-soft); border: 1px solid transparent;
}
.row-actions-trigger:hover, .row-actions[open] .row-actions-trigger {
    background: var(--surface-sunk); border-color: var(--line); color: var(--ink);
}
.row-actions-panel {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
    min-width: 176px; padding: 4px; background: var(--surface-raised); border: 1px solid var(--line);
    border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.14); display: grid; gap: 1px;
}
.row-actions.up .row-actions-panel { top: auto; bottom: calc(100% + 4px); }
.row-actions-panel a, .row-actions-panel button {
    display: block; box-sizing: border-box; width: 100%; text-align: left;
    padding: 8px 10px; border: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: var(--type-body); text-decoration: none; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.row-actions-panel a:hover, .row-actions-panel button:hover:not(:disabled) { background: var(--surface-sunk); }
.row-actions-panel button:disabled { opacity: .4; cursor: default; }
.row-actions-panel .danger { color: var(--brand-red); }
.row-actions-panel hr { border: 0; border-top: 1px solid var(--line-soft); margin: 3px 0; }

/* Bulk-action bar: sits in the top-right of the list's controls row (the empty space
   beside the quick-view tabs / filters), so selecting rows never reflows the table.
   Light raised surface with a brand accent — a deliberate product control. */
.list-controls { position: relative; }
.list-selection-bar {
    position: absolute; top: 0; right: 0; z-index: 4;
    display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
    max-width: calc(100% - 2px);
    padding: 7px 10px 7px 14px; border-radius: 9px;
    background: var(--surface-raised); color: var(--ink);
    border: 1px solid var(--line); border-left: 3px solid var(--brand-red);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
    animation: list-selection-in 100ms ease-out;
}
/* While a selection is active, hide the toolbar's trailing bits (result count, the
   More/Clear-filters buttons) it sits on top of — the search box and filters stay usable. */
.list-controls:has(> .list-selection-bar) .list-toolbar-count,
.list-controls:has(> .list-selection-bar) .list-toolbar-row > .btn { visibility: hidden; }
@keyframes list-selection-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.list-selection-count { font-weight: 700; font-size: 13px; white-space: nowrap; }
.list-selection-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-selection-actions .btn:disabled { opacity: .45; }
.list-selection-clear {
    margin-left: 2px; border: 0; background: transparent; color: var(--ink-soft);
    font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; white-space: nowrap;
}
.list-selection-clear:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
    .list-selection-bar { animation: none; }
}
/* Narrow: the controls row wraps and there's no spare width — drop the bar into flow. */
@media (max-width: 760px) {
    .list-selection-bar {
        position: static; max-width: none; margin-bottom: 12px; animation: none;
    }
}

.bulk-email-list { border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow-y: auto; }
.bulk-email-row {
    display: grid; grid-template-columns: 120px 1fr 1.2fr; gap: 10px; align-items: baseline;
    padding: 8px 12px; font-size: 12.5px; border-top: 1px solid var(--line-soft);
}
.bulk-email-row:first-child { border-top: 0; }
.bulk-email-row .bulk-email-doc { font-weight: 600; font-variant-numeric: tabular-nums; }
.bulk-email-row .bulk-email-addr { color: var(--ink-soft); overflow-wrap: anywhere; }
.bulk-email-row.is-skip { opacity: .55; }
.bulk-email-row.is-skip .bulk-email-addr { color: var(--brand-red); }
.invoice-table { min-width: 1040px; }
.invoice-table .actions-col { min-width: 56px; }
.bill-table { min-width: 1080px; }
.bill-table .actions-col { width: 82px; }
.invoice-page-head { align-items: center; margin-bottom: 20px; }
.invoice-page-head h1 { font-size: var(--type-page-title); line-height: 1.2; letter-spacing: -.025em; }
.invoice-heading-copy { min-width: 0; }
.page-kicker { display: inline-block; margin-bottom: 5px; font-size: 12px; font-weight: 650; }
.invoice-heading-meta { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; margin-top: 7px; color: var(--ink-soft); font-size: var(--type-helper); line-height: 1.45; }
.invoice-heading-meta > span:not(:first-child) { position: relative; }
.invoice-heading-meta > span:not(:first-child)::before { position: absolute; left: -10px; color: var(--line-strong); content: "•"; }
.invoice-party { color: var(--ink); font-weight: 600; }
.invoice-alert { margin: 0 0 16px; padding-block: 12px; line-height: 1.45; }
.invoice-summary-card, .record-summary-card { padding: 0; margin-bottom: 16px; overflow: hidden; }
.payment-run-summary-card { margin-bottom: 0; }
.invoice-summary-grid, .record-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin: 0; }
.invoice-summary-item, .record-summary-item { min-width: 0; padding: 16px 20px; border-right: 1px solid var(--line-soft); }
.invoice-summary-item:last-child, .record-summary-item:last-child { border-right: 0; }
.invoice-summary-item dt, .record-summary-item dt { margin: 0 0 5px; color: var(--ink-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; line-height: 1.3; text-transform: uppercase; }
.invoice-summary-item dd, .record-summary-item dd { min-height: 22px; margin: 0; color: var(--ink); font-size: 15px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.invoice-summary-item dd.num, .record-summary-item dd.num { text-align: left; }
.invoice-summary-emphasis dd, .record-summary-emphasis dd { font-size: 17px; }
.invoice-summary-notes, .record-summary-notes { white-space: pre-line; padding: 12px 20px; border-top: 1px solid var(--line-soft); color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.invoice-audit-meta, .record-audit-meta { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; font-weight: 600; letter-spacing: .01em; line-height: 1.5; }
.invoice-section-title { font-size: var(--type-section-title); }
.field-error { color: var(--danger-ink); font-size: var(--type-helper); line-height: 1.35; }
/* A note under one field, explaining what to put in it. Sits inside .field, so the 6px gap spaces it from the input;
   capped so a long sentence wraps under its own field rather than running the width of the card. */
.field-hint { color: var(--ink-faint); font-size: var(--type-helper); line-height: 1.4; max-width: 46ch; }
/* A value the form shows but does not edit, standing where an input would: matched to the control height so it sits on
   the same line as the inputs beside it instead of riding up under its label. */
.field-readout { display: flex; align-items: center; min-height: var(--control-height); font-weight: 600; }
.quick-views { display: flex; align-items: center; gap: 4px; margin: -2px 0 12px; flex-wrap: wrap; }
.link-button { padding: 0; border: 0; background: none; color: var(--brand-red); font: inherit; font-weight: 650; cursor: pointer; }
.link-button:hover { color: var(--brand-red-hover); text-decoration: underline; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Pills / filters ───────────────────────────────────────────────────────── */

.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pill {
    padding: 5px 11px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    color: var(--ink-soft); cursor: pointer;
    border: none; background: transparent;
}
.pill:hover { color: var(--ink); }
.pill.active { background: var(--inverse-bg); color: var(--inverse-ink); }
.pill.active.accent { background: var(--brand-red-wash); color: var(--brand-red); }

.search-input {
    flex: 1; max-width: 260px;
    height: var(--control-height); padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit; font-size: var(--type-body);
    background: var(--surface);
}

/* Older report and payroll filter rows share the same field geometry while they
   transition to ListToolbar. Pills remain compact because they represent views. */
.filters > select.field-input,
.filters > input.field-input,
.filters > .search-input,
.filters > .btn,
.filters > .field > select.field-input,
.filters > .field > input.field-input { height: var(--control-height); }

/* ── Form fields ───────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label,
.field > label:not([class]):not(:has(input, select, textarea)) {
    font-size: 11.5px; font-weight: 700; color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: .03em;
}
.field-label .req { color: var(--danger-ink); margin-left: 1px; }

/* Control sizing contract. Every single-line control is --control-height tall, set explicitly
   (not padding + font arithmetic, which gave 38 / 39.2 / 41.2px depending on the input type).
   Textareas, checkboxes and radios keep their own sizing. */
.field-input:not(textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]) {
    min-height: var(--control-height); height: var(--control-height);
    padding-top: 0; padding-bottom: 0;
}
/* A small button that shares a row with a field is a form control, not a table action:
   it matches the inputs beside it. */
/* Buttons in a page header are one group — a small action beside the standard Back button shouldn't be shorter. */
.page-head .btn-sm, .head-actions .btn-sm { min-height: var(--control-height); }
.field > .btn-sm, .field ~ .btn-sm, .btn-sm:has(~ .field), .search-input ~ .btn-sm, .btn-sm:has(~ .search-input),
:is(select, input:not([type="checkbox"]):not([type="radio"])) ~ .btn-sm,
.btn-sm:has(~ :is(select, input:not([type="checkbox"]):not([type="radio"]))),
.field-row > .btn-sm, .filters > .btn-sm { min-height: var(--control-height); }
.field input.invalid, .field select.invalid, .field-input.invalid {
    border-color: var(--danger-ink);
    outline: 2px solid var(--danger-wash);
}
.field-input, .field select, .field input, .field textarea {
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font: inherit; font-size: var(--type-body);
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}
.field-input:focus, .field select:focus, .field input:focus, .field textarea:focus {
    outline: 2px solid var(--brand-red-wash);
    border-color: var(--brand-red);
}
/* Wraps: each field wants at least 160px, so a row of five (the payslip register's filters) used to run off the card
   at tablet width instead of dropping to a second line. */
.field-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }
.field textarea { min-height: 86px; resize: vertical; line-height: 1.45; }

/* Checkbox + label sitting on one baseline. Also used inside a .field-row, where it
   aligns to the bottom of the taller label+input siblings. */
.check-field {
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    align-self: flex-end; min-height: 38px; padding-bottom: 3px; cursor: pointer;
}
.check-field input[type="checkbox"] {
    width: 16px; height: 16px; min-width: 16px; margin: 0; padding: 0;
    border: 1px solid var(--line-strong); border-radius: 3px;
    flex: 0 0 auto; accent-color: var(--brand-red); cursor: pointer;
}
.check-field > span {
    font-size: var(--type-body); font-weight: 500; line-height: 1.3;
    text-transform: none; letter-spacing: 0; color: var(--ink);
}

/* A group of checkboxes laid out as a wrapping row (scopes, assignments, etc.). */
.check-grid { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.check-grid .check-field { min-height: 24px; padding: 0; }

/* One-time API token reveal — monospace, wraps so long keys don't overflow the card. */
.api-token { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12.5px; line-height: 1.5; word-break: break-all; }
/* Settings → Integrations: one entry per API key (name, status and token start on one line, then
   what it may reach, then who it acts as and when it was used), and the scope picker grouped by area. */
.api-key-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.api-key { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.api-key:last-child { border-bottom: none; padding-bottom: 0; }
.api-key.is-dead .api-key-body { opacity: .62; }
.api-key-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.api-key-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.api-key-title strong { font-size: 14px; }
.api-key-prefix { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; color: var(--ink-faint); }
.api-key-scopes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.api-scope { display: inline-flex; gap: 5px; padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-sunk); font-size: 12px; color: var(--ink-soft); }
.api-scope-area { font-weight: 600; color: var(--ink); }
.api-key-meta { margin: 0; font-size: var(--type-helper); color: var(--ink-faint); }
.api-key-actions { flex: none; }

.scope-picker { border: none; margin: 0; padding: 0; min-width: 0; }
.scope-picker legend { padding: 0; margin-bottom: 6px; }
.scope-picker-row { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 8px; align-items: stretch; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.scope-picker-row:first-of-type { border-top: none; padding-top: 0; }
.scope-picker-area { font-size: 13px; font-weight: 600; color: var(--ink); padding-top: 9px; }
.scope-option { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.scope-option:hover { border-color: var(--line-strong); }
.scope-option.is-on { border-color: var(--brand-red); background: var(--brand-red-wash); }
.scope-option input[type="checkbox"] {
    width: 16px; height: 16px; min-width: 16px; margin: 1px 0 0; padding: 0;
    flex: 0 0 auto; accent-color: var(--brand-red); cursor: pointer;
}
.scope-option > span { display: flex; flex-direction: column; gap: 2px; }
.scope-option-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.scope-option-name code { margin-left: 4px; white-space: nowrap; font-size: 11px; font-weight: 400; color: var(--ink-faint); }
.scope-option-does { font-size: var(--type-helper); color: var(--ink-soft); line-height: 1.35; }
@media (max-width: 720px) {
    .scope-picker-row { grid-template-columns: 1fr; }
    .scope-picker-area { padding-top: 0; }
    .api-key { flex-direction: column; gap: 10px; }
}
/* A payment file's checksum is compared by eye against the bank's record, so it is monospaced and quiet. */
.checksum { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; }
.row-inline > input[type="checkbox"],
.row-inline > input[type="radio"] {
    flex: 0 0 auto; margin: 0; accent-color: var(--brand-red);
}
.grid-table .row input[type="checkbox"] { margin: 0; vertical-align: middle; }

.hint {
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 14px;
    font-size: 11.5px; color: var(--ink-soft); line-height: 1.5;
    display: flex; gap: 9px;
}

/* Toggle */
.toggle { width: 36px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; border: none; cursor: pointer; padding: 0; }
.toggle.on { background: var(--brand-fill); }
.toggle .knob { width: 16px; height: 16px; border-radius: 50%; background: var(--toggle-knob); position: absolute; top: 2px; left: 2px; transition: left .12s; }
.toggle.on .knob { left: 18px; }

/* ── Badges / callouts ─────────────────────────────────────────────────────── */

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.ok, .badge.approved { background: var(--ok-wash); color: var(--ok-ink); }
.badge.neutral { background: var(--surface-sunk); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.warn, .badge.submitted { background: var(--warn-wash); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.badge.danger, .badge.rejected { background: var(--danger-wash); color: var(--danger-ink); border: 1px solid var(--danger-line); }
.badge.info { background: var(--info-wash); color: var(--info-ink); border: 1px solid var(--info-line); }

.callout { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius); font-size: 12.5px; font-weight: 600; margin: 12px 0; }
.callout.ok { background: var(--ok-wash); border: 1px solid var(--ok-line); color: var(--ok-ink); }
.callout.warn { background: var(--warn-wash); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.callout.info { background: var(--surface-sunk); border: 1px solid var(--line); color: var(--ink-soft); font-weight: 500; }
/* A pay run refused for missing employee details (Wave F): the list, then a reason and "Post anyway". */
.callout.missing-details { align-items: flex-start; font-weight: 500; }
.callout.missing-details > div { flex: 1; }
.missing-details-list { margin: 6px 0 10px 18px; padding: 0; }
.callout.missing-details textarea { width: 100%; background: var(--surface); }

/* Compliance → Monthly returns: what is left to pay on the month being worked, after payments and RMD credit (decision 1). */
.return-still-to-pay { font-size: 13px; margin-top: 3px; }
.return-still-to-pay b { margin-left: 6px; }
.return-still-to-pay-note { font-size: 11.5px; margin-left: 4px; }

.note { font-size: 11.5px; color: var(--ink-faint); margin-top: 8px; }

/* ── General journal editor ───────────────────────────────────────────────── */

.gj-page-head { margin-bottom: 12px; }
.gj-meta-card {
    display: grid;
    grid-template-columns: 170px minmax(320px, 1fr) 170px;
    gap: 14px;
    align-items: end;
    padding: 13px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.gj-reference {
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}
.gj-reference strong { margin-top: 3px; font-size: 13px; }
.gj-reference > span:last-child { margin-top: 1px; color: var(--ink-faint); font-size: 10.5px; }
.gj-lines-card { overflow: visible; }

.gj-lines .field-input { padding: 7px 8px; }
.gj-line { position: relative; }
.gj-account-picker { position: relative; min-width: 0; }
.gj-account-menu {
    position: absolute;
    z-index: 25;
    top: calc(100% + 4px);
    left: 0;
    width: max(100%, 330px);
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-drawer);
}
.gj-account-menu button {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}
.gj-account-menu button:hover,
.gj-account-menu button:focus { outline: none; background: var(--brand-red-wash); }
.gj-account-menu button span { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.gj-account-menu button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gj-account-empty { padding: 10px; color: var(--ink-faint); font-size: 12px; }
.gj-line-actions { display: flex; justify-content: flex-end; gap: 7px; }
.gj-line-actions .icon-btn { padding: 5px; border-radius: var(--radius-sm); }
.gj-line-actions .icon-btn:hover:not(:disabled) { background: var(--surface-sunk); }
.gj-line-actions .icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.gj-table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 5px 12px;
    border-top: 1px solid var(--line-soft);
}
.gj-add-line { color: var(--brand-red); }

.gj-balance-state { color: var(--warn-ink); font-size: 11px; font-weight: 600; }
.gj-balance-state.balanced { color: var(--ok-ink); }
.gj-period-note { margin-top: 7px; color: var(--ink-faint); font-size: 11px; }
.gj-footer-spacer { height: 72px; }
.gj-action-bar {
    position: fixed;
    z-index: 20;
    left: 232px;
    right: 0;
    bottom: 0;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    transition: left .16s ease;
}
.gj-action-summary { flex: 1; color: var(--ink-faint); font-size: 12px; }
.gj-footer-balanced { color: var(--ok-ink); font-weight: 700; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .gj-meta-card { grid-template-columns: 150px minmax(250px, 1fr); }
    .gj-reference { grid-column: 1 / -1; align-items: flex-start; }
}

@media (max-width: 680px) {
    .field-row { flex-direction: column; }
    .field-row > .field { width: 100%; max-width: none !important; }
    .gj-meta-card { grid-template-columns: 1fr; }
    .gj-reference { grid-column: auto; }
    .gj-action-bar,
    .app-nav + .app-main .gj-action-bar { left: 0; padding-inline: 14px; }
    .gj-action-summary { display: none; }
}

/* ── Slide-over drawer ─────────────────────────────────────────────────────── */

.drawer-scrim {
    position: fixed; inset: 0;
    background: var(--scrim);
    display: flex; justify-content: flex-end;
    z-index: 40;
}
.drawer {
    width: 440px; max-width: 92vw; height: 100%;
    background: var(--surface-raised);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-drawer);
}
/* Wider variant for drawers hosting a data grid (e.g. the timesheet daily-hours grid) rather
   than a narrow field form. Still capped at 92vw, so it degrades to near-fullscreen on phones. */
.drawer-wide {
    width: 860px;
}
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; }
.drawer-head .eyebrow { font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .03em; }
.drawer-head h2 { font-size: 17px; margin-top: 3px; }
.drawer-body { flex: 1; overflow: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.icon-btn { border: none; background: transparent; cursor: pointer; color: var(--ink-faint); padding: 2px; line-height: 0;
    display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; }
.icon-btn:hover { color: var(--ink); }

/* The shared "centred workspace" modal for editing a record (an item, a fixed asset, …) —
   a proper centred dialog with a card-sectioned two-column body, not a narrow slide-over.
   `.item-modal-*` is the original name kept for the Items editor; `.record-modal-*` is the
   same pattern for every other record editor. */
.item-modal-scrim, .record-modal-scrim {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
    background: var(--scrim); backdrop-filter: blur(2px);
}
.item-modal, .record-modal {
    width: min(980px, calc(100vw - 48px)); max-height: calc(100vh - 48px); overflow: hidden;
    display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface-raised); box-shadow: 0 24px 70px rgba(16, 20, 24, .28);
}
.item-modal-head, .record-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.item-modal-head .eyebrow, .record-modal-head .eyebrow { font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.item-modal-head h2, .record-modal-head h2 { margin: 3px 0 0; font-size: 18px; }
.item-modal-body, .record-modal-body { flex: 1; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 18px 22px; background: var(--surface-sunk); }
.item-form-section, .record-form-section { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.item-details-section, .record-section-wide { grid-column: 1 / -1; }
/* The section cards sit in a ~440px column — too narrow for a 3-field row, which
   otherwise spills over the card edge into its neighbour. Let the fields wrap and
   keep them inside the card. */
.item-form-section .field-row, .record-form-section .field-row { flex-wrap: wrap; }
.item-form-section .field-row > .field, .record-form-section .field-row > .field { min-width: 130px; }
.item-form-section .section-title, .record-form-section .section-title { margin: 0; padding: 0 0 10px; border-top: 0; border-bottom: 1px solid var(--line-soft); }
.item-modal-foot, .record-modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.item-modal-foot > div, .record-modal-foot > div { flex: 1; }
.record-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.item-adjustment-card { padding: 18px; margin-bottom: 16px; overflow: visible; }
.item-adjustment-card .section-title { margin: 0 0 14px; padding: 0 0 10px; border-top: 0; border-bottom: 1px solid var(--line-soft); }
.item-adjustment-date, .item-adjustment-number { max-width: 170px; }
.item-adjustment-opening { gap: 7px; margin-top: 8px; font-size: 12.5px; }
.inline-record-link { margin-left: 8px; white-space: nowrap; }
.stocktake-date { display: flex; align-items: center; gap: 8px; }
.stocktake-date .field-label { margin: 0; white-space: nowrap; }
.stocktake-date .field-input { width: 170px; }
.stocktake-count .field-input { width: 110px; margin-left: auto; }
.contact-list-toolbar .contact-filter { width: 160px; }
.contact-editor { max-width: 920px; }
.contact-form-stack { display: grid; gap: 14px; }
.contact-form-section { padding: 20px; overflow: visible; }
.contact-section-heading { padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.contact-section-heading p { margin: 3px 0 0; color: var(--ink-faint); font-size: 12.5px; line-height: 1.45; }
.contact-active-toggle { align-self: end; min-width: 150px; min-height: 38px; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-sunk); }
@media (max-width: 760px) {
    .contact-list-toolbar .contact-filter { width: 100%; }
    .contact-form-section { padding: 16px; }
}
@media (max-width: 760px) {
    .item-modal-scrim, .record-modal-scrim { padding: 10px; place-items: end center; }
    .item-modal, .record-modal { width: 100%; max-height: calc(100vh - 20px); border-radius: 12px 12px 0 0; }
    .item-modal-body, .record-modal-body { grid-template-columns: 1fr; padding: 14px; }
    .item-details-section, .record-section-wide { grid-column: auto; }
}

/* ── Wizard ────────────────────────────────────────────────────────────────── */

.wizard { display: flex; flex-direction: column; height: 100%; background: var(--surface-sunk); }
.wizard-bar { height: 56px; flex-shrink: 0; background: var(--chrome-dark); display: flex; align-items: center; padding: 0 28px; gap: 10px; }
/* The small red mark at the start of the wizard bar. It had no colours of its own, so it drew dark text on the dark bar. */
.wizard-bar .brand-mark {
    width: 26px; height: 26px; border-radius: 6px; font-size: 11px; margin: 0;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: var(--brand-red); color: var(--on-fill); font-weight: 800; letter-spacing: .02em;
}
.wizard-bar .title { color: var(--on-fill); font-size: 13px; font-weight: 700; margin: 0; line-height: inherit; letter-spacing: normal; }
.wizard-bar .biz { color: var(--chrome-dark-muted); font-size: 12px; }

.steps { display: flex; align-items: center; justify-content: center; padding: 22px 0 8px; }
.steps .step { display: flex; align-items: center; gap: 8px; }
.steps .dot {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--ink-faint);
}
.steps .step.current .dot { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
.steps .step.done .dot { background: var(--ok); border-color: var(--ok); color: var(--on-fill); }
.steps .step .label { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.steps .step.current .label { color: var(--ink); font-weight: 700; }
.steps .connector { width: 56px; height: 1px; background: var(--line-strong); margin: 0 10px; }

.wizard-body { flex: 1; overflow: auto; padding: 14px 40px; }
.wizard-body.center { display: flex; align-items: center; justify-content: center; }
.wizard-card { width: 460px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 34px 38px; }
.wizard-foot { height: 64px; flex-shrink: 0; border-top: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }

.import-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: none; background: var(--surface); padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.seg button.active { background: var(--inverse-bg); color: var(--inverse-ink); font-weight: 700; }
.seg button:disabled { cursor: not-allowed; opacity: .6; }

.stack { display: flex; flex-direction: column; gap: 4px; }
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Billing portal — invoice history ─────────────────────────────────────────
   Real columns, not a space-between flex row. Each row used to size itself, so the
   amount drifted with the length of the invoice number beside it and nothing lined
   up down the page. Fixed columns + tabular numerals keep the money in one place. */
.bill-invoice-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.bill-invoice-item:last-child { border-bottom: 0; }
.bill-invoice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px 210px;
    gap: 12px;
    align-items: center;
}
.bill-invoice .bill-amount {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.bill-invoice .bill-status { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* On a phone the three columns cannot hold their width, so stack instead of squeeze. */
@media (max-width: 560px) {
    .bill-invoice { grid-template-columns: 1fr; row-gap: 4px; }
    .bill-invoice .bill-amount { text-align: left; }
    .bill-invoice .bill-status { justify-content: flex-start; }
}

#blazor-error-ui {
    background: var(--warn-wash); border-top: 1px solid var(--warn-line);
    bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.06);
    display: none; left: 0; padding: 0.9rem 1.4rem; position: fixed;
    width: 100%; z-index: 1000; font-size: 13px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.7rem; }

.blazor-error-boundary {
    background: var(--brand-fill); padding: 1rem; color: var(--on-fill); border-radius: var(--radius);
}

/* ── Global loading bar (see App.razor + js/loading.js) ──────────────────────── */
/* Rendered in the static shell, so it is visible during the pre-render → circuit
   connection window (and any full reload, e.g. switching company). The circuit
   handler hides it the moment the page becomes interactive. */
#app-loading-bar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 100%;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
    background: transparent;
    overflow: hidden;
}
#app-loading-bar.is-active { opacity: 1; }
#app-loading-bar::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    left: -40%;
    width: 40%;
    background: var(--brand-red);
    animation: app-loading-sweep 1.1s ease-in-out infinite;
}
@keyframes app-loading-sweep {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* ── Signed-in shell skeleton (see App.razor + js/loading.js) ─────────────────── */
/* Signed-in pages are not prerendered, so this is what a hard load shows until the circuit
   connects. Geometry only, mirroring .app-shell / .app-nav / .app-topbar / .app-content, in
   the same tokens (so dark mode follows). Deliberately static: no shimmer to animate. */
.shell-skel { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.shell-skel-nav {
    width: 232px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; padding: 12px 10px;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
}
.shell-skel-brand { height: 34px; margin-bottom: 10px; border-radius: 8px; background: var(--line); opacity: .7; }
.shell-skel-row { height: 34px; border-radius: 8px; background: var(--line); opacity: .45; }
.shell-skel-spacer { flex: 1; min-height: 12px; }
.shell-skel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shell-skel-topbar { height: 52px; flex-shrink: 0; display: flex; align-items: center; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.shell-skel-title { width: 120px; height: 14px; border-radius: 4px; background: var(--line); opacity: .7; }
.shell-skel-content { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 20px 24px; }
.shell-skel-block { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.shell-skel-hero { height: 260px; }
.shell-skel-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.shell-skel-trio .shell-skel-block { height: 220px; }
@media (max-width: 900px) {
    .shell-skel-nav { display: none; }
    .shell-skel-trio { grid-template-columns: 1fr; }
    .shell-skel-content { padding: 16px; }
}

/* ── Circuit reconnection modal (see App.razor) ─────────────────────────────── */
/* blazor.web.js toggles the components-reconnect-* classes on #components-reconnect-modal
   when the SignalR circuit drops; the three inner panels correspond to the three states. */
#components-reconnect-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--scrim);
}
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}
.reconnect-card {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-drawer);
    padding: 22px 26px;
    text-align: center;
    max-width: 320px;
    width: calc(100% - 48px);
}
.reconnect-card p { margin: 0 0 14px; color: var(--ink-soft); }
.reconnect-card .show,
.reconnect-card .failed,
.reconnect-card .rejected { display: none; }
#components-reconnect-modal.components-reconnect-show .show,
#components-reconnect-modal.components-reconnect-failed .failed,
#components-reconnect-modal.components-reconnect-rejected .rejected { display: block; }
.reconnect-spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 12px;
    border: 3px solid var(--line);
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: reconnect-spin 0.9s linear infinite;
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }

/* ── Payment run stepper (Purchases → Payment runs) ─────────────────────────── */
.step-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    font-size: 12px; font-weight: 700;
    background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.step-badge.current { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
.step-badge.done { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-ink); }
.audit { font-size: 11px; font-style: italic; }

/* ── KPI tiles (dashboard) ─────────────────────────────────────────────────── */
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.kpi-sub { font-size: 11.5px; margin-top: 4px; display: block; }

/* ── Payment-run: cancelled state ──────────────────────────────────────────── */
.badge.muted { background: var(--surface-sunk); color: var(--ink-faint); border: 1px solid var(--line); text-decoration: line-through; }
.grid-table .row.cancelled { opacity: .6; }
.grid-table .row.rejected { opacity: .7; }

/* ── Record detail pages (Receipts / Payments / Transfers / Bills / Invoices) ─ */
.audit-strip .faint { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
/* Themed quote / invoice preview embedded on the detail page. */
.doc-preview { display: block; width: 100%; height: calc(100vh - 210px); min-height: 480px; border: 0; background: var(--paper); }
/* Document-theme editor: form beside a live preview. */
.theme-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .theme-editor { grid-template-columns: 1fr; } }
/* The settings card repeats these block margins on every group — collapse them to scoped
   rules instead of one-off inline styles on each field / heading. */
.theme-editor > .card:first-child { padding: 20px; }
.theme-editor > .card:first-child > .section-title { margin: 18px 0 12px; }
.theme-editor > .card:first-child > .field { margin-bottom: 14px; }
.theme-editor > .card:first-child > .field-row { margin-bottom: 14px; }
/* Keep the preview pinned while the (long) settings form scrolls, and float the save
   action so it is always reachable without scrolling back up. */
.theme-preview { position: sticky; top: 16px; }
.theme-save-bar {
    position: sticky; bottom: 12px; display: flex; gap: 8px; align-items: center;
    background: var(--surface); padding: 10px 0; margin-top: 8px;
    border-top: 1px solid var(--line-soft); z-index: 5;
}
.theme-manager { padding: 16px 20px; margin-bottom: 16px; }
.theme-manager-main { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.theme-manager-select { flex: 1 1 260px; max-width: 360px; }
.theme-manager-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.control-button { min-height: var(--control-height); padding-block: 0; }
.theme-assignments {
    display: grid; grid-template-columns: 82px minmax(0, auto) minmax(180px, 1fr);
    align-items: center; gap: 10px 16px; margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}
.theme-assignment-options { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.theme-assignment-options .check-field { min-height: 24px; padding: 0; }
.theme-assignment-note { color: var(--ink-faint); font-size: 11.5px; line-height: 1.4; }
/* Theme-editor option checkboxes — a tight vertical list, checkbox and label on one line. */
.theme-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.theme-opts label {
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
    font-size: 12.5px; font-weight: 500; color: var(--ink); cursor: pointer; line-height: 1.3;
}
.theme-opts input[type="checkbox"] {
    width: 15px; height: 15px; min-width: 15px; margin: 0; flex: 0 0 auto;
    accent-color: var(--brand-red); cursor: pointer;
}
/* Logo thumbnail well on the Business details page. */
.logo-well { width: 120px; height: 72px; border: 1px dashed var(--line-strong); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; background: var(--surface-sunk); overflow: hidden; flex: none; }
.logo-well img { max-width: 100%; max-height: 100%; object-fit: contain; background: var(--paper); }   /* the logo as it prints: on paper, in either theme */

/* Type-to-filter combobox (SearchSelect). */
.search-select { position: relative; }
.search-select .ss-input { width: 100%; padding-right: 24px; }
.search-select.disabled .ss-caret { opacity: .45; }
/* Closed state renders the chip via the placeholder — show it at full strength. */
.search-select .ss-input::placeholder { color: var(--ink); opacity: 1; }
.search-select.open .ss-input::placeholder { color: var(--ink-faint); }
.search-select .ss-input.ss-empty-val::placeholder { color: var(--ink-faint); font-style: italic; }
.search-select .ss-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    font-size: 10px; color: var(--ink-faint); pointer-events: none; }
.search-select .ss-pop { position: absolute; z-index: 40; top: calc(100% + 3px); left: 0;
    min-width: max(100%, 240px); max-width: 360px; max-height: 260px; overflow-y: auto;
    background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; }
.search-select .ss-pop.ss-pop-up { top: auto; bottom: calc(100% + 3px); }
.search-select .ss-opt { padding: 7px 9px; border-radius: 5px; cursor: pointer; font-size: var(--type-body);
    display: flex; flex-direction: column; gap: 1px; white-space: normal; }
.search-select .ss-opt:hover, .search-select .ss-opt.active { background: var(--surface-sunk); }
.search-select .ss-opt.sel { color: var(--brand-red); font-weight: 600; }
.search-select .ss-opt.ss-clear { color: var(--ink-faint); font-style: italic; }
.search-select .ss-sub { color: var(--ink-faint); font-size: 11px; }
.search-select .ss-empty { padding: 8px 9px; color: var(--ink-faint); font-size: 12px; }

/* ── Multi-select combobox (searchable checkbox list) ──────────────────────── */
.multi-select { position: relative; }
.multi-select .ms-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    text-align: left; cursor: pointer; padding-right: 26px;
}
.multi-select .ms-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select.disabled .ss-caret { opacity: .45; }
.multi-select .ss-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    font-size: 10px; color: var(--ink-faint); pointer-events: none; }
.multi-select .ms-pop {
    position: absolute; z-index: 40; top: calc(100% + 3px); left: 0;
    min-width: max(100%, 260px); max-width: 360px;
    background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px;
    display: flex; flex-direction: column; gap: 6px;
}
.multi-select .ms-head { display: flex; align-items: center; gap: 6px; }
.multi-select .ms-search { flex: 1; min-width: 0; padding: 6px 9px; font-size: var(--type-body); }
.multi-select .ms-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.multi-select .ms-actions .link { font-size: 12px; padding: 4px 6px; white-space: nowrap; }
.multi-select .ms-list {
    max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
.multi-select .ms-option {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px;
    font-size: var(--type-body); cursor: pointer; white-space: normal;
}
.multi-select .ms-option:hover { background: var(--surface-sunk); }
.multi-select .ms-option input[type="checkbox"] {
    width: 15px; height: 15px; min-width: 15px; margin: 0; padding: 0;
    accent-color: var(--brand-red); cursor: pointer; flex: 0 0 auto;
}
.multi-select .ms-label { flex: 1; min-width: 0; }
.multi-select .ms-sub { color: var(--ink-faint); font-size: 11px; }
.multi-select .ms-empty { padding: 8px 9px; color: var(--ink-faint); font-size: 12px; }

/* Application-owned menu for short, fixed-choice <select> controls. The native
   element remains the form control and no-JS fallback; only its popup is replaced. */
select.app-select-open {
    border-color: var(--brand-red) !important;
    box-shadow: 0 0 0 3px var(--focus-ring) !important;
}
.app-select-pop {
    position: fixed;
    z-index: 1200;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(16, 20, 24, .17), 0 2px 7px rgba(16, 20, 24, .08);
}
.app-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--type-body);
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}
.app-select-option:hover,
.app-select-option.active { background: var(--surface-sunk); }
.app-select-option.selected { color: var(--brand-red); font-weight: 650; }
.app-select-option:disabled { color: var(--ink-faint); cursor: not-allowed; opacity: .55; }
.app-select-option:focus { outline: none; }
.app-select-option-label { min-width: 0; overflow-wrap: anywhere; }
.app-select-check { flex: 0 0 auto; color: var(--brand-red); font-weight: 800; }
.app-select-group {
    padding: 8px 9px 4px;
    color: var(--ink-faint);
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Expiry row on the quote form — checkbox + "valid for N days" on one line. */
.expiry-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.expiry-row input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; margin: 0; flex: 0 0 auto; accent-color: var(--brand-red); }
.expiry-row input[type="number"] { width: 64px; flex: 0 0 auto; text-align: center; }
.expiry-row .faint { white-space: nowrap; }

/* Reusable line-item editor (SalesLinesEditor) — quotes & invoices. */
.lines-editor-grid { border: 1px solid var(--line); border-radius: 8px; }
.lines-editor .ler { display: grid; grid-template-columns: 34px minmax(180px,1.25fr) minmax(180px,1fr) 76px 104px 64px 96px 40px;
    gap: 8px; align-items: start; padding: 7px 10px; }
.lines-editor.with-items .ler:not(.dims) {
    grid-template-columns: 30px minmax(140px,.9fr) minmax(150px,1.05fr) minmax(140px,.95fr) 64px 90px 60px 86px 34px; }
/* Business not registered for VAT — the VAT column is dropped from the header and every row. */
.lines-editor.no-vat .ler:not(.dims) {
    grid-template-columns: 34px minmax(180px,1.25fr) minmax(180px,1fr) 76px 104px 96px 40px; }
.lines-editor.no-vat.with-items .ler:not(.dims) {
    grid-template-columns: 30px minmax(140px,.9fr) minmax(150px,1.05fr) minmax(140px,.95fr) 64px 90px 86px 34px; }
/* Keep plain-text cells (row #, line total) level with the first line of the inputs beside them. */
.lines-editor .ler:not(.head):not(.dims) > .num { padding-top: 7px; }
.lines-editor.with-items .ler.dims { grid-template-columns: 30px 1fr; }
.lines-editor .ler.head { background: var(--surface-sunk); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
    font-weight: 700; color: var(--ink-soft); padding-top: 9px; padding-bottom: 9px; border-radius: 7px 7px 0 0; }
.lines-editor .ler:not(.head):not(.dims) { border-top: 1px solid var(--line); }
.lines-editor .ler.dims { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 0 10px 8px; }
.lines-editor .ler .field-input { padding: 6px 8px; font-size: 12.5px; }
.lines-editor .ler:not(.head):not(.dims) input.field-input,
.lines-editor .ler:not(.head):not(.dims) select.field-input,
.lines-editor .ler:not(.head):not(.dims) .search-select .ss-input,
.lines-editor .ler:not(.head):not(.dims) .line-control-static {
    min-height: var(--control-height); height: var(--control-height); padding-top: 0; padding-bottom: 0;
}
.lines-editor .ler:not(.head):not(.dims) .line-control-static { display: flex; align-items: center; }
.lines-editor .ler:not(.head):not(.dims) textarea.field-input {
    min-height: var(--control-height); padding-top: 9px; padding-bottom: 9px;
}
.lines-editor .ler .num { text-align: right; }
/* Tax-code pickers hold a single letter (S / Z / E / N) — keep them compact and centred. */
select.tax-code { padding-left: 6px; padding-right: 20px !important; background-position: right 6px center; text-align: center; }
/* Multi-line description: starts one row tall, grows to fit as the user types (Enter = new line). */
textarea.autogrow { resize: none; overflow: hidden; min-height: calc(1.4em + 14px); line-height: 1.4;
    white-space: pre-wrap; font: inherit; field-sizing: content; }
/* While empty, size to the single `rows` line — otherwise `field-sizing: content` grows the
   box to fit a wrapped placeholder in a narrow column. Content restores content-sizing. */
textarea.autogrow:placeholder-shown { field-sizing: fixed; }
/* A one-line description sits in a row with 38px inputs: match them, then grow with the text. */
.field textarea.autogrow { min-height: var(--control-height); padding-block: 8px; }
.line-del { border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 14px; line-height: 1;
    padding: 0 7px; min-height: var(--control-height); border-radius: 6px; opacity: .55; }
.line-del:hover:not(:disabled) { opacity: 1; background: var(--danger-wash); }
.line-del:disabled { opacity: .2; cursor: default; }
/* Two panels side by side — a reference (document preview) beside the form built from it.
   Wraps to one column when there isn't room; the main panel keeps overflow visible so pickers can open. */
.split-panels { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
.split-panels > .split-side { flex: 1 1 280px; padding: 16px; }
.split-panels > .split-main { flex: 2 1 420px; padding: 20px; overflow: visible; }
/* The captured document beside the bill it becomes: an image scales down, a PDF gets a tall frame. */
.capture-preview { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; }
.capture-preview-pdf { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-sunk); }
/* A document being read: a banner on the review screen, a small spinner in the inbox status badge. */
.capture-working { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-sunk); }
.capture-working-text { display: flex; flex-direction: column; gap: 2px; flex: 1; font-size: 13px; }
.capture-working-text span { color: var(--ink-soft); }
.capture-spinner { flex: none; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand-red); border-radius: 50%; animation: reconnect-spin 0.9s linear infinite; }
.capture-spinner-sm { display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) { .capture-spinner { animation: none; } }
/* Only a way to lock the form while it fills in: a bare fieldset would draw a box and squeeze its contents. */
.capture-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
/* Fields stacked with a steady rhythm (no per-field margins). */
.form-stack { display: flex; flex-direction: column; gap: 14px; }

/* Action bar under a form or grid: right-aligned like the invoice/bill forms, clear of the card above. */
.page-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.lines-editor-actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.lines-editor-actions .add-line { border-style: dashed; }
.lines-editor-actions .from-item { display: flex; align-items: center; gap: 8px; }
.lines-editor-actions .from-item select { max-width: 220px; }
.card > .section-title:first-child { padding-top: 0; border-top: none; margin-top: 0; margin-bottom: 12px; }
/* Totals summary under a line-item editor. */
.doc-totals { margin: 16px 0 0; margin-left: auto; width: 280px; display: grid; gap: 6px; }
.doc-totals > div { display: flex; justify-content: space-between; align-items: baseline; }
.doc-totals .num { font-variant-numeric: tabular-nums; }
.doc-totals .grand { border-top: 2px solid var(--brand-red); padding-top: 8px; font-weight: 800; font-size: 14px; }
/* ── Line grids on a phone ─────────────────────────────────────────────────────
   Desktop lays line items out as a table: column headers above, one row per line. Below 900px each
   row becomes a small stacked form instead — every field carries its own label (data-label), wide
   fields (.cell-wide) take the full width, the row number and column headers go away, and the remove
   control (.cell-end) sits at the row's end. Opt in with .stack-sm on the grid container and
   data-label / .cell-wide / .cell-end on the cells; nothing changes above 900px. */
@media (max-width: 900px) {
    .stack-sm :is(.row, .ler).head { display: none; }
    .stack-sm :is(.row, .ler):has(> [data-label]):not(.head) {
        grid-template-columns: 1fr 1fr !important;   /* beats the inline column templates on the desktop grid */
        gap: 10px 12px; padding: 12px 14px; align-items: start;
    }
    .stack-sm :is(.row, .ler) > [data-label] { display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
    .stack-sm :is(.row, .ler) > [data-label]::before {
        content: attr(data-label);
        font-size: 11.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em;
    }
    .stack-sm :is(.row, .ler) > .cell-wide { grid-column: 1 / -1; }
    .stack-sm :is(.row, .ler) > .cell-end { grid-column: 1 / -1; justify-self: end; }
    .stack-sm :is(.row, .ler) > .cell-hide { display: none; }   /* empty spacer cells that only exist to keep desktop columns aligned */
    .stack-sm .ler:not(.head):not(.dims) > :first-child:not([data-label]) { display: none; }   /* the row number */
    .stack-sm .ler.dims { grid-template-columns: 1fr !important; }
    .stack-sm .ler.dims > :first-child { display: none; }

    /* The same stacked form for a <table class="data-table stack-sm">: the column headers go, each row is a two-column
       grid of labelled cells (data-label), and a row with no labelled cell (a total, "none yet") is its label and figure
       on one line. .cell-wide / .cell-end / .cell-hide mean what they mean above. */
    .data-table.stack-sm,
    .data-table.stack-sm tbody,
    .data-table.stack-sm tfoot { display: block; width: 100%; }
    .data-table.stack-sm thead { display: none; }
    .data-table.stack-sm tr {
        display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline;
        padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
    }
    .data-table.stack-sm tr:has(> [data-label]) { grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 12px 14px; align-items: start; }
    .data-table.stack-sm tr > td,
    .data-table.stack-sm tr > th { padding: 0; border: 0; min-width: 0; background: none; }
    .data-table.stack-sm tr > [data-label] { display: flex; flex-direction: column; gap: 4px; text-align: left; }
    .data-table.stack-sm tr > [data-label]::before {
        content: attr(data-label);
        font-size: 11.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em;
    }
    .data-table.stack-sm tr > .cell-wide { grid-column: 1 / -1; }
    .data-table.stack-sm tr > .cell-end { grid-column: 1 / -1; justify-self: end; }
    .data-table.stack-sm tr > .cell-hide { display: none; }
    .data-table.stack-sm tr.total { background: var(--surface-sunk); }
}
.dim-tag {
    font-size: 10.5px; border: 1px solid var(--line-strong); border-radius: 4px;
    padding: 0 4px; margin-left: 6px; color: var(--ink-soft); white-space: nowrap;
}
.tax-tag {
    font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
    border: 1px solid var(--line-strong); border-radius: 4px;
    padding: 0 4px; margin-left: 6px; color: var(--ink-soft); white-space: nowrap;
}

/* ── Worksheet layout with a left step rail (Payment runs; reused by Payroll) ─ */
/* minmax(0, 1fr), not 1fr: a bare 1fr won't shrink below its widest content, so a wide worksheet or table used to
   stretch the whole page past the viewport (the processing wizard, PAYE returns, the payslip register). */
.worksheet { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .worksheet { grid-template-columns: minmax(0, 1fr); } }

.step-rail { display: flex; flex-direction: column; gap: 2px; }
.step-rail-node {
    display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 10px 12px; border: none; background: transparent; cursor: pointer;
    border-radius: var(--radius-sm); font-size: 12.5px; color: var(--ink-soft); width: 100%;
    position: relative;
}
.step-rail-node + .step-rail-node::before {
    content: ""; position: absolute; left: 23px; top: -2px; height: 12px; width: 2px;
    background: var(--line-strong);
}
.step-rail-node:hover { background: var(--surface-sunk); }
.step-rail-node.active { background: var(--brand-red-wash); color: var(--ink); font-weight: 700; }
.step-rail-badge {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700;
    background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.step-rail-node.current .step-rail-badge { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
.step-rail-node.done .step-rail-badge { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-ink); }
.step-rail-node.blocked .step-rail-badge { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
.step-rail-label { line-height: 1.25; }

/* Payroll module landing — a contextual hero and one operational stepper. Navigation is the rail
   and the area tab bar; the page does not re-list it.
   The old two-card "setup vs cycle" split and fixed-width stage blocks are gone: the stepper is
   one responsive <ol> whose connector is a CSS line (no detached arrow elements). */
.payroll-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 18px 20px; margin-bottom: 16px;
    border: 1px solid var(--line); border-left: 3px solid var(--brand-red);
    border-radius: var(--radius); background: var(--surface);
}
.payroll-hero-copy { min-width: 0; }
.payroll-hero-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.payroll-hero-status { margin-top: 3px; font-size: 12.5px; color: var(--ink-soft); }
.payroll-hero .btn { flex-shrink: 0; }

.payroll-section-head { align-items: center; }
.payroll-section-head h2 { margin: 0; font-size: 16px; line-height: 1.3; }
.payroll-cycle-card { margin-bottom: 16px; padding: 16px 18px 18px; }
.payroll-cycle {
    list-style: none; margin: 0; padding: 0; position: relative;
    display: grid; grid-template-columns: repeat(var(--cycle-steps, 5), minmax(0, 1fr));
}
.payroll-cycle::before {
    /* The line runs from the middle of the first badge to the middle of the last: half a column in from each edge. */
    content: ""; position: absolute; left: calc(50% / var(--cycle-steps, 5)); right: calc(50% / var(--cycle-steps, 5)); top: 11px; height: 2px;
    background: var(--line-strong);
}
.payroll-cycle-step {
    position: relative; min-width: 0; text-align: center; padding: 0 8px;
}
.payroll-cycle-badge {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-soft);
    position: relative; z-index: 1;
}
.payroll-cycle-step.done .payroll-cycle-badge { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-ink); }
.payroll-cycle-step.current .payroll-cycle-badge { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
.payroll-cycle-link { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.payroll-cycle-link:focus-visible { outline: 3px solid var(--brand-red-wash); outline-offset: 3px; }
.payroll-cycle-link:hover .payroll-cycle-title { color: var(--brand-red); }
.payroll-cycle-body { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.payroll-cycle-title-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.payroll-cycle-title { font-size: 12.5px; font-weight: 700; }
.payroll-cycle-copy { font-size: 11px; color: var(--ink-faint); line-height: 1.35; max-width: 180px; }
.payroll-cycle-current { padding: 2px 6px; border-radius: 999px; background: var(--brand-red-wash); font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-red); white-space: nowrap; }

.payroll-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }

/* ── Payroll dashboard: two columns at desktop width ──────────────────────────
   Main column = the operational surface (hero, KPIs, cycle, exceptions, trend).
   Side column = time-sensitive and historical context (deadlines, the
   current run's checklist, recent activity). Collapses to one column below 1200px
   so the sidebar's cards don't squeeze the tables beside them. */
.payroll-dash { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.payroll-dash-main { min-width: 0; }
.payroll-dash-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1200px) { .payroll-dash { grid-template-columns: 1fr; } }

/* Key deadlines: label + countdown badge, then why it matters and when. */
.payroll-deadline-list { list-style: none; margin: 0; padding: 0; }
.payroll-deadline-list li { border-bottom: 1px solid var(--line-soft); }
.payroll-deadline-list li:last-child { border-bottom: none; }
.payroll-deadline-list a { display: flex; flex-direction: column; gap: 3px; padding: 9px 0; color: inherit; text-decoration: none; }
.payroll-deadline-list a:hover strong { color: var(--brand-red); }
.payroll-deadline-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.payroll-deadline-head .badge { padding: 2px 8px; white-space: nowrap; }

/* This run: a tick, a link into the workflow, and the evidence for the state. */
.payroll-checklist { list-style: none; margin: 0; padding: 0; }
.payroll-checklist li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.payroll-checklist li:last-child { border-bottom: none; }
.payroll-checklist a { color: inherit; text-decoration: none; }
.payroll-checklist a:hover { color: var(--brand-red); }
.payroll-checklist .faint { display: block; font-size: 11.5px; }
.payroll-check-mark { font-weight: 800; text-align: center; }
.payroll-check-mark.done { color: var(--ok-ink); }
.payroll-check-mark.todo { color: var(--warn-ink); }
.payroll-check-mark.unknown { color: var(--ink-faint); }

/* Recent activity: actor initials, what happened, and how long ago. */
.payroll-activity { list-style: none; margin: 0; padding: 0; }
.payroll-activity li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.payroll-activity li:last-child { border-bottom: none; }
.payroll-activity .faint { display: block; font-size: 11.5px; }
.payroll-activity-actor {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--surface-sunk); color: var(--ink-soft);
    font-size: 10.5px; font-weight: 800;
}
.payroll-panel { padding: 16px 18px; }
.payroll-empty-state { display: flex; align-items: center; gap: 8px; min-height: 28px; color: var(--ink-soft); font-size: 12.5px; }

/* Timesheets, one pay period at a time (TimesheetList.razor, owner review 2026-09-27): the period and its arrows, the four
   steps of the period, and the people list beside the open timesheet. */
.ts-period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ts-period-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ts-period-dates { font-size: 18px; margin: 0; }
.ts-arrow { min-width: 36px; padding: 0 10px; font-size: 18px; line-height: 1; }
.ts-period-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ts-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ts-board { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 14px; align-items: start; }
.ts-people { padding: 0; overflow: hidden; }
.ts-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.ts-filter { border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.ts-filter:hover { background: var(--surface-sunk); }
.ts-filter.active { background: var(--brand-red-wash); color: var(--brand-red); font-weight: 600; }
.ts-people-list { list-style: none; margin: 0; padding: 0; }
.ts-people-list li + li { border-top: 1px solid var(--line-soft); }
.ts-person { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 10px 12px; border: none; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.ts-person:hover { background: var(--surface-sunk); }
.ts-person.selected { background: var(--brand-red-wash); box-shadow: inset 3px 0 0 var(--brand-red); }
.ts-person-name { font-weight: 600; overflow-wrap: anywhere; }
.ts-person .badge { justify-self: start; }
.ts-people-empty { padding: 12px; margin: 0; }
.ts-detail { min-width: 0; }
.ts-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ts-detail-head h2 { margin: 0; font-size: 18px; }
.ts-detail-actions { gap: 8px; flex-wrap: wrap; }
.ts-detail-empty { padding: 24px; }
@media (max-width: 900px) {
    .ts-board { grid-template-columns: minmax(0, 1fr); }
}
.payroll-empty-state-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-wash); color: var(--ok-ink); font-size: 11px; font-weight: 800; }
/* Exceptions panel: a grid-table pulled out to the panel's own edges, since the shared .grid-table
   row padding is sized for a full-width card and would double up with the panel's here. The column
   template lives here rather than inline on the rows so the narrow-width rule further down can
   restate it — an inline grid-template-columns can only be beaten with !important. */

.payroll-latest { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.payroll-latest:hover .payroll-latest-head strong { color: var(--brand-red); }
.payroll-latest-head { display: flex; align-items: center; gap: 8px; }
.payroll-latest-head strong { font-size: 13px; }
.payroll-latest-breakdown { font-size: 12px; color: var(--ink-soft); }
.payroll-trend-card { padding: 16px 18px 12px; margin-bottom: 16px; }
.payroll-trend-card .chart-line { height: 160px; }
.payroll-trend-card .row-inline { margin-top: 8px; }

/* Payroll landing — the same FY-first, one-position-card rhythm as the main dashboard.
   The existing service owns all workflow states; these rules change only presentation. */
.payroll-year { margin-bottom: 12px; }
.payroll-overview { padding: 0; overflow: hidden; }
.payroll-overview-main { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 20px 24px 18px; }
.payroll-overview-copy { min-width: 0; }
.payroll-overview-title { margin: 9px 0 0; font-size: 17px; line-height: 1.3; font-weight: 650; }
.payroll-overview-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-top: 3px; font-size: clamp(32px, 3.2vw, 42px); font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.payroll-overview-value span { font-size: 13px; letter-spacing: 0; font-weight: 500; color: var(--ink-soft); }
.payroll-overview-value.is-empty { font-size: 27px; letter-spacing: -.02em; }
.payroll-overview-status { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft); }
.payroll-overview-attention { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 650; color: var(--warn-ink); text-decoration: none; }
.payroll-overview-attention:hover { color: var(--brand-red); text-decoration: underline; }
.payroll-overview-main .btn { flex: 0 0 auto; }
.payroll-overview-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.payroll-overview-figure { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; padding: 14px 20px; }
.payroll-overview-figure + .payroll-overview-figure { border-left: 1px solid var(--line); }
.payroll-overview-figure strong { font-size: 21px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.payroll-overview-figure strong.is-empty { font-size: 15px; color: var(--ink-soft); }
.payroll-overview-figure .dashboard-figure-link { margin-top: auto; }
.payroll-quick-actions { margin: 14px 0 16px; }
.payroll-operational-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.payroll-operation { min-width: 0; }
.payroll-operation .payroll-section-head { margin-bottom: 13px; }
.payroll-operation .payroll-section-head h2 { font-size: 14px; }
.payroll-operation .payroll-calendar-strip { margin: 0 0 10px; }
.payroll-operation-link { display: inline-block; margin-top: 10px; }
.payroll-cycle-compact { list-style: none; padding: 0; margin: 0; }
.payroll-cycle-compact li { border-top: 1px solid var(--line-soft); }
.payroll-cycle-compact li:first-child { border-top: 0; }
.payroll-cycle-compact a { display: grid; grid-template-columns: 17px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 0; color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.payroll-cycle-compact a:hover strong { color: var(--brand-red); }
.payroll-cycle-compact a:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }
.payroll-cycle-mark { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; background: var(--line); color: var(--surface); font-size: 10px; font-weight: 700; }
.payroll-cycle-compact .done .payroll-cycle-mark { background: var(--chart-past); }
.payroll-cycle-compact .current .payroll-cycle-mark { background: var(--ink); }
.payroll-cycle-compact .current strong { color: var(--ink); }
.payroll-cycle-compact strong { display: block; font-size: 12px; font-weight: 650; line-height: 1.35; }
.payroll-cycle-compact small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--ink-soft); }
.payroll-operation-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.payroll-operation-subhead h3 { margin: 0; font-size: 12px; }
.payroll-operation-subhead .faint { font-size: 11px; }
.payroll-operation .payroll-checklist li { font-size: 11.5px; }
.payroll-lower { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 14px; }
.payroll-lower > .card { min-width: 0; }

.payroll-home .payroll-trend-card { margin-top: 14px; }
@media (max-width: 1050px) {
    .payroll-operational-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payroll-operational-cards > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .payroll-overview-main { align-items: flex-start; flex-direction: column; padding: 18px 16px 16px; }
    .payroll-overview-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payroll-overview-figure { padding: 12px 16px; }
    .payroll-overview-figure:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
    .payroll-operational-cards, .payroll-lower { grid-template-columns: minmax(0, 1fr); }
    .payroll-operational-cards > :last-child { grid-column: auto; }
}
@media (max-width: 420px) {
    .payroll-overview-figures { grid-template-columns: minmax(0, 1fr); }
    .payroll-overview-figure + .payroll-overview-figure { border-left: 0; border-top: 1px solid var(--line); }
    .payroll-overview-figure:last-child { grid-column: auto; }
}

/* Payroll → Configuration → Approvals & controls: one card per workflow rule — the rule in words, then
   who it applies to and what is waiting. */
.controls-card { padding: 18px; margin-bottom: 16px; }
.controls-rule { margin: 0 0 10px; max-width: 70ch; font-size: 12.5px; color: var(--ink-soft); }
.controls-line { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; font-size: 13px; }
.controls-line > .faint { flex: 0 0 150px; }
.controls-roles { flex-wrap: wrap; gap: 6px; }
.controls-status { flex-wrap: wrap; align-items: center; gap: 8px; }
.controls-empty { margin: 10px 0 0; font-size: 12.5px; }
.controls-subtitle { margin: 16px 0 6px; }
.controls-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.controls-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.controls-retention { align-items: end; gap: 12px; flex-wrap: wrap; }
.controls-table-head { margin: 8px 0 10px; }
.controls-table-title { margin: 0 0 2px; font-size: 16px; line-height: 1.3; }
.controls-table-head .controls-rule { margin-bottom: 0; }

/* Self-service → My timesheet, entry mode: the daily grid is a data-table whose cells hold inputs. */
.my-entry-grid td { padding: 8px 10px; }
.my-entry-grid .field-input { min-width: 84px; }
.my-entry-grid .my-entry-notes { min-width: 160px; }
.my-entry-grid tr.is-weekend { background: var(--surface-sunk); }
.my-entry-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Payroll → Configuration → Emails & notifications: the wording editor sits beside a live preview of the email. */
.wording-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.wording-fields { gap: 4px; }
.wording-fields code { font-size: 12px; }
.wording-preview { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface); }
.wording-preview-subject { font-weight: 600; font-size: 13.5px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.wording-preview-body { white-space: pre-wrap; font-size: 13px; overflow-wrap: anywhere; }
.outbox-reason { font-size: 12px; margin-top: 2px; }
.mail-resend-bad { color: var(--danger-ink); }
/* The subject carries the reason and the resend note under it; without a floor it is squeezed to a few words a line on a phone,
   where the table scrolls sideways anyway. */
.mail-sent-subject { min-width: 240px; }
/* A Sent subject that opens its record. Neutral and underlined, not red: a failed row's own red is the thing to notice. */
.mail-record-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.mail-record-link:hover, .mail-record-link:focus-visible { color: var(--brand-red); text-decoration-color: currentColor; }

/* Mail: Waiting for you on top, Sent underneath, one scroll. */
.mail-jump { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mail-jump-warn { color: var(--warn-ink); border-color: var(--warn-line); background: var(--warn-wash); }
.mail-section + .mail-section { margin-top: 32px; }
.mail-section { scroll-margin-top: 16px; }
.mail-section:focus { outline: none; }
/* A row's buttons sit beside it on a wide screen and fold into the row menu on a narrow one. */
/* Selectors are as specific as the generic .data-table td.table-actions > *:not(.btn) rule they have to beat. */
.mail-table td.mail-actions { text-align: right; white-space: nowrap; }
.mail-table td.mail-actions > .mail-actions-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 0; }
.mail-table td.mail-actions > .mail-actions-menu { display: none; margin-left: 0; }
.mail-row-error { margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--danger-ink); }
.reason-input { min-height: 72px; resize: vertical; height: auto; }
.mail-decided > summary { cursor: pointer; font-size: 15px; font-weight: 700; margin-bottom: 12px; list-style-position: inside; }
.mail-decided > summary .faint { font-size: 12.5px; font-weight: 400; }
.mail-decided:not([open]) > summary { margin-bottom: 0; }
.mail-decided td.document-ref { white-space: normal; }
@media (max-width: 720px) {
    .mail-table td.mail-actions > .mail-actions-inline { display: none; }
    .mail-table td.mail-actions > .mail-actions-menu { display: inline-block; }
    /* Room for the row menu without sideways scrolling: drop the date column and let the item wrap. */
    .mail-table .mail-since { display: none; }
    .mail-table td.document-ref { white-space: normal; min-width: 0; }
}
@media (max-width: 900px) { .wording-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
    .controls-line { flex-direction: column; align-items: flex-start; gap: 4px; }
    .controls-line > .faint { flex: none; }
}

@media (max-width: 760px) {
    .payroll-hero { flex-direction: column; align-items: stretch; }
    .payroll-hero .btn { align-self: flex-start; }
    .dash-kpis.payroll-kpis { grid-template-columns: 1fr; }
    .payroll-cycle { grid-template-columns: 1fr; gap: 12px; }
    .payroll-cycle::before { display: none; }
    .payroll-cycle-step { text-align: left; padding: 0; }
    .payroll-cycle-link { flex-direction: row; align-items: flex-start; gap: 12px; }
    .payroll-cycle-body { align-items: flex-start; }
    .payroll-cycle-title-row { justify-content: flex-start; }
    .payroll-cycle-copy { max-width: none; }
    .payroll-panels { grid-template-columns: 1fr; }

    

    

    
}

.worksheet-exceptions {
    margin-top: 10px; width: 100%; text-align: left; cursor: pointer;
    border: 1px solid var(--warn-line); background: var(--warn-wash); color: var(--warn-ink);
    border-radius: var(--radius-sm); padding: 8px 10px; font-size: 11.5px; font-weight: 700;
}
.worksheet-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.worksheet-summary {
    padding: 14px 20px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 12px 24px;
}
.ws-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ws-metric-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-faint);
}
.ws-metric-value {
    font-size: 15px; font-weight: 600; line-height: 1.3;
    font-variant-numeric: tabular-nums; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.ws-metric-value .badge { font-variant-numeric: normal; vertical-align: 1px; }
.worksheet-panel { padding: 20px; }
.worksheet-notes { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-soft); white-space: pre-wrap; font-family: inherit; }
.worksheet-problems { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--warn-ink); }
.worksheet-problems li { margin: 2px 0; }

/* ── Payroll processing worksheet ─────────────────────────────────────────── */
.worksheet-progress {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: var(--ink-faint); margin-bottom: 8px; padding-left: 12px;
}
.wf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
/* A step can hold more than one stage (Period & hours; the Distribute panel under a locked run): rule them apart. */
.wf-section + .wf-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
/* Company setup inside the run checks (a section of the panel) or on its own (the post step). */
.wf-setup { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.wf-setup.boxed { margin: 0 0 14px; background: var(--surface-sunk); }
.wf-kpi { padding: 14px 16px; display: flex; flex-direction: column; }

@media (max-width: 900px) {
    .worksheet-progress { padding-left: 0; }
}

/* ── Pay run Review screen (Wave 3) ───────────────────────────────────────── */
.review-actions { display: flex; flex-direction: column; gap: 10px; }
.review-action {
    display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.review-action.current { border-color: var(--brand-red); }
.review-action.done { background: var(--surface-sunk); }
.review-action.todo { opacity: .7; }
.review-action-num {
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; background: var(--inverse-bg); color: var(--inverse-ink);
}
.review-action.done .review-action-num { background: var(--ok-ink); }
.review-action.todo .review-action-num { background: var(--line-strong); color: var(--ink); }
.review-action-body { min-width: 0; }
.review-action-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.review-reasons { display: flex; flex-wrap: wrap; gap: 4px; }

.review-unchanged .btn { padding: 2px 6px; }
.is-negative { color: var(--danger-ink); }
.link-btn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.payslip-editor .subhead { margin-top: 10px; }

/* ── Leave entitlement rule cards ─────────────────────────────────────────── */
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.rule-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--line-strong); }
.rule-card.leave-annual { border-top-color: var(--series-2); }
.rule-card.leave-sick { border-top-color: var(--series-3); }
.rule-card.leave-other { border-top-color: var(--brand-slate); }
.rule-card h3 { font-size: 14px; }
.rule-type { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; }
.rule-card.leave-annual .rule-type { color: var(--series-2); }
.rule-card.leave-sick .rule-type { color: var(--series-3-ink); }
.rule-card.leave-other .rule-type { color: var(--brand-slate); }
.rule-entitlement { font-size: 26px; font-weight: 700; line-height: 1.1; }
.rule-entitlement small { font-size: 12px; font-weight: 600; color: var(--ink-faint); margin-left: 5px; }
.rule-facts { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.rule-fact { display: flex; justify-content: space-between; gap: 10px; }
.rule-fact .yes { color: var(--ok-ink); font-weight: 700; }
.rule-fact .no { color: var(--ink-faint); font-weight: 700; }
.rule-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ── Modal (tabbed dialogs) ───────────────────────────────────────────────── */
/* z-index 60, above .record-modal-scrim/.item-modal-scrim's 50: a .modal-scrim dialog
   (quick-add, send, confirm) is always ABOUT whatever's underneath it, including when
   that's a large record-modal editor (e.g. ConfirmDialog's unsaved-changes prompt nested
   inside AssetModal) — same z-index + later-in-DOM meant the bigger modal painted over it. */
.modal-scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-panel { width: 560px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface-raised); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.22); overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 16px; }
.modal-tabs { display: flex; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface-sunk); }
.modal-tabs button { border: none; background: transparent; cursor: pointer; padding: 10px 2px; font: inherit; font-size: var(--type-body); font-weight: 600; color: var(--ink-faint); border-bottom: 2px solid transparent; }
.modal-tabs button:hover { color: var(--ink); }
.modal-tabs button.active { color: var(--ink); border-bottom-color: var(--brand-red); }
.modal-body { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.confirm-panel { width: 440px; }
/* A dialog whose head, body and foot sit inside a <form> (Add employee, the send dialogs) lays out like one without: the
   form is the column, so a long body scrolls between a head and a foot that stay in view instead of pushing the
   buttons out of the panel's clipped bottom. */
.modal-panel > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
/* A confirmation (ConfirmDialog, the unsaved-changes prompt) always answers the thing in front of the person, so it sits
   above every other modal and drawer. An editor's guard can render before the modal it protects (a quick-add, a drawer),
   and at the shared 60 the later modal painted over the prompt: navigation was held with no dialog to answer. */
.modal-scrim.confirm-scrim { z-index: 70; }
.confirm-panel .modal-body { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
/* Dialogs on a phone. A 560px panel inside a 20px scrim margin left a form a few fields tall with the page peeking
   round it; below 640px a dialog takes the whole screen (its body scrolls, its buttons stay at the bottom) and a
   confirmation, which is two lines and two buttons, becomes a sheet along the bottom edge within thumb reach. The
   !important beats the inline width a <Modal Width="…"> sets for the desktop. */
@media (max-width: 640px) {
    .modal-scrim { padding: 0; align-items: stretch; }
    .modal-panel { width: 100% !important; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
    .modal-panel > .modal-body, .modal-panel > form > .modal-body { flex: 1; }
    .modal-scrim.confirm-scrim { align-items: flex-end; }
    .modal-panel.confirm-panel { height: auto; border-radius: 12px 12px 0 0; }
    .modal-foot { flex-wrap: wrap; }
    .item-modal-scrim, .record-modal-scrim { padding: 0; }
    .item-modal, .record-modal { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
}

/* ── Analytics dashboard ──────────────────────────────────────────────────── */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.dash-kpi { padding: 16px 18px; display: flex; flex-direction: column; }
/* Phones: two to a row instead of one full-width card each — the timesheets page alone stacked five of them (about 700px of
   scrolling) before any content. The payroll dashboard's own three keep their one-per-row layout above. */
@media (max-width: 620px) {
    .dash-kpis:not(.payroll-kpis), .wf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .dash-kpis:not(.payroll-kpis) .dash-kpi, .wf-kpis .wf-kpi { padding: 12px 14px; }
}
.dash-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 16px; }
.chart-card { padding: 16px 18px; }
.chart-card h2, .chart-card h3 { font-size: 13px; margin-bottom: 4px; }
.chart-note { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 12px; }
.chart-empty { padding: 26px 0; text-align: center; color: var(--ink-faint); font-size: 12.5px; }

.chart-line { width: 100%; height: 180px; overflow: visible; }
.chart-line .plot-line { fill: none; stroke: var(--brand-red); stroke-width: 2; }
.chart-line .plot-area { fill: var(--brand-red-wash); }
.chart-line .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-line .gridline { stroke: var(--line-soft); stroke-width: 1; }
.chart-line .dot { fill: var(--brand-red); }

.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 8px; }
/* Stretched to the row's height, so a bar's percentage height has something to be a percentage of: with the row's
   align-items: flex-end the column was only as tall as its content and every bar fell to its 2px minimum. */
.chart-bar-col { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.chart-bar { width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; background: var(--brand-red); min-height: 2px; }
.chart-bar.stacked { display: flex; flex-direction: column-reverse; background: transparent; border-radius: 4px 4px 0 0; overflow: hidden; }
.chart-bar-seg { width: 100%; }
.chart-bar-label { font-size: 10.5px; color: var(--ink-faint); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11.5px; }
.chart-legend span.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.chart-pie-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.chart-pie { width: 156px; height: 156px; flex: 0 0 auto; }
/* Pie slices take the categorical series in order (an SVG stroke attribute cannot read a custom property, a rule can). */
.chart-pie .series-1 { stroke: var(--series-1); }
.chart-pie .series-2 { stroke: var(--series-2); }
.chart-pie .series-3 { stroke: var(--series-3); }
.chart-pie .series-4 { stroke: var(--series-4); }
.chart-pie .series-5 { stroke: var(--series-5); }
.chart-pie .series-6 { stroke: var(--series-6); }
.chart-pie-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
.chart-pie-legend .row-inline { justify-content: space-between; }

/* ── Pay period setup wizard ──────────────────────────────────────────────── */
.freq-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.freq-choice { text-align: left; padding: 14px 16px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; }
.freq-choice:hover { border-color: var(--brand-red); }
.freq-choice.selected { border-color: var(--brand-red); background: var(--brand-red-wash); }
.freq-choice strong { font-size: 13.5px; }
.freq-choice span { font-size: 11.5px; color: var(--ink-soft); }

/* ── Employee record identity header ─────────────────────────────────────────
   Initials chip beside the name, then a three-fact strip. Purely presentational:
   every value is already on the page (name, position, status, start date,
   readiness) except the next pay date, which has its own lean loader. */
.employee-identity { display: flex; align-items: center; gap: 12px; }
.employee-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
    background: var(--brand-red-wash); color: var(--brand-red);
    font-size: 14px; font-weight: 800; letter-spacing: .02em;
}
.employee-identity h1 { margin: 0; }
.employee-facts {
    display: flex; flex-wrap: wrap; gap: 12px 40px;
    padding: 12px 18px; margin-bottom: 16px;
    background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 10px;
}
.employee-fact { display: flex; flex-direction: column; gap: 2px; }
.employee-fact-value { font-size: 13.5px; font-weight: 700; }

/* Employee register: the staff number, dates and status are short, fixed-shape values that read
   worse broken across lines ("EMP-" / "0001"). Name, position and rate may wrap; the table sits
   in .table-scroll if it outgrows the viewport. */
.nowrap { white-space: nowrap; }

/* ── Shared page primitives (payroll consistency pass) ────────────────────────
   In-card tab bar (employee record), hub tiles (report hubs), readiness
   checklists (PAYE annual return) and the warning button variant. These replace
   the Bootstrap-shaped markup that had crept into some payroll pages — Bootstrap
   is NOT loaded, so those classes rendered unstyled. */

.btn-warn { background: var(--warn-wash); color: var(--warn-ink); border-color: var(--warn-line); font-weight: 700; }
.btn-warn:hover:not(:disabled) { background: var(--warn-wash-hover); }

.tabs { display: flex; gap: 18px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--surface-sunk);
    overflow-x: auto; scrollbar-width: none; }   /* underlined record tabs scroll within their card on a phone */
.tabs .tab, button.tab { flex: 0 0 auto; white-space: nowrap; }
.tabs .tab, button.tab {
    border: none; background: transparent; cursor: pointer; padding: 11px 2px; font: inherit;
    font-size: 12.5px; font-weight: 600; color: var(--ink-faint); border-bottom: 2px solid transparent;
}
.tabs .tab:hover, button.tab:hover { color: var(--ink); }
.tabs .tab.active, button.tab.active { color: var(--ink); border-bottom-color: var(--brand-red); font-weight: 700; }
.tab-content { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 14px; }
.tile { padding: 18px; display: block; color: inherit; }
.tile:hover { border-color: var(--brand-red); color: inherit; }
.tile-title { font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.tile-note { color: var(--ink-faint); font-size: 12.5px; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); }
.checklist li:last-child { border-bottom: none; }
.checklist .mark { font-size: 13px; line-height: 1.35; font-weight: 700; }
.checklist li.pass .mark { color: var(--ok-ink); }
.checklist li.fail .mark { color: var(--brand-red); }
.checklist li.pending .mark { color: var(--warn-ink); }
.checklist .label { display: block; font-weight: 650; font-size: 12.5px; }
.checklist .detail { display: block; color: var(--ink-faint); font-size: 11.5px; margin-top: 2px; line-height: 1.4; }

.validation-message { color: var(--brand-red); font-size: 11.5px; font-weight: 600; }
.invalid { border-color: var(--brand-red); }

/* Section heading inside a tab or panel — separates a long form into readable groups. */
.section-title {
    margin: 6px 0 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-faint); padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.tab-content > .section-title:first-child { padding-top: 0; border-top: none; }

/* File-picker drop zone (employee documents): a real <label> so no JS click shim is needed. */
.upload-drop { display: block; margin: 0 0 16px; padding: 16px; background: var(--surface-sunk); border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; cursor: pointer; }
.upload-drop-title { font-weight: 600; display: block; margin-bottom: 6px; }
.upload-drop:hover { border-color: var(--brand-red); }
.upload-drop:focus-within { border-color: var(--brand-red); box-shadow: 0 0 0 3px var(--brand-red-wash); }

/* Selectable KPI card, used to choose the kind of payroll being run. */
.wf-kpi.selected { background: var(--brand-red-wash); }

.empty-state { padding: 34px 20px; text-align: center; }
.empty-state-icon { display: inline-flex; margin-bottom: 8px; color: var(--ink-faint); }
.empty-state-icon svg { width: 30px; height: 30px; }
.empty-state b { display: block; font-size: 13.5px; }
.empty-state p { margin: 6px auto 14px; max-width: 420px; color: var(--ink-faint); font-size: 12.5px; }

/* Worksheet variant: main content with a narrower sidebar on the right (PAYE return). */
.worksheet.return-layout { grid-template-columns: minmax(0, 1fr) 320px; }

@media (max-width: 900px) {
    .worksheet, .worksheet.return-layout { grid-template-columns: minmax(0, 1fr); }
    .app-content { padding: 16px 14px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .head-actions { flex-wrap: wrap; }
}

/* ── RM205 VAT & PAYE return worksheet ─────────────────────────────────────── */
table.rm-form { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rm-form td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
table.rm-form tr.rm-section td {
    background: var(--surface-sunk); font-weight: 700; font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-soft); border-bottom: 1px solid var(--line);
}
table.rm-form td.rm-no { width: 44px; color: var(--ink-faint); font-variant-numeric: tabular-nums; text-align: right; }
table.rm-form td.rm-amt { width: 170px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rm-form tr.rm-emph td { font-weight: 700; background: var(--surface-sunk); }
table.rm-form tr.rm-input td { background: var(--brand-red-wash); }
table.rm-form tr.rm-row:last-child td { border-bottom: none; }

table.rm-recon { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.rm-recon td { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
table.rm-recon td.rm-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rm-recon tr:last-child td { border-bottom: none; }

/* ── Cashbook Receipts / Payments filter bar ───────────────────────────────── */
.cash-filter-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px;
}
.cash-filter-grid > label { display: flex; flex-direction: column; gap: 3px; }
.cash-filter-grid .field-label { margin: 0; }
.cash-filter .field-input { padding: 6px 9px; font-size: var(--type-body); }
@media (max-width: 640px) { .cash-filter-grid { grid-template-columns: 1fr 1fr; } }

/* ── Shared list pager (Pager.razor) ───────────────────────────────────────── */
.list-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 10px; flex-wrap: wrap;
}
.list-pager-count { font-size: 12px; }
.list-pager-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.list-page-size { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 12px; }
.list-page-size select { padding: 5px 24px 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; }
.list-pager-controls { display: flex; align-items: center; gap: 6px; }

/* ── Shared list toolbar (ListToolbar.razor) ───────────────────────────────── */
.list-toolbar { margin-bottom: 14px; }
.list-toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-toolbar-spacer { flex: 1 1 auto; }
.list-toolbar-count { font-size: 12px; white-space: nowrap; }
.list-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 200px; }
.list-search svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--ink-faint); pointer-events: none; }
.list-search-input {
    width: 100%; height: var(--control-height); padding: 0 30px 0 32px; font: inherit; font-size: var(--type-body);
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit;
}
.list-search-input:focus { outline: none; border-color: var(--brand-red); box-shadow: 0 0 0 4px var(--brand-red-wash); }
.list-search-input::-webkit-search-cancel-button { display: none; }
.list-search-clear {
    position: absolute; right: 8px; border: 0; background: none; cursor: pointer;
    color: var(--ink-faint); font-size: 12px; line-height: 1; padding: 4px;
}
.list-search-clear:hover { color: var(--ink); }
.list-toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Default size for a bare filter control. .field-input is width:100%, which inside this shrink-to-fit box made
   every dropdown fill the whole box and stack under the last one. :where() keeps this default weaker than the
   per-list widths (.document-list-toolbar .document-status etc.), which still apply where a list sets one. */
:where(.list-toolbar-filters) > :is(select, input).field-input { width: auto; }
:where(.list-toolbar-filters) > select.field-input { min-width: 140px; }
.list-toolbar-filters select, .list-toolbar-filters input {
    height: var(--control-height); padding: 0 9px; font: inherit; font-size: var(--type-body); border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: inherit;
}
.list-toolbar-row > .btn,
.list-toolbar-filters .btn { min-height: var(--control-height); padding-block: 0; }
/* A labelled filter (<label class="list-filter-field"> with a .field-label above its control) is taller than the
   search input beside it. Wherever a toolbar has one, sit every control on the same lower edge so the borders line
   up. This is the toolbar's own rule, not a per-page class, so a new list can't forget it. */
.list-toolbar-row:has(.list-filter-field),
.list-toolbar-filters:has(.list-filter-field) { align-items: flex-end; }
.list-filter-field { margin: 0; }
.list-toolbar-advanced {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 12px;
    margin-top: 10px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px;
    background: var(--surface-sunk);
}
.list-toolbar-advanced > label { display: flex; flex-direction: column; gap: 3px; }
.list-toolbar-advanced .field-label { margin: 0; }
.list-toolbar-advanced .field-input { height: var(--control-height); padding: 0 9px; font-size: var(--type-body); }
.list-toolbar-applied { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font: inherit; font-size: 12px; line-height: 1.25; cursor: pointer; }
.filter-chip span { color: var(--ink-faint); font-size: 14px; line-height: 1; }
.filter-chip:hover, .filter-chip:focus-visible { border-color: var(--brand-red-line); color: var(--brand-red); outline: none; box-shadow: 0 0 0 3px var(--brand-red-wash); }

@media (max-width: 720px) {
    .invoice-page-head { align-items: stretch; }
    .invoice-heading-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
    .invoice-heading-meta > span:not(:first-child)::before { display: none; }
    .invoice-summary-grid, .record-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .invoice-summary-item, .record-summary-item { border-bottom: 1px solid var(--line-soft); }
    .invoice-summary-item:nth-child(2n), .record-summary-item:nth-child(2n) { border-right: 0; }
}

/* Cashbook keeps high-use transaction filters in one deliberate row rather than
   letting date fields and selects spill into a form-shaped header. */
.cashbook-list-toolbar .list-toolbar-row { gap: 8px; }
.cashbook-list-toolbar .list-search { flex-basis: 290px; }
.cashbook-list-toolbar .list-toolbar-filters { gap: 7px; flex: 0 1 auto; }
.cashbook-list-toolbar .cashbook-contact { width: 190px; }
.cashbook-list-toolbar .cashbook-funds { width: 210px; }
.cashbook-date-range { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-faint); }
.cashbook-date-range .field-input { width: 132px; }
.table-sort {
    display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0;
    color: inherit; background: transparent; font: inherit; font-weight: inherit;
    cursor: pointer; text-transform: inherit; letter-spacing: inherit;
}
.table-sort span { color: var(--ink-faint); font-size: 11px; line-height: 1; }
.table-sort:hover, .table-sort:focus-visible { color: var(--brand-red); outline: none; }
/* A colour change alone is a faint focus mark on a column heading: the keyboard also gets the ring. */
.table-sort:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; border-radius: 4px; }
.table-sort.active span { color: var(--brand-red); }

/* Document registers share the same disciplined control geometry as Cashbook.
   Search, status and date range are the primary actions; refinements stay under More. */
.document-list-toolbar .document-status { width: 160px; }
.inventory-list-toolbar .inventory-filter { width: 150px; }
.employee-list-toolbar .employee-filter { width: 150px; }
.inventory-pagination { justify-content: center; gap: 8px; margin-top: 14px; }

/* Sales setup is a small, distinct work area beneath the primary Sales tabs. */
.subnav {
    display: flex; align-items: center; gap: 4px; margin: -4px 0 16px;
    border-bottom: 1px solid var(--line); padding-bottom: 8px;
    flex-wrap: wrap; row-gap: 2px;      /* a long tab bar (Settings) wraps on a phone rather than pushing the page sideways */
}
.subnav a {
    padding: 6px 10px; border-radius: 6px; color: var(--ink-soft); font-size: var(--type-body);
    font-weight: 650; text-decoration: none;
}
.subnav a:hover { background: var(--surface-sunk); color: var(--ink); }
.subnav a.active { background: var(--brand-red-wash); color: var(--brand-red); }
/* Payroll's area tab bar (PayrollSubNav) sits above the page rather than under a page heading, and
   Reports/Configuration carry up to seven tabs — wrap or scroll rather than overflow a phone. */
.payroll-subnav { margin: 0 0 16px; flex-wrap: wrap; row-gap: 2px; }
/* Setup & readiness → "Rules at a glance": one rule per row, its name a link, its state beside it. */
.payroll-glance-list { list-style: none; margin: 0; padding: 0; display: grid; }
.payroll-glance-list li {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 9px 0; border-top: 1px solid var(--line);
}
.payroll-glance-list li:first-child { border-top: 0; }
.payroll-glance-list a { font-weight: 650; }
@media (max-width: 720px) {
    .payroll-subnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .payroll-subnav a { white-space: nowrap; }
}
.configuration-panel { max-width: 640px; padding: 18px; }
.configuration-panel h2 { font-size: 15px; }

/* Settings area — one shell for every /settings/* page (SettingsShell.razor) so the
   secondary-nav tabs feel like one screen. Pages drop their ad-hoc page-head + inline
   card padding/width and just put plain .card blocks in here. */
.settings-body { max-width: 680px; }
.settings-body--wide { max-width: 980px; }
.settings-body--full { max-width: none; }   /* pages with their own wide layout (theme editor) */
.settings-body > .card { padding: 20px; }
.settings-body > .card + .card { margin-top: 14px; }
.settings-body > .callout { margin-bottom: 14px; }
.settings-body > p.faint { max-width: 72ch; margin-top: -4px; }
.settings-general-card { overflow: visible; }

/* The Settings hub (/settings, SettingsHubPage): one card per section, each page a row with its one-line summary. */
.settings-hub-search { max-width: 480px; margin: 0 0 16px; }
.settings-hub-search input { width: 100%; }
.settings-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; align-items: start; }
.settings-hub-section { padding: 16px 18px; }
.settings-hub-section h2 { font-size: 14px; margin: 0 0 8px; }
.settings-hub-list { list-style: none; margin: 0; padding: 0; }
.settings-hub-list li { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.settings-hub-list li:first-child { border-top: 0; padding-top: 2px; }
.settings-hub-label { display: block; font-weight: 650; font-size: 13.5px; }
.settings-hub-label--greyed { color: var(--ink-faint); }
.settings-hub-summary { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.settings-hub-status { display: block; font-size: 12.5px; color: var(--ink); margin-top: 2px; }
.settings-hub-foot { margin-top: 14px; }
/* A settings page shown read-only (Getting paid for an Accountant): label above value. */
.settings-readonly-list { margin: 0; display: grid; grid-template-columns: minmax(0, 14em) 1fr; gap: 8px 16px; }
.settings-readonly-list dt { color: var(--ink-soft); font-size: 12.5px; }
.settings-readonly-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .settings-readonly-list { grid-template-columns: 1fr; gap: 2px; } .settings-readonly-list dd { margin-bottom: 8px; } }
/* A module's "Settings" tab (slice 8): last in the module's list, set a little apart from its pages. */
.app-nav-subitem--settings { margin-top: 4px; opacity: 0.85; }
.settings-hub-back { display: inline-block; margin-bottom: 6px; font-size: 12.5px; }

/* <Feature> in the GreyedUpsell state — visible but not usable, with a way-in hint
   (AccessMap: e.g. a non-VAT business seeing Tax codes / the VAT reporting basis). */
.feature-greyed { position: relative; }
.feature-greyed .feature-greyed-body { opacity: 0.45; pointer-events: none; user-select: none; }
.feature-greyed .feature-greyed-hint {
    margin: 6px 0 0; font-size: 12px; color: var(--ink-faint);
    display: flex; gap: 6px; align-items: baseline;
}
.feature-greyed .feature-greyed-hint::before { content: "🔒"; font-size: 11px; }

/* Plan / add-on rows — the onboarding "Choose your plan" step and Billing & plan. */
.plan-line {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 14px 16px; margin-bottom: 10px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.plan-line.picked { border-color: var(--brand-red); box-shadow: 0 0 0 3px var(--brand-red-soft); }
.plan-line-name { font-weight: 700; font-size: 13.5px; }
.plan-line-price { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.settings-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }
.field-with-action { display: flex; align-items: center; gap: 8px; }
.field-with-action > input { min-width: 0; }
.settings-value-button {
    min-height: var(--control-height); height: var(--control-height); display: flex; align-items: center;
    justify-content: space-between; gap: 10px; text-align: left; cursor: pointer;
}
.settings-value-button:hover { border-color: var(--brand-red); }
.settings-value-button:focus-visible { outline: 2px solid var(--brand-red-wash); border-color: var(--brand-red); }
.settings-value-action { color: var(--brand-red); font-size: 11.5px; font-weight: 700; }
.settings-preference {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    margin: 20px 0; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface-sunk);
}
.settings-preference-title { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.settings-preference-copy { max-width: 50ch; margin-top: 3px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.settings-card-title { font-size: 13.5px; font-weight: 700; line-height: 1.35; margin: 0 0 8px; }
.settings-subsection {
    margin: 20px 0; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface-sunk);
}
.settings-subsection-title { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.settings-subsection-copy { max-width: 50ch; margin: 3px 0 12px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.settings-preference-control { align-self: center; min-width: 112px; justify-content: flex-end; }
.settings-preference-control.check-field { padding: 0; }
.mail-emails-lede { margin: 0; font-size: 12.5px; }
.mail-emails-card { scroll-margin-top: 16px; }
/* The card is a wrapper round the shared EmailWordingTable card since slice 3, so it takes the settings card gap itself. */
.settings-body > .card + .mail-emails-card { margin-top: 14px; }
.mail-emails-card:focus { outline: none; }
.settings-context-note { margin: 14px 0 0; color: var(--ink-faint); font-size: 11.5px; line-height: 1.45; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* Field width modifiers — the settings pages' recurring one-off inline max-widths. */
.field--narrow { max-width: 180px; }
.field--small { max-width: 240px; }
.field--full { grid-column: 1 / -1; }
.field--xs { max-width: 150px; }
.field--md { max-width: 200px; }
.field--lg { max-width: 260px; }

/* Full Payroll keeps a live setup-health surface after onboarding, instead of ending in
   a confirmation-only page with nowhere to maintain the settings that made it ready. */
.payroll-setup-message, .payroll-setup-card { max-width: 780px; margin-bottom: 16px; }
.payroll-setup-card { padding: 18px; }
.section-heading.payroll-setup-heading { align-items: flex-start; }
.payroll-setup-heading p, .payroll-setup-card .section-heading p { margin: 3px 0 0; font-size: 12.5px; }
.payroll-setup-summary {
    flex: none; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.payroll-setup-summary.is-ready { color: var(--ok-ink); background: var(--ok-wash); }
.payroll-setup-summary.needs-attention { color: var(--warn-ink); background: var(--warn-wash); }
.payroll-setup-list { border-top: 1px solid var(--line-soft); }
.payroll-setup-row {
    display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center;
    gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft);
}
.payroll-setup-row:last-child { border-bottom: 0; padding-bottom: 0; }
.payroll-setup-mark {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    font-size: 12px; font-weight: 800;
}
.payroll-setup-row.is-ready .payroll-setup-mark { color: var(--ok-ink); background: var(--ok-wash); }
.payroll-setup-row.needs-attention .payroll-setup-mark { color: var(--warn-ink); background: var(--warn-wash); }
.payroll-setup-copy { min-width: 0; }
.payroll-setup-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.payroll-setup-advisory {
    padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px;
    color: var(--ink-faint); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
@media (max-width: 640px) {
    .payroll-setup-row { grid-template-columns: 24px minmax(0, 1fr); align-items: start; }
    .payroll-setup-row > .btn { grid-column: 2; justify-self: start; }
}
.settings-numbering-card { overflow: visible; }
.numbering-format { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.numbering-heading { margin-bottom: 14px; }
.numbering-heading p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }
.numbering-format-fields { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; align-items: end; gap: 12px 20px; }
.numbering-year-option { min-height: var(--control-height); padding-bottom: 0; }
.numbering-groups { display: grid; }
.numbering-group { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.numbering-group:last-child { border-bottom: 0; padding-bottom: 2px; }
.numbering-group-heading { margin-bottom: 12px; }
.numbering-group-heading h2 { font-size: var(--type-section); line-height: var(--leading-heading); }
.numbering-prefix-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.numbering-sample { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; }
.numbering-sample span { color: var(--ink-faint); font-size: 11.5px; }
.numbering-sample strong { color: var(--ink); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cash-line-actions { display: flex; align-items: center; justify-content: center; min-height: var(--control-height); }
.line-remove-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: var(--control-height); padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink-faint); cursor: pointer;
}
.line-remove-btn svg { width: 16px; height: 16px; }
.line-remove-btn:hover, .line-remove-btn:focus-visible {
    border-color: var(--danger-line); background: var(--danger-wash); color: var(--danger-ink);
}
@media (max-width: 640px) {
    .numbering-format-fields, .numbering-prefix-grid { grid-template-columns: 1fr; }
}

/* Compact operational control bars. */
.compact-page-head { margin-bottom: 12px; }
.compact-page-head h1 { margin: 0; }
.ledger-toolbar, .run-control-bar {
    display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.ledger-list-toolbar {
    margin-bottom: 14px; padding: 12px;
    border: 1px solid var(--line-soft); border-radius: 10px;
    background: var(--surface-sunk);
}
.ledger-list-toolbar .list-toolbar-row { align-items: center; }
.ledger-list-toolbar .list-search { width: min(360px, 100%); }
.ledger-list-toolbar .list-toolbar-filters { align-items: center; gap: 8px; }
.ledger-toolbar .search-input { width: min(360px, 100%); }
.ledger-zero-toggle {
    align-self: auto; min-height: var(--control-height); padding: 0 12px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); white-space: nowrap;
}
.ledger-as-at {
    display: flex; align-items: center; gap: 0; height: var(--control-height);
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink-soft); overflow: hidden;
}
.ledger-as-at .field-label { margin: 0; padding: 0 10px 0 12px; white-space: nowrap; }
.ledger-as-at .field-input {
    width: 150px; height: calc(var(--control-height) - 2px); padding: 0 9px;
    border: 0; border-left: 1px solid var(--line-soft); border-radius: 0; background: transparent;
}
.ledger-as-at .field-input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--brand-red-wash); }
.bill-entry-page-head { align-items: center; margin-bottom: 18px; }
.bill-entry-page-head h1 { margin-bottom: 2px; }
.bill-entry-card { padding: 20px; margin-bottom: 16px; }
.compact-field { min-width: 190px; max-width: 210px; }
.run-control-bar { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.analytics-filter-actions { justify-content: flex-end; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: 15px; }
@media (max-width: 640px) {
    .list-search { flex-basis: 100%; }
    .list-toolbar-advanced { grid-template-columns: 1fr 1fr; }
    .cashbook-list-toolbar .list-toolbar-filters { flex: 1 1 100%; width: 100%; }
    .cashbook-list-toolbar .cashbook-contact, .cashbook-list-toolbar .cashbook-funds { width: 100%; }
    .cashbook-date-range { width: 100%; }
    .cashbook-date-range .field-input { flex: 1; width: 0; }
    .document-list-toolbar .document-status, .inventory-list-toolbar .inventory-filter { width: 100%; }
    .ledger-toolbar, .run-control-bar { align-items: stretch; }
    .ledger-zero-toggle, .ledger-as-at { width: 100%; }
    .ledger-as-at { justify-content: space-between; }
    .ledger-as-at .field-input { flex: 1; width: 0; }
    .ledger-list-toolbar .list-toolbar-filters { width: 100%; align-items: stretch; }
    .settings-form-grid { grid-template-columns: 1fr; }
    .settings-preference { align-items: flex-start; flex-direction: column; }
    .settings-preference-control { justify-content: flex-start; }
    .theme-manager-main, .theme-manager-actions { align-items: stretch; }
    .theme-manager-select, .theme-manager-actions { width: 100%; max-width: none; }
    .theme-manager-actions .btn { flex: 1; justify-content: center; }
    .theme-assignments { grid-template-columns: 1fr; }
}

/* One cross-browser contract for every dropdown. Native Safari selects can ignore
   vertical padding and collapse to their intrinsic 20px height, so size and arrow
   are explicit instead of relying on browser appearance. */
select:not([multiple]):not([size]) {
    appearance: none;
    -webkit-appearance: none;
    min-height: var(--control-height);
    height: var(--control-height);
    padding-top: 0 !important;
    padding-right: 34px !important;
    padding-bottom: 0 !important;
    line-height: 1.2;
    background-image: var(--select-caret);
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

/* Reports catalogue: clear page and category spacing without changing other hubs. */
.reports-home { padding: 8px 8px 24px; }
.reports-home-header { margin-bottom: 32px; }
.reports-home-header h1 { margin: 0 0 8px; font-size: var(--type-page-title); line-height: 1.3; }
.reports-home-header p { margin: 0; color: var(--ink-soft); font-size: var(--type-helper); line-height: 1.6; }
.reports-home .reports-group-heading { margin: 28px 0 12px; font-size: var(--type-section-title); font-weight: 600; line-height: 1.5; }
.reports-home .reports-group-subheading { margin: 18px 0 8px; color: var(--ink-soft); font-size: var(--type-helper); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.reports-card { display: block; padding: 20px; color: inherit; text-decoration: none; }
.reports-card:hover { border-color: var(--line-strong); background: var(--surface-sunk); }
.reports-card:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.reports-card-title { margin-bottom: 6px; font-size: var(--type-body); font-weight: 600; line-height: 1.5; }
.reports-card-description { color: var(--ink-soft); font-size: var(--type-helper); line-height: 1.6; }
.reports-home-hint { margin-top: 28px; }
@media (max-width: 767px) {
    .reports-home { padding: 4px 0 16px; }
    .reports-home-header { margin-bottom: 24px; }
    .reports-home .reports-group-heading { margin-top: 24px; }
    .reports-card { padding: 16px; }
}

/* Cross-module alignment for compact operational controls. These bars shrink to
   their contents on wide screens, keep labelled fields and actions on one baseline,
   and expand only when the viewport needs a stacked layout. */
.compact-control-bar {
    width: fit-content;
    max-width: 100%;
}
.compact-control-bar > .field { flex: 0 0 auto; }
.compact-control-bar .field-input {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-block: 0;
}
.compact-control-bar > .btn {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-block: 0;
}
.compact-control-date { width: 190px; }
.compact-control-party { width: 190px; }

/* Record-page exports stay as one atomic control group. The group itself may move
   to a new header row, but its format selector and download button never split. */
.payroll-record-actions {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.payroll-record-actions > .btn,
.payroll-extract-action > .btn {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-block: 0;
}
.payroll-extract-action {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}
.payroll-extract-format { width: 150px; }

/* Focused create/edit forms use one readable width rather than a page-specific
   inline maximum, while remaining left-aligned with their page heading. */
.focused-form-card {
    width: min(100%, 760px);
    padding: 20px;
}
.focused-form-card input.field-input,
.focused-form-card select.field-input {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-block: 0;
}
.leave-request-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.leave-request-form > .field,
.leave-request-form > .field-row { margin: 0; }
.leave-request-dates {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 140px;
    align-items: end;
    gap: 12px;
}
.leave-request-dates > .field { min-width: 0; }
.leave-request-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}

@media (max-width: 1100px) {
    .payroll-record-head { align-items: stretch; flex-direction: column; }
    .payroll-record-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    .compact-control-bar { width: 100%; }
    .compact-control-bar > .field,
    .compact-control-date,
    .compact-control-party { width: 100%; max-width: none; }
    .compact-control-bar > .btn { justify-content: center; width: 100%; }
    .payroll-record-actions { align-items: stretch; flex-direction: column; }
    .payroll-record-actions > .btn { justify-content: center; width: 100%; }
    .payroll-extract-action { width: 100%; }
    .payroll-extract-format { flex: 1; width: auto; min-width: 0; }
    .leave-request-dates { grid-template-columns: 1fr; }
    .leave-request-actions > .btn { flex: 1; justify-content: center; }
}

/* Payroll task hubs use the shared tile geometry but keep comfortable spacing on wide pages. */
.payroll-hub-grid { max-width: 960px; }

/* UX-13: setup and administration reflow, readable fields and persistent navigation. */
.ux-setup .wizard-foot { height: auto; min-height: 64px; padding-block: 12px; gap: 12px; flex-wrap: wrap; }
.ux-setup .wizard-foot > .row-inline { flex-wrap: wrap; justify-content: flex-end; }
.ux-setup .wizard-body.center { align-items: flex-start; }
.ux-setup .steps { overflow-x: auto; flex-shrink: 0; }
.ux-setup .step { flex-shrink: 0; }

.access-row { flex-wrap: wrap; overflow-wrap: anywhere; }
.pc .pc-field label, .pc .pc-table .tr.th { color: var(--pc-ink-soft); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: normal; }
.pc .pc-table .tr small { color: var(--pc-ink-soft); font-size: 13px; }
/* The shared .faint utility used the customer app's --ink-faint (then #8A8F98, ~3.2:1 on white — since darkened
   to clear 4.5:1); the console's pale panels keep their own stronger muted tone. */
.pc .faint { color: var(--pc-ink-soft); }
.pc :is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--pc-accent); outline-offset: 3px; }
@media (max-width: 900px) {
    .pc-user { overflow-wrap: anywhere; min-width: 0; }
    .pc-table .tr.th { display: grid; }
}
@media (max-width: 600px) {
    .ux-setup .wizard-bar { height: auto; min-height: 56px; padding: 12px 16px; flex-wrap: wrap; }
    .ux-setup .wizard-body { padding: 16px; }
    .ux-setup .wizard-card { padding: 20px; }
    .ux-setup .wizard-foot { padding-inline: 16px; }
    .ux-setup .type-grid { grid-template-columns: 1fr; }
    .ux-setup .row-inline { flex-wrap: wrap; }
}

/* Document branding — visual format picker and reorderable content blocks. */
.format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 8px; }
.format-card {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.format-card:hover { border-color: var(--brand-red); }
.format-card.selected { border-color: var(--brand-red); box-shadow: 0 0 0 3px var(--brand-red-soft); }
.format-card > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.format-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.format-blurb { font-size: 11px; color: var(--ink-faint); line-height: 1.4; }

.format-thumb { position: relative; height: 62px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ft-accent { position: absolute; background: var(--brand-fill); }
.ft-logo { position: absolute; width: 18px; height: 14px; border: 1px solid var(--paper-line); border-radius: 3px; background: var(--paper-sunk); }
.ft-title { position: absolute; height: 7px; border-radius: 2px; background: var(--paper-ink); }
.ft-sub { position: absolute; height: 4px; border-radius: 2px; background: var(--paper-rule); }

/* Classic — accent bar across the top, logo right, title left. */
.format-thumb[data-format="project-five"] .ft-accent { top: 0; left: 0; right: 0; height: 3px; }
.format-thumb[data-format="project-five"] .ft-title { top: 14px; left: 10px; width: 44%; }
.format-thumb[data-format="project-five"] .ft-sub { top: 26px; left: 10px; width: 60%; }
.format-thumb[data-format="project-five"] .ft-logo { top: 12px; right: 10px; }

/* Modern — thin accent on the left, logo right, title left. */
.format-thumb[data-format="clean"] .ft-accent { top: 0; left: 0; bottom: 0; width: 3px; }
.format-thumb[data-format="clean"] .ft-title { top: 14px; left: 12px; width: 42%; }
.format-thumb[data-format="clean"] .ft-sub { top: 26px; left: 12px; width: 56%; }
.format-thumb[data-format="clean"] .ft-logo { top: 12px; right: 10px; }

/* Ollama — title and logo above a compact, two-column invoice header. */
.format-thumb[data-format="ollama"] .ft-accent { display: none; }
.format-thumb[data-format="ollama"] .ft-title { top: 10px; left: 10px; width: 34%; }
.format-thumb[data-format="ollama"] .ft-logo { top: 8px; right: 10px; }
.format-thumb[data-format="ollama"] .ft-sub { top: 25px; left: 10px; width: 55%; }
.format-thumb[data-format="ollama"]::before,
.format-thumb[data-format="ollama"]::after {
    content: ""; position: absolute; top: 39px; height: 14px; border-top: 3px solid var(--paper-rule);
    border-bottom: 3px solid var(--paper-rule);
}
.format-thumb[data-format="ollama"]::before { left: 10px; width: 35%; }
.format-thumb[data-format="ollama"]::after { right: 10px; width: 35%; }

/* Centred — short accent bar centre, logo centre above, title centre. */
.format-thumb[data-format="centered"] .ft-accent { top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 3px; }
.format-thumb[data-format="centered"] .ft-logo { top: 8px; left: 50%; transform: translateX(-50%); }
.format-thumb[data-format="centered"] .ft-title { top: 28px; left: 50%; transform: translateX(-50%); width: 46%; }
.format-thumb[data-format="centered"] .ft-sub { top: 40px; left: 50%; transform: translateX(-50%); width: 60%; }

/* Minimal — logo left above, title left, no accent bar (thin underline only). */
.format-thumb[data-format="minimal"] .ft-logo { top: 8px; left: 10px; }
.format-thumb[data-format="minimal"] .ft-title { top: 28px; left: 10px; width: 52%; }
.format-thumb[data-format="minimal"] .ft-sub { top: 40px; left: 10px; width: 64%; }
.format-thumb[data-format="minimal"] .ft-accent { top: 52px; left: 10px; width: 26px; height: 2px; }

/* Plain — no accent, no logo, title left. */
.format-thumb[data-format="plain"] .ft-accent { display: none; }
.format-thumb[data-format="plain"] .ft-logo { display: none; }
.format-thumb[data-format="plain"] .ft-title { top: 16px; left: 10px; width: 48%; }
.format-thumb[data-format="plain"] .ft-sub { top: 30px; left: 10px; width: 66%; }

/* Header builder — reorderable identity lines. */
.header-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.header-line {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
}
.header-line-label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.header-line-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ── Planning — budget editor monthly breakdown ───────────────────────────── */
.budget-monthly td { padding-top: 4px; }
.monthly-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px;
    padding: 10px 12px; margin: 2px 0 8px; background: var(--surface-sunk); border-radius: 8px;
}
.monthly-cell { display: flex; flex-direction: column; gap: 3px; }
.monthly-cell span { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.monthly-cell .field-input { padding: 5px 8px; font-size: 12.5px; }

.planning-pos { color: var(--ok-ink); }
.planning-neg { color: var(--danger-ink); }

/* ── Planning — module layout helpers (PLN-14) ────────────────────────────── */
.planning-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.planning-card { padding: 12px 16px; margin-bottom: 14px; }
.planning-card-pad { padding: 16px; margin-bottom: 14px; }
.planning-hint { font-size: 12px; margin: 2px 0 8px; }
.planning-list { margin: 8px 0 0 18px; font-size: 12.5px; }
.planning-empty { padding: 28px; text-align: center; }
.planning-empty-title { margin: 0 0 6px; }
.planning-empty-copy { margin: 0 0 14px; }
.planning-kpi-label { font-size: 11px; }
.planning-kpi-value { font-size: 22px; font-weight: 800; }
.planning-badge { font-size: 13px; }
.planning-note { font-size: 11.5px; margin-top: 10px; }
.planning-item-row { gap: 8px; margin-bottom: 6px; }
.planning-warn-title { color: var(--warn); }
.planning-sunk { background: var(--surface-sunk); border: 1px solid var(--line); }
.planning-field-narrow { max-width: 170px; }
.planning-field-medium { min-width: 180px; }
.planning-field-amount { max-width: 130px; }
.planning-field-name { min-width: 200px; }
.planning-field-scope { min-width: 220px; }
.planning-field-account { min-width: 260px; }
.planning-meta { font-size: 11px; margin-top: 2px; }
.planning-section-row { background: var(--surface-sunk); font-weight: 700; color: var(--brand-slate); }
.planning-check { gap: 7px; align-items: center; font-size: 12.5px; min-height: var(--control-height); }
/* Budget editor: one readable column, so an account and its amount stay within eyeshot. */
.budget-editor { max-width: 1120px; }
.budget-summary { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 32px; position: sticky; top: 0; z-index: 4; }
.budget-summary-item { display: flex; flex-direction: column; }
.budget-summary-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.budget-summary-note { font-size: 11.5px; margin-left: auto; }
.budget-grid td.num { width: 220px; }
.budget-grid .money-input { max-width: 200px; margin-left: auto; }
.budget-grid tbody tr:not(.planning-section-row):not(.budget-monthly) td { border-bottom-color: var(--line); }
.budget-grid th:first-child { min-width: 180px; }
.budget-grid th.num { min-width: 150px; }
.budget-grid th:last-child { width: 130px; }

/* ── Compliance — statutory tax returns hub ───────────────────────────────── */
.compliance-head { margin-bottom: 20px; }
.compliance-status-strip {
    display: flex; align-items: center; gap: 0; min-height: 84px;
    padding: 16px 20px; margin-bottom: 20px;
}
.compliance-status-item { display: flex; flex-direction: column; gap: 5px; padding: 0 22px; border-right: 1px solid var(--line-soft); }
.compliance-status-item:first-child { padding-left: 0; }
.compliance-status-item:last-child { border-right: 0; }
.compliance-status-label { color: var(--ink-faint); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.compliance-status-item strong { font-size: 15px; }

.compliance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.compliance-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 20px;
    color: inherit; text-decoration: none;
}
.compliance-card:hover { border-color: var(--line-strong); background: var(--surface-sunk); }
.compliance-card:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.compliance-card-icon {
    flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
    color: var(--brand-red); background: var(--brand-red-wash); border-radius: 10px;
}
.compliance-card-icon svg { width: 22px; height: 22px; }
.compliance-card-body { flex: 1 1 auto; min-width: 0; }
.compliance-card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--type-body); font-weight: 650; line-height: 1.4; }
.compliance-card-copy { color: var(--ink-soft); font-size: var(--type-helper); line-height: 1.55; margin-bottom: 10px; }
.compliance-card-meta { display: flex; align-items: center; gap: 8px; }
.compliance-card-meta .faint { font-size: 12px; }
.compliance-card-arrow { flex: 0 0 auto; color: var(--ink-faint); display: grid; place-items: center; margin-top: 2px; transition: color .15s ease, transform .15s ease; }
.compliance-card-arrow svg { width: 18px; height: 18px; }
.compliance-card:hover .compliance-card-arrow { color: var(--brand-red); transform: translateX(2px); }
.compliance-footnote { margin-top: 20px; }

@media (max-width: 767px) {
    .compliance-status-strip { flex-wrap: wrap; row-gap: 14px; padding: 14px 16px; }
    .compliance-status-item { padding: 0 14px; }
    .compliance-status-item:first-child { padding-left: 0; }
    .compliance-card { padding: 16px; }
}

/* ============================================================================
   Two-factor gate (G-01)
   ----------------------------------------------------------------------------
   Replaces the whole shell when the signed-in account still owes a second
   factor, so it must stand on its own with no chrome around it. Sits on the
   sunk surface with the same 1px hairline + soft shadow as the auth cards, so
   it reads as "the app, but stopped" rather than an error page.
   ========================================================================== */
.two-factor-gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background: var(--surface-sunk);
}
.two-factor-gate-card {
    width: 100%;
    max-width: 520px;
    padding: 30px 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(20, 24, 29, .07), 0 12px 32px rgba(20, 24, 29, .06);
}
.two-factor-gate-card .support-ribbon-tag {
    display: inline-block;
    margin-bottom: 14px;
}
.two-factor-gate-card h1 {
    margin: 0 0 12px;
    font-size: 21px;
    line-height: 1.3;
    color: var(--ink);
}
.two-factor-gate-card p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-soft);
}
.two-factor-gate-card .btn { margin-top: 8px; }

/* Opening-balance corrections use the same disciplined form/table rhythm as the journal
   editor, but remain a focused Settings workflow with a bounded reading width. */
.opening-adjust-stack { display: grid; gap: 16px; width: 100%; max-width: 940px; min-width: 0; }
.opening-adjust-card { width: 100%; max-width: 100%; min-width: 0; padding: 0; overflow: visible; }
.opening-adjust-meta {
    display: grid; grid-template-columns: 180px minmax(320px, 1fr); align-items: end;
    gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft);
}
.opening-adjust-date { max-width: 180px; }
.opening-adjust-history-scroll {
    width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain;
}
.opening-adjust-grid { min-width: 680px; }

.opening-adjust-grid .field-input { min-height: var(--control-height); }

.opening-adjust-line .icon-btn:disabled { cursor: not-allowed; opacity: .35; }

.opening-adjust-add { color: var(--brand-red); }
.opening-adjust-balance { color: var(--warn-ink); font-size: 11.5px; font-weight: 700; text-align: right; }
.opening-adjust-balance.balanced { color: var(--ok-ink); }
.opening-adjust-message { padding: 0 20px; }
.opening-adjust-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 20px; border-top: 1px solid var(--line-soft);
}
.opening-adjust-history { padding: 18px 20px; }
.opening-adjust-history .settings-card-title { margin-bottom: 10px; }
.opening-adjust-history-grid { min-width: 680px; }

/* General settings: labels can wrap, but every control still begins on the same baseline
   within its grid row. The screenshot's employee-retention label is the tallest case. */
.settings-primary-grid { gap: 20px 16px; align-items: end; }
.settings-primary-grid > .field { justify-content: flex-end; }
.settings-primary-grid > .field > .field-label {
    display: flex; align-items: flex-end; min-height: 31px; line-height: 1.35;
}
.settings-primary-grid > .field > select,
.settings-primary-grid > .field > input,
.settings-primary-grid > .field > .field-with-action,
.settings-primary-grid > .field > .settings-value-button { min-height: var(--control-height); }

/* Business details is one model saved in one transaction. Repeat the page-level action after
   the lower cards so users do not have to return to the first card to commit those changes. */
.settings-page-save-card {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    border-color: var(--line-strong); background: var(--surface-sunk);
}
.settings-page-save-card .settings-preference-copy { margin-top: 3px; }
.settings-page-save-card .btn { flex: 0 0 auto; }

@media (max-width: 680px) {
    .opening-adjust-head { align-items: flex-start; }
    .opening-adjust-meta { grid-template-columns: 1fr; padding: 16px; }
    .opening-adjust-date { max-width: none; }
    .opening-adjust-actions { padding: 14px 16px; }
    .opening-adjust-actions .btn { flex: 1; justify-content: center; }
    .opening-adjust-history { padding: 16px; }
    .settings-primary-grid > .field > .field-label { min-height: 0; }
    .settings-page-save-card { align-items: stretch; flex-direction: column; }
    .settings-page-save-card .btn { justify-content: center; width: 100%; }
}

/* Accounting report section summaries keep the section label and its subtotal as one
   visual unit. The softer ink remains secondary without losing readability. */
.report-section-summary {
    background: var(--surface-sunk);
    color: var(--ink-soft);
    font-style: italic;
}
.report-section-summary .num { color: inherit; font-style: inherit; }

/* ── Jobs ──────────────────────────────────────────────────────────────────── */
/* JOB-12: the Jobs pages share these small layout tokens instead of repeating
   inline card padding / heading sizes / toolbar spacing. */
.job-card { padding: 16px 20px; margin-bottom: 16px; }
.job-status-actions { padding: 14px 16px; margin-bottom: 14px; }
.job-card-header { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 10px; }
.job-card-header.mb { margin-bottom: 12px; }
.job-card-title { margin: 0 0 4px; font-size: 15px; }
.job-card-sub { font-size: 12px; }
.job-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.job-toolbar.mb { margin-bottom: 10px; }
.job-reason { flex: 1 1 260px; max-width: 360px; }   /* sits on the action row, after the buttons it qualifies */
.job-field { max-width: 180px; }
.job-editor-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:focus-visible { outline: 3px solid var(--brand-red-wash); outline-offset: -3px; }

/* Bank-detail change confirmed by its own author, as the only person able to: the callout lays its children out in a
   row, so the prompt is one block that stacks itself. */
.bank-confirm-self { flex: 1; min-width: 0; }
.bank-confirm-actions { justify-content: flex-end; margin-top: 10px; }

.period-close-cash-note { margin: -6px 0 14px; }

/* ── Utilities ─────────────────────────────────────────────────────────────────────────────
   Small named replacements for one-off inline styles on the payroll pages (PAY-40). They are !important on purpose:
   an inline style beats every normal rule, and these must keep doing so — the one place that still out-ranks them is
   the mobile `.field-row > .field { max-width:none !important }`, exactly as it out-ranked the inline style. */
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fs-11 { font-size: 11px !important; }
.fs-115 { font-size: 11.5px !important; }
.fs-12 { font-size: 12px !important; }
.fs-16 { font-size: 16px !important; }
.fs-18 { font-size: 18px !important; }
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: 4px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-14 { margin-top: 14px !important; }
.mt-16 { margin-top: 16px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.ml-6 { margin-left: 6px !important; }
.lead { margin: 6px 0 14px !important; }
.lead-sm { margin: 6px 0 12px !important; }
.lead-flush { margin: 0 0 10px !important; }
.subhead { font-size: 13px !important; margin: 18px 0 6px !important; }
.mw-120 { max-width: 120px !important; }
.mw-140 { max-width: 140px !important; }
.mw-180 { max-width: 180px !important; }
.mw-200 { max-width: 200px !important; }
.mw-220 { max-width: 220px !important; }
.mw-240 { max-width: 240px !important; }
.mw-280 { max-width: 280px !important; }
.mw-520 { max-width: 520px !important; }
.mw-720 { max-width: 720px !important; }
.gap-8 { gap: 8px !important; }
.flex-2 { flex: 2 !important; }
.self-end { align-self: flex-end !important; }
.items-end { align-items: flex-end !important; }
.text-right { text-align: right !important; }
.jc-between { justify-content: space-between !important; }
.p-18 { padding: 18px !important; }
.color-inherit { color: inherit !important; }
/* The same family, grown for the Settings pages (UI-13). A spacing or type value used once or twice stays a utility; a
   combination that means something (a wizard card's intro line, a table's column template) gets a named class below. */
.fw-650 { font-weight: 650 !important; }
.fs-125 { font-size: 12.5px !important; }
.fs-13 { font-size: 13px !important; }
.lh-16 { line-height: 1.6 !important; }
.tabular { font-variant-numeric: tabular-nums !important; }
.mt-6 { margin-top: 6px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-18 { margin-top: 18px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-6 { margin-bottom: 6px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-14 { margin-bottom: 14px !important; }
.ml-8 { margin-left: 8px !important; }
.p-0 { padding: 0 !important; }
.gap-6 { gap: 6px !important; }
.gap-10 { gap: 10px !important; }
.gap-12 { gap: 12px !important; }
.gap-16 { gap: 16px !important; }
.flex-1 { flex: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.jc-end { justify-content: flex-end !important; }
.jc-start { justify-content: flex-start !important; }
.jc-center { justify-content: center !important; }
.items-start { align-items: flex-start !important; }
.items-center { align-items: center !important; }
.items-baseline { align-items: baseline !important; }
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.pointer { cursor: pointer !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

/* The same family, grown again for the rest of the app (UI-13, 2026-09-29): every static inline style whose every
   declaration had a one-value utility moved to it. A shorthand keeps its values in the name (m-0-0-12 is margin: 0 0 12px),
   a colour takes its token's name (c-faint is var(--ink-faint)). Same !important rule as above. */
.c-danger { color: var(--danger-ink) !important; }
.c-ink { color: var(--ink) !important; }
.c-ok { color: var(--ok-ink) !important; }
.c-pc-danger { color: var(--pc-danger) !important; }
.c-pc-ink { color: var(--pc-ink) !important; }
.c-pc-ink-soft { color: var(--pc-ink-soft) !important; }
.c-red { color: var(--brand-red) !important; }
.c-soft { color: var(--ink-soft) !important; }
.c-warn { color: var(--warn) !important; }
.d-grid { display: grid !important; }
.d-inline-block { display: inline-block !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-col { flex-direction: column !important; }
.fs-10 { font-size: 10px !important; }
.fs-14 { font-size: 14px !important; }
.fs-15 { font-size: 15px !important; }
.fs-20 { font-size: 20px !important; }
.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.gap-4 { gap: 4px !important; }
.gap-5 { gap: 5px !important; }
.gap-7 { gap: 7px !important; }
.gap-14 { gap: 14px !important; }
.gap-18 { gap: 18px !important; }
.gap-20 { gap: 20px !important; }
.gap-24 { gap: 24px !important; }
.gap-28 { gap: 28px !important; }
.m-0-0-0-14 { margin: 0 0 0 14px !important; }
.m-0-0-4 { margin: 0 0 4px !important; }
.m-0-0-6 { margin: 0 0 6px !important; }
.m-0-0-8 { margin: 0 0 8px !important; }
.m-0-0-10 { margin: 0 0 10px !important; }
.m-0-0-10-18 { margin: 0 0 10px 18px !important; }
.m-0-0-12 { margin: 0 0 12px !important; }
.m-0-0-14 { margin: 0 0 14px !important; }
.m-0-0-16 { margin: 0 0 16px !important; }
.m-4-0-0 { margin: 4px 0 0 !important; }
.m-4-0-0-18 { margin: 4px 0 0 18px !important; }
.m-6-0-0 { margin: 6px 0 0 !important; }
.m-6-0-0-18 { margin: 6px 0 0 18px !important; }
.m-6-0-10 { margin: 6px 0 10px !important; }
.m-6-0-12 { margin: 6px 0 12px !important; }
.m-6-0-14 { margin: 6px 0 14px !important; }
.m-8-0-0 { margin: 8px 0 0 !important; }
.m-8-0-0-18 { margin: 8px 0 0 18px !important; }
.m-8-0-2 { margin: 8px 0 2px !important; }
.m-8-2-0 { margin: 8px 2px 0 !important; }
.m-10-0 { margin: 10px 0 !important; }
.m-10-0-0 { margin: 10px 0 0 !important; }
.m-12-0 { margin: 12px 0 !important; }
.m-12-0-0 { margin: 12px 0 0 !important; }
.m-12-0-6 { margin: 12px 0 6px !important; }
.m-14-0-0 { margin: 14px 0 0 !important; }
.m-16-0-6 { margin: 16px 0 6px !important; }
.m-18-0-6 { margin: 18px 0 6px !important; }
.m-20-0-8 { margin: 20px 0 8px !important; }
.m-22-0-8 { margin: 22px 0 8px !important; }
.m-26-0-8 { margin: 26px 0 8px !important; }
.mb-5 { margin-bottom: 5px !important; }
.ml-4 { margin-left: 4px !important; }
.ml-10 { margin-left: 10px !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.mt-2 { margin-top: 2px !important; }
.mt-3 { margin-top: 3px !important; }
.mt-7 { margin-top: 7px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-22 { margin-top: 22px !important; }
.mw-64 { max-width: 64px !important; }
.mw-110 { max-width: 110px !important; }
.mw-150 { max-width: 150px !important; }
.mw-160 { max-width: 160px !important; }
.mw-170 { max-width: 170px !important; }
.mw-190 { max-width: 190px !important; }
.mw-260 { max-width: 260px !important; }
.mw-300 { max-width: 300px !important; }
.mw-320 { max-width: 320px !important; }
.mw-340 { max-width: 340px !important; }
.mw-360 { max-width: 360px !important; }
.mw-380 { max-width: 380px !important; }
.mw-420 { max-width: 420px !important; }
.mw-480 { max-width: 480px !important; }
.mw-560 { max-width: 560px !important; }
.mw-620 { max-width: 620px !important; }
.mw-640 { max-width: 640px !important; }
.mw-680 { max-width: 680px !important; }
.mw-980 { max-width: 980px !important; }
.mw-full { max-width: 100% !important; }
.ov-hidden { overflow: hidden !important; }
.ov-visible { overflow: visible !important; }
.p-0-18-14 { padding: 0 18px 14px !important; }
.p-1-6 { padding: 1px 6px !important; }
.p-2-8 { padding: 2px 8px !important; }
.p-3-0 { padding: 3px 0 !important; }
.p-4-0 { padding: 4px 0 !important; }
.p-4-7 { padding: 4px 7px !important; }
.p-4-8 { padding: 4px 8px !important; }
.p-5-0 { padding: 5px 0 !important; }
.p-5-8 { padding: 5px 8px !important; }
.p-6-0-2 { padding: 6px 0 2px !important; }
.p-6-10 { padding: 6px 10px !important; }
.p-7-11 { padding: 7px 11px !important; }
.p-8-0 { padding: 8px 0 !important; }
.p-9-0 { padding: 9px 0 !important; }
.p-12-16 { padding: 12px 16px !important; }
.p-12-18 { padding: 12px 18px !important; }
.p-14 { padding: 14px !important; }
.p-14-18 { padding: 14px 18px !important; }
.p-14-18-0 { padding: 14px 18px 0 !important; }
.p-14-20 { padding: 14px 20px !important; }
.p-16 { padding: 16px !important; }
.p-16-20 { padding: 16px 20px !important; }
.p-20 { padding: 20px !important; }
.p-22 { padding: 22px !important; }
.p-24 { padding: 24px !important; }
.pb-8 { padding-bottom: 8px !important; }
.pl-6 { padding-left: 6px !important; }
.pl-16 { padding-left: 16px !important; }
.pl-18 { padding-left: 18px !important; }
.pt-4 { padding-top: 4px !important; }
.self-center { align-self: center !important; }
.tt-upper { text-transform: uppercase !important; }
.w-full { width: 100% !important; }
.ws-nowrap { white-space: nowrap !important; }
.ws-pre-wrap { white-space: pre-wrap !important; }
/* Phone-safe widths (the mobile ratchet in UiConsistencyRatchetTests). Each replaces a fixed inline width or min-width
   that pushed a 375px screen sideways. At desktop width they give exactly the old size; the min() and max-width caps
   only bite when the container is narrower than the old fixed size, so a field shrinks to the screen instead of
   overflowing it. fill-N is "take the free space but at least N", minw-N "at least N", w-N "N wide". */
.w-150 { width: 150px !important; max-width: 100% !important; }
.w-160 { width: 160px !important; max-width: 100% !important; }
.w-220 { width: 220px !important; max-width: 100% !important; }
.minw-150 { min-width: min(150px, 100vw - 48px) !important; }
.minw-200 { min-width: min(200px, 100vw - 48px) !important; }
.minw-220 { min-width: min(220px, 100vw - 48px) !important; }
/* minw-N caps against the screen, not the parent: in a shrink-to-fit parent (a list toolbar's filters) a percentage
   minimum resolves against the final width and stretches the control to fill it. fill-N sits in a flex row, where 100%
   is the row. */
.fill-180 { flex: 1 !important; min-width: min(180px, 100%) !important; }
.fill-200 { flex: 1 !important; min-width: min(200px, 100%) !important; }
.fill-220 { flex: 1 !important; min-width: min(220px, 100%) !important; }
.fill-240 { flex: 1 !important; min-width: min(240px, 100%) !important; }
.fill-280 { flex: 1 !important; min-width: min(280px, 100%) !important; }
.fill-340 { flex: 1 !important; min-width: min(340px, 100%) !important; }
/* A wide register keeps its columns and scrolls inside its own .table-scroll card, never the page. */
.rfx-table { min-width: 640px; }
.rfx-table-wide { min-width: 980px; }

/* The two downloads under a payroll's journal (extract, CINSF file): a small card, its heading line, its buttons. */
.download-card { margin-top: 16px; padding: 14px; }
.download-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.download-card-actions { margin-top: 10px; gap: 8px; }
.leave-request-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ── Employee self-service (/me) ─────────────────────────────────────────────────────────── */
.my-ytd { width: min(100%, 560px); margin-bottom: 16px; }
.my-certificates { margin-top: 16px; padding: 16px 18px; }
.my-bank-card { width: min(100%, 760px); margin-bottom: 16px; padding: 18px; }
.my-bank-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.my-bank-form > .field, .my-bank-form > .field-row { margin: 0; }
.my-bank-actions { justify-content: flex-end; }
.my-bank-pending { justify-content: space-between; align-items: flex-start; gap: 16px; width: min(100%, 760px); }
.my-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; margin: 0 0 12px; }
.my-facts dt { margin: 0 0 3px; color: var(--ink-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.my-facts dd { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.my-card-title { padding: 16px 20px 0; }
.my-card-note { margin: 0; padding: 12px 20px; font-size: 12.5px; }
.leave-balances { margin-bottom: 16px; }
.bank-request { justify-content: space-between; align-items: flex-start; gap: 16px; }
.bank-request-facts { margin: 10px 0; }
.bank-request-actions { flex-shrink: 0; }
/* Deciding one request on its own page: RequestDecision (payroll slice 2.4). */
.request-decision { max-width: 640px; padding: 18px 20px; margin-top: 12px; display: grid; gap: 8px; }
.request-decision-title { font-size: 15px; margin: 0; }
.request-decision-actions { gap: 8px; }
/* An employee's own expense claim in self-service (payroll slice 2.7). */
.my-claim { padding: 18px; margin-top: 12px; }
.my-claim-line { align-items: flex-end; }
.my-claim-total { text-align: right; margin: 12px 0 0; }
.my-claim-actions { justify-content: flex-end; gap: 8px; margin-top: 14px; }
.my-receipts { padding: 18px; margin-top: 12px; }
.my-receipts-head { justify-content: space-between; align-items: center; gap: 12px; }
.my-receipts-head .section-title { margin: 0; }
.my-receipts-add { cursor: pointer; margin: 0; }
.my-receipts-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.my-receipts-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.my-receipts-list .icon-btn { margin-left: auto; }
/* An employee change waiting for approval, on the employee record (payroll slice 2.5). */
.employee-change-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
/* These controls used to be direct grid children (blockified); inside a label wrapper they'd turn inline and add descender space. */
.cash-lines [data-label] > :is(input, textarea, select) { display: block; }
/* The "—" that stands in for Qty on a coded (non-item) line: nothing to label, so it drops out on a phone. */
@media (max-width: 900px) { .cash-qty-none { display: none; } }

/* ── Help (in-app manual) ─────────────────────────────────────────────────────
   Topics are markdown rendered by HelpMarkdown; screens link to them with <HelpLink>.
   Shared by the workspace (/help) and the Operator Console (/platform/help). */
.help-link { font-size: inherit; font-weight: 600; color: var(--brand-red); text-decoration: none; white-space: nowrap; }
.help-link:hover { text-decoration: underline; }
.help-hint { display: inline-flex; position: relative; vertical-align: middle; margin-left: 5px; z-index: 1; }
.help-hint:has(.help-hint-panel) { z-index: 30; }
.help-hint-trigger { display: inline-grid; place-items: center; width: 19px; height: 19px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-soft); font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; cursor: help; }
.help-hint-trigger:hover, .help-hint-trigger:focus-visible { border-color: var(--brand-slate); color: var(--ink); outline-offset: 2px; }
.help-hint-panel { position: absolute; top: 100%; left: 0; width: min(280px, calc(100vw - 32px)); padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); box-shadow: 0 8px 24px rgba(20, 24, 29, .16); color: var(--ink); font-size: 12.5px; font-weight: 400; letter-spacing: normal; line-height: 1.45; text-align: left; text-transform: none; white-space: normal; }
.pc-panel:has(.help-hint) { overflow: visible; }
.help-hint-panel a { display: block; margin-top: 7px; color: var(--brand-red); font-weight: 650; text-decoration: none; }
.help-hint-panel a:hover, .help-hint-panel a:focus-visible { text-decoration: underline; }
.pc-kpi .help-hint-panel { left: auto; right: 0; }
@media (min-width: 901px) { .settings-primary-grid > .field:nth-child(3n) .help-hint-panel { left: auto; right: 0; } }
@media (max-width: 600px) { .help-hint-panel { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; z-index: 100; } }
.help-crumbs { margin: 0 0 4px; font-size: 12px; color: var(--ink-faint); }
.help-crumbs a { color: inherit; }
.help-module-nav { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.help-module-nav a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: var(--type-body); font-weight: 600; text-decoration: none; }
.help-module-nav a:hover, .help-module-nav a:focus-visible { border-color: var(--brand-slate); color: var(--ink); }
.help-group { scroll-margin-top: 16px; }
.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; align-items: start; }
.help-body { padding: 22px 26px; max-width: 78ch; line-height: 1.6; font-size: 14px; color: var(--pc-ink, var(--ink)); }
.help-body h2 { font-size: 16px; margin: 26px 0 8px; scroll-margin-top: 16px; }
.help-body h2:first-child { margin-top: 0; }
.help-body h3 { font-size: 14px; margin: 18px 0 6px; scroll-margin-top: 16px; }
.help-body p { margin: 0 0 12px; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 22px; }
.help-body li { margin: 3px 0; }
.help-body code { font-size: 12.5px; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.help-body pre { margin: 0 0 12px; padding: 12px 14px; overflow-x: auto; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--radius, 8px); }
.help-body pre code { border: 0; background: none; padding: 0; }
.help-body .help-note { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--brand-slate); background: var(--surface-sunk); border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0; font-size: 13px; color: var(--pc-ink-soft, var(--ink-soft)); }
.help-body .help-table { overflow-x: auto; margin: 0 0 12px; }
.help-body table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.help-body th, .help-body td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.help-body th { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--pc-ink-soft, var(--ink-soft)); }
.help-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.help-toc-title { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.help-toc a { color: var(--ink-soft); text-decoration: none; }
.help-toc a:hover { color: var(--ink); text-decoration: underline; }
.help-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.help-group { padding: 16px 18px; }
.help-topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help-topic-list li { display: flex; flex-direction: column; gap: 1px; }
.help-topic-list a { font-weight: 600; }
.help-topic-list .faint { font-size: 12.5px; }
@media (max-width: 900px) {
    .help-layout { grid-template-columns: minmax(0, 1fr); }
    .help-toc { position: static; order: -1; }
    .help-body { padding: 16px; }
}

/* ── Credit notes: applying, un-applying and refunding (INT-04) ─────────────────────────────────
   One panel on an invoice / bill ("Credits") and on a credit note. Rows wrap rather than sit in a grid,
   so the amount box and the Apply button drop under the description on a phone. */
.credit-panel { padding: 16px 20px; margin-bottom: 16px; }
.credit-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 4px; }
.credit-panel-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.credit-summary { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0 4px; font-size: 13px; }
.credit-summary b { font-variant-numeric: tabular-nums; }
.credit-subhead { margin: 14px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; opacity: .75; }
.credit-list { list-style: none; margin: 0; padding: 0; }
.credit-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.credit-item:first-child { border-top: 0; }
.credit-item-main { flex: 1 1 200px; min-width: 0; }
.credit-item-main .faint { display: block; font-size: 12px; }
.credit-item-figure { font-variant-numeric: tabular-nums; }
.credit-item-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.credit-item-action input { width: 120px; }
@media (max-width: 520px) {
  .credit-panel { padding: 14px 16px; }
  .credit-item-action { flex: 1 1 100%; }
  .credit-item-action input { flex: 1 1 100px; width: auto; }
}

/* ── Customer statements ─────────────────────────────────────────────────── */
.statement-customer-filter { width: 280px; max-width: 100%; }
.statement-date { width: 160px; }
.statement-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }

.statement-min { width: 150px; }
.statement-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; }
.statement-empty { padding: 28px; text-align: center; }
.statement-errors { margin: 8px 0 0 18px; font-size: 12.5px; }
.check-col { width: 36px; }
.planning-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; margin: 14px 0; }
.planning-facts dt { font-size: 11px; color: var(--ink-soft); }
.planning-facts dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Planning and Jobs landings — same FY-first rhythm as Dashboard and Payroll.
   Module-specific classes keep the shared card/button contracts unchanged. */
.planning-home .dashboard-year, .jobs-dashboard .dashboard-year { margin-bottom: 12px; }
.planning-home .page-head { margin-bottom: 14px; }
.planning-draft-callout { margin-bottom: 12px; font-size: 12px; }
.planning-draft-callout a { font-weight: 650; }
.planning-home .planning-empty { text-align: left; padding: 25px 28px; }
.planning-home .planning-empty-title { margin-top: 7px; font-size: 20px; }
.planning-home .planning-empty-copy { max-width: 64ch; line-height: 1.5; }
.planning-overview, .jobs-overview { padding: 0; overflow: hidden; }
.planning-overview-main { display: grid; grid-template-columns: minmax(230px, .62fr) minmax(0, 1.38fr); gap: 20px 30px; align-items: center; padding: 20px 24px; }
.planning-overview-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-width: 0; }
.planning-overview-title { margin: 0; font-size: clamp(32px, 3.2vw, 44px); font-weight: 650; line-height: 1.1; letter-spacing: -.03em; overflow-wrap: anywhere; }
.planning-hero-comparison { font-size: 12px; font-weight: 650; }
.planning-overview-baseline { font-size: 12px; color: var(--ink-soft); }
.planning-overview-figures, .jobs-overview-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.planning-overview-figure, .jobs-overview-figures > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 15px 18px; border-right: 1px solid var(--line-soft); }
.planning-overview-figure:last-child, .jobs-overview-figures > div:last-child { border-right: 0; }
.planning-overview-figure strong, .jobs-overview-figures strong { font-size: 20px; line-height: 1.2; font-weight: 650; overflow-wrap: anywhere; }
.planning-overview-figure .faint { font-size: 11px; line-height: 1.4; }
.planning-quick-actions, .jobs-quick-actions { margin: 14px 0 16px; }
.planning-breakdown { padding: 17px 20px; }
.planning-breakdown .dashboard-list-head { margin-bottom: 2px; }
.planning-breakdown .dashboard-list-head h2 { margin: 0; font-size: 14px; }
.planning-period-note { margin: 0 0 14px; font-size: 11px; }
.planning-breakdown .planning-note { margin: 12px 0 0; }
.budget-chart { min-width: 0; }
.budget-chart.embedded h3 { margin: 0 0 3px; font-size: 13px; }
.budget-chart.embedded .chart-note { font-size: 11px; margin-bottom: 14px; }
/* Budget vs actual (BudgetActualChart). HTML laid out in percentages over one plot box, so labels and markers stay
   crisp at any card width; the budget polyline is the only SVG and keeps a 2px stroke however far it is stretched. */
.bac-figure { --bac-axis: 52px; --bac-height: 196px; position: relative; }
.bac-plot { display: grid; grid-template-columns: var(--bac-axis) minmax(0, 1fr); }
.bac-ticks { position: relative; height: var(--bac-height); }
.bac-tick { position: absolute; right: 10px; transform: translateY(-50%); font-size: 11px; line-height: 1; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bac-area { position: relative; height: var(--bac-height); }
.bac-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line-soft); }
.bac-grid.is-zero { border-top-color: var(--line-strong); }
.bac-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.bac-line polyline { fill: none; stroke: var(--chart-budget); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bac-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--bac-cols), minmax(0, 1fr)); }
.bac-col { position: relative; cursor: default; outline: none; }
.bac-col::before { content: ""; position: absolute; inset: -6px 3px; border-radius: var(--radius-sm); background: transparent; transition: background-color .12s ease; }
.bac-col:hover::before, .bac-col:focus-visible::before { background: var(--chart-hover); }
.bac-col:focus-visible::before { box-shadow: inset 0 0 0 2px var(--chart-actual); }
.bac-bar { position: absolute; left: 50%; width: min(56%, 34px); transform: translateX(-50%); background: var(--chart-actual); border-radius: 4px 4px 0 0; min-height: 1px; z-index: 1; }
.bac-bar.is-neg { border-radius: 0 0 4px 4px; }
/* The running month is to date: same hue, hatched, so it never reads as a finished month. */
.bac-col.is-partial .bac-bar { background: repeating-linear-gradient(135deg, var(--chart-actual) 0 4px, var(--chart-actual-soft) 4px 7px); }
.bac-mark { position: absolute; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--chart-budget); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); z-index: 3; }
.bac-tip { position: absolute; top: 2px; z-index: 5; min-width: 178px; padding: 9px 11px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(20, 24, 29, .12); font-size: 12px; line-height: 1.35; opacity: 0; visibility: hidden; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease, visibility .12s; pointer-events: none; }
.bac-col.tip-right .bac-tip { left: calc(50% + 24px); }
.bac-col.tip-left .bac-tip { right: calc(50% + 24px); }
.bac-col:hover .bac-tip, .bac-col:focus-visible .bac-tip { opacity: 1; visibility: visible; transform: none; }
.bac-tip-head { margin-bottom: 6px; font-size: 11px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.bac-tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 7px; padding: 2px 0; white-space: nowrap; }
.bac-tip-row strong { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); }
.bac-tip-row span:last-child { color: var(--ink-faint); }
.bac-key { width: 14px; height: 0; border-top: 2px solid; border-radius: 2px; }
.bac-key-actual { border-top: 8px solid var(--chart-actual); height: 0; border-radius: 2px; }
.bac-key-budget { border-color: var(--chart-budget); }
.bac-tip-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); font-weight: 600; white-space: nowrap; }
.bac-months { display: grid; grid-template-columns: repeat(var(--bac-cols), minmax(0, 1fr)); margin: 8px 0 0 var(--bac-axis); font-size: 11px; color: var(--ink-faint); text-align: center; }
.bac-months span { display: flex; flex-direction: column; align-items: center; line-height: 1.25; min-width: 0; }
.bac-months small { font-size: 10px; color: var(--ink-faint); }
.bac-legend { margin-top: 10px; margin-left: var(--bac-axis, 52px); gap: 16px; color: var(--ink-soft); }
.bac-legend > span { display: inline-flex; align-items: center; }
.bac-swatch-actual { background: var(--chart-actual); }
.bac-swatch-budget { position: relative; display: inline-block; width: 18px; height: 2px; margin-right: 6px; background: var(--chart-budget); border-radius: 2px; }
.bac-swatch-budget::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--chart-budget); transform: translate(-50%, -50%); }
/* The months still to come: the budget only, over a sunk band, so the plan reads as ahead of today, not as a gap. */
.bac-ahead { position: absolute; top: -6px; bottom: -6px; right: 0; background: var(--surface-sunk); border-left: 1px solid var(--line); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.bac-ahead span { position: absolute; top: 4px; left: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-faint); white-space: nowrap; }
.bac-line polyline.is-ahead { stroke-opacity: .55; }
.bac-mark.is-ahead { width: 9px; height: 9px; background: var(--surface); border: 2px solid var(--chart-budget); box-sizing: border-box; }
.bac-col.is-ahead:hover::before, .bac-col.is-ahead:focus-visible::before { background: var(--hover-tint); }
.bac-months span.is-ahead { color: var(--ink-faint); }   /* no opacity: it took the months ahead below AA contrast */
.bac-swatch-budget.is-ahead { opacity: .55; }
.bac-swatch-budget.is-ahead::after { background: var(--surface); border: 2px solid var(--chart-budget); box-sizing: border-box; }
/* A whole year on a phone: the month names shrink and "to date" goes (the hatching and the readout still say it). */
@media (max-width: 560px) {
    .bac-figure { --bac-axis: 44px; }
    .bac-months { font-size: 9.5px; letter-spacing: -.02em; }
    .bac-months small { display: none; }
    .bac-ahead span { display: none; }
}
@media (hover: none) { .bac-col:hover .bac-tip { opacity: 0; visibility: hidden; } .bac-col:focus .bac-tip { opacity: 1; visibility: visible; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bac-col::before, .bac-tip { transition: none; } }
@media (forced-colors: active) { .bac-bar { background: CanvasText; } .bac-mark, .bac-line polyline { background: Highlight; stroke: Highlight; } }

.jobs-overview-main { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); align-items: start; gap: 20px 30px; padding: 20px 24px; }
.jobs-overview-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.jobs-overview-copy .jobs-overview-margin { margin: 6px 0 10px; }
/* Income and cost by job (JobResultChart): name | bars on one shared axis | net, the same three columns in every row
   and in the axis beneath, so the ticks line up with the bars. */
.job-chart { --job-chart-cols: minmax(150px, 1.1fr) minmax(0, 1.5fr) minmax(86px, auto); min-width: 0; }
.job-chart h3 { margin: 0 0 3px; font-size: 13px; }
.job-chart .chart-note { font-size: 11px; margin-bottom: 10px; }
.job-chart-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.job-chart-row { display: grid; grid-template-columns: var(--job-chart-cols); align-items: center; gap: 14px; padding: 7px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: var(--ink); transition: background-color .12s ease; }
.job-chart-row:hover, .job-chart-row:focus-visible { background: var(--chart-hover); color: var(--ink); outline: none; }
.job-chart-row:focus-visible { box-shadow: inset 0 0 0 2px var(--chart-actual); }
.job-chart-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.job-chart-name strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-chart-name .faint { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-chart-bars { position: relative; height: 26px; }
.job-chart-grid { position: absolute; top: -7px; bottom: -7px; width: 0; border-left: 1px solid var(--line-soft); }
.job-chart-grid.is-zero { border-left-color: var(--line-strong); }
.job-chart-bar { position: absolute; height: 11px; border-radius: 0 3px 3px 0; min-width: 1px; }
.job-chart-bar.is-neg { border-radius: 3px 0 0 3px; }
.job-chart-bar.is-income { top: 1px; background: var(--chart-actual); }
.job-chart-bar.is-cost { bottom: 1px; background: var(--chart-budget); }
.job-chart-net { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; }
.job-chart-net small { font-size: 10.5px; font-weight: 400; }
.job-chart-axis { display: grid; grid-template-columns: var(--job-chart-cols); gap: 14px; margin-top: 4px; }
.job-chart-ticks { position: relative; height: 14px; }
.job-chart-ticks span { position: absolute; top: 0; transform: translateX(-50%); font-size: 10.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-chart-ticks span:first-child { transform: none; }
.job-chart-ticks span:last-child { transform: translateX(-100%); }
.job-chart-legend { margin-top: 10px; align-items: center; color: var(--ink-soft); }
.job-chart-legend > span { display: inline-flex; align-items: center; }
.job-chart-swatch-income { background: var(--chart-actual); }
.job-chart-swatch-cost { background: var(--chart-budget); }
.job-chart-more { margin-left: auto; font-size: 11.5px; }
.jobs-overview-value { margin: 6px 0; font-size: clamp(32px, 3.2vw, 44px); font-weight: 650; line-height: 1.1; letter-spacing: -.03em; overflow-wrap: anywhere; }
.jobs-overview-caption { margin: 0 0 7px; font-size: 12px; }
.jobs-overview-margin { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 185px; padding: 12px 15px; background: var(--surface-sunk); border-radius: var(--radius-sm); }
.jobs-overview-margin strong { font-size: 25px; line-height: 1.1; }
.jobs-overview-margin .faint { font-size: 11px; }
.jobs-dashboard-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 14px; }
.jobs-dashboard-panel { min-width: 0; padding: 17px 18px; }
.jobs-dashboard-panel h2 { margin: 0 0 13px; font-size: 14px; }
.jobs-dashboard-panel p { margin: 8px 0; font-size: 12px; line-height: 1.45; }
.jobs-dashboard-number { display: block; font-size: 21px; font-weight: 650; overflow-wrap: anywhere; }
.jobs-dashboard-lower { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; margin-top: 14px; }
.jobs-dashboard-lower .jobs-dashboard-panel { min-height: 120px; }
.jobs-dashboard-lower .jobs-dashboard-panel p + p { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.jobs-recent-list { list-style: none; margin: 0; padding: 0; }
.jobs-recent-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 12px; }
.jobs-recent-list li:first-child { border-top: 0; padding-top: 0; }
.jobs-recent-list .faint { font-size: 11px; }
.jobs-register-title { margin: 22px 0 12px; font-size: 18px; }
@media (max-width: 1050px) {
    .planning-overview-figures, .jobs-overview-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .planning-overview-figure:nth-child(2), .jobs-overview-figures > div:nth-child(2) { border-right: 0; }
    .planning-overview-figure:nth-child(n+3), .jobs-overview-figures > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
    .jobs-dashboard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jobs-dashboard-cards > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .planning-overview-main { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; }
    .jobs-overview-main { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; }
    .job-chart { --job-chart-cols: minmax(0, 1fr) minmax(76px, auto); }
    .job-chart-bars { grid-column: 1 / -1; grid-row: 2; }
    .job-chart-row { row-gap: 6px; }
    .job-chart-axis > span:first-child, .job-chart-axis > span:last-child { display: none; }
    .job-chart-axis { grid-template-columns: minmax(0, 1fr); }
    .jobs-dashboard-cards, .jobs-dashboard-lower { grid-template-columns: minmax(0, 1fr); }
    .jobs-dashboard-cards > :last-child { grid-column: auto; }
}
@media (max-width: 420px) {
    .planning-overview-figures, .jobs-overview-figures { grid-template-columns: minmax(0, 1fr); }
    .planning-overview-figure, .jobs-overview-figures > div { border-right: 0; border-top: 1px solid var(--line-soft); padding: 13px 16px; }
    .planning-overview-figure:first-child, .jobs-overview-figures > div:first-child { border-top: 0; }
    .planning-overview-figure:nth-child(2), .jobs-overview-figures > div:nth-child(2) { border-top: 1px solid var(--line-soft); }
}
.planning-insights { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; margin-top: 14px; }
.planning-insight { min-width: 0; padding: 17px 20px; }
.planning-insight .dashboard-list-head { margin-bottom: 12px; }
.planning-insight h2 { margin: 0; font-size: 14px; }
.planning-insight p { font-size: 12px; line-height: 1.45; }
.planning-insight-note { margin: 12px 0 0; }
.planning-watch-list { list-style: none; margin: 0; padding: 0; }
.planning-watch-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 12px; }
.planning-watch-list li:first-child { border-top: 0; }
.planning-watch-list strong { text-align: right; white-space: nowrap; }
.planning-forecast-value { display: block; margin-top: 6px; font-size: 25px; font-weight: 650; }
@media (max-width: 760px) { .planning-insights { grid-template-columns: minmax(0, 1fr); } }

/* Cash statement (Wave F): money in beside money out, stacked on a narrow screen. */
.cash-statement-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }

/* Payroll directories: calm row hierarchy and direct destinations, including narrow screens. */
.payroll-settings-back { margin: 0 0 20px; font-size: var(--type-body); }
.payroll-directory-search { max-width: 520px; margin-bottom: 20px; }
.payroll-directory-search label { display: block; font-weight: 600; margin-bottom: 6px; }
.payroll-directory-search input { width: 100%; }
.payroll-directory { overflow: hidden; }
.payroll-directory-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.payroll-directory-row:last-child { border-bottom: 0; }
.payroll-directory-row h2, .payroll-directory-support h2 { margin: 0; font-size: var(--type-section-title); font-weight: 600; }
.payroll-directory-row p, .payroll-directory-support p { margin: 6px 0 0; font-size: var(--type-body); }
.payroll-directory-links { display: flex; flex-wrap: wrap; gap: 12px 20px; flex-shrink: 0; max-width: 45%; }
.payroll-directory-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: var(--type-body); font-weight: 600; }
.payroll-directory-support { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px 0; margin-top: 16px; }
.payroll-directory-report { color: var(--ink); text-decoration: none; }
.payroll-directory-report:hover { background: var(--surface-sunk); text-decoration: none; }
.payroll-directory-report:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; }
.payroll-directory-empty { padding: 24px; }
@media (max-width: 700px) {
    .payroll-directory-row, .payroll-directory-support { align-items: flex-start; flex-direction: column; gap: 12px; padding: 18px; }
    .payroll-directory-support { padding-inline: 0; }
    .payroll-directory-links { max-width: 100%; flex-shrink: 1; }
    .payroll-directory-report { flex-direction: row; }
}

/* Focused payroll settings: one editor, one primary save, readable effective summaries. */
.payroll-focused-editor { padding: 24px; margin-bottom: 20px; max-width: 960px; }
.payroll-focused-editor h2, .payroll-policy-row h2 { margin: 0; font-size: var(--type-section-title); }
.payroll-focused-editor h3 { margin: 0 0 12px; font-size: var(--type-body); }
.payroll-focused-editor fieldset { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
.payroll-focused-editor .field { max-width: 480px; margin-bottom: 20px; }
.payroll-focused-editor p { font-size: var(--type-body); }
.payroll-editor-group { margin: 24px 0; }
.payroll-editor-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.payroll-settings-summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.payroll-settings-summary p { margin: 8px 0; }
.payroll-policy-row { display: grid; grid-template-columns: minmax(200px,1fr) minmax(240px,1.3fr) auto; gap: 24px; align-items: center; padding: 24px; border-bottom: 1px solid var(--line); }
.payroll-policy-row:last-child { border: 0; }
.payroll-policy-row p { margin: 8px 0 0; font-size: var(--type-body); }
.payroll-policy-detail { display: flex; flex-direction: column; gap: 8px; font-size: var(--type-body); }
.payroll-policy-note { color: var(--warn-ink); }
.payroll-unavailable { margin: 24px 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.payroll-unavailable summary { font-weight: 600; cursor: pointer; }
.payroll-unavailable-row { display: flex; justify-content: space-between; gap: 16px; max-width: 600px; padding: 12px 0; }
@media (max-width: 800px) {
    .payroll-policy-row { grid-template-columns: 1fr auto; gap: 16px; padding: 18px; }
    .payroll-policy-detail { grid-column: 1 / -1; grid-row: 2; }
    .payroll-focused-editor { padding: 18px; }
}

.payroll-mobile-view { display: none; }
@media (max-width: 700px) {
    .payroll-subnav { display: block; overflow: visible; border-bottom: 0; }
    .payroll-subnav > a { display: none; }
    .payroll-mobile-view { display: flex; flex-direction: column; gap: 6px; font-size: var(--type-body); font-weight: 600; }
    .payroll-mobile-view select { width: 100%; min-width: 0; }
}

.payroll-context-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.payroll-context-details summary { cursor: pointer; font-size: var(--type-body); font-weight: 600; }

/* Payroll leave rules use aligned summaries, with the existing focused modal for editing. */
.payroll-leave-rules { display: grid; }
.payroll-leave-rules .rule-card { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(110px, .8fr) minmax(190px, 1.5fr) auto; align-items: start; gap: 24px; padding: 24px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.payroll-leave-rules .rule-card:last-child { border-bottom: 0; }
.payroll-leave-rules .rule-card h3 { margin-top: 0; }
.payroll-leave-rules .rule-facts { font-size: 14px; }
.payroll-leave-rules .rule-actions { grid-column: 4; grid-row: 1; margin: 0; padding: 0; border: 0; flex-direction: column; align-items: stretch; }
.payroll-leave-rules .rule-actions .btn { flex: none; }
.payroll-leave-rules .rule-card > .faint { grid-column: 1 / -1; font-size: 14px; }
@media (max-width: 1100px) { .payroll-leave-rules .rule-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .payroll-leave-rules .rule-actions { grid-column: auto; grid-row: auto; align-items: start; } }
@media (max-width: 600px) { .payroll-leave-rules .rule-card { grid-template-columns: minmax(0, 1fr); gap: 16px; } .payroll-leave-rules .rule-actions { flex-direction: row; } }

/* Payroll's operational landing: one current-pay card, exceptions and obligations, then recent runs. */
.payroll-home-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.payroll-home-heading h1 { margin:0; }
.payroll-workspace .payroll-overview-title { font-size:clamp(22px,2.5vw,30px); }
.payroll-workspace .payroll-overview-status { font-size:14px; }
.payroll-period-caption { margin:8px 0 0; color:var(--ink-soft); font-size:13px; }
.payroll-obligations, .payroll-recent-list { list-style:none; margin:0; padding:0; }
.payroll-obligations li { border-top:1px solid var(--line-soft); padding:12px 0; }
.payroll-obligations li:first-child { border-top:0; }
.payroll-obligation-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:baseline; gap:8px; }
.payroll-obligations p { margin:6px 0; }
.payroll-obligations .dashboard-figure-link { margin-left:12px; }
.payroll-recent { margin-top:14px; }
.payroll-recent-list li { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(90px,.25fr); gap:16px; align-items:center; padding:14px 0; border-top:1px solid var(--line-soft); }
.payroll-recent-list li > div { display:flex; flex-direction:column; gap:5px; }
.payroll-recent-amount { text-align:right; }
.payroll-home-footer { display:flex; gap:20px; margin-top:16px; flex-wrap:wrap; }
@media (max-width:600px) {
 .payroll-recent-list li { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
 .payroll-recent-list li > div:nth-child(2) { grid-column:1; grid-row:2; align-items:flex-start; }
 .payroll-recent-list .badge { white-space:normal; }
 .payroll-recent-amount { grid-column:2; grid-row:1 / 3; }
 .payroll-workspace .payroll-overview-main > .btn { width:100%; justify-content:center; }
 .payroll-workspace .payroll-section-head { flex-wrap:wrap; }
}

/* Payroll: compact summaries and progressive secondary tools. */
.payroll-section-heading { margin:0; font-size:16px; font-weight:650; }
.payroll-register-tools { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; }
.payroll-tools { margin-bottom:12px; }
.payroll-tools > summary { cursor:pointer; font-weight:600; padding:8px 0; }

.payroll-output-tools { position:relative; }
.payroll-output-tools-body { display:flex; flex-wrap:wrap; gap:8px; padding:12px 0; }
.payroll-output-tools[open] { flex-basis:100%; }

/* Timesheet workspace: selectable register, daily preview and period calendar. */
.ts-selection-layout { display:grid; grid-template-columns:minmax(280px,.8fr) minmax(0,1.2fr); gap:20px; align-items:start; }
.ts-selection-list,.ts-preview { min-width:0; }
.ts-list-heading { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px; padding:16px; border-bottom:1px solid var(--line); }
.ts-list-items { max-height:65vh; overflow:auto; }
.ts-list-item { display:flex; align-items:flex-start; gap:12px; padding:16px; border-bottom:1px solid var(--line); border-left:3px solid transparent; }
.ts-list-item > input { margin-top:4px; flex-shrink:0; }
.ts-list-item.selected { background:var(--surface-sunk); border-left-color:var(--brand-red); }
.ts-list-choice { display:flex; flex-direction:column; gap:8px; text-align:left; width:100%; min-width:0; border:0; background:none; color:var(--ink); cursor:pointer; padding:0; font:inherit; }
.ts-list-name { font-weight:650; overflow-wrap:anywhere; }
.ts-list-status { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; }
.ts-list-status strong { font-variant-numeric:tabular-nums; }
.ts-list-exception { color:var(--warn-ink); font-size:12px; }
.ts-preview { padding:20px; }
.ts-preview-eyebrow { font-size:12px; font-weight:600; color:var(--ink-soft); margin:0 0 16px; }
.ts-preview-head { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:14px; }
.ts-preview-head p { margin:6px 0 10px; }
.ts-preview-totals { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; padding:18px 0; margin:16px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.ts-preview-totals > div { display:flex; flex-direction:column; gap:6px; }
.ts-preview-totals strong { font-size:20px; font-variant-numeric:tabular-nums; }
.ts-preview-table small { display:block; font-size:12px; font-weight:400; margin-top:3px; white-space:normal; }
.ts-preview-table th { text-align:left; }
.ts-preview-table .num { text-align:right; }
.ts-preview-empty { padding:40px 12px; text-align:center; }
.ts-preview-audit { margin:18px 0 0; font-size:12px; }
.ts-editor-toolbar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:18px; }
.ts-view-switch { display:inline-flex; border:1px solid var(--line); border-radius:8px; padding:3px; }
.ts-view-switch [aria-pressed=true] { background:var(--surface-sunk); font-weight:700; }
.ts-calendar-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:20px; align-items:start; }
.ts-calendar { padding:16px; min-width:0; }
.ts-calendar-weekdays,.ts-calendar-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px; }
.ts-calendar-weekdays { text-align:center; color:var(--ink-soft); padding:4px 0 12px; font-size:12px; }
.ts-calendar-day { display:flex; flex-direction:column; align-items:flex-start; gap:10px; min-height:112px; padding:12px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); cursor:pointer; font:inherit; min-width:0; }
.ts-calendar-day > span { font-size:12px; }
.ts-calendar-day strong { font-size:20px; font-variant-numeric:tabular-nums; }
.ts-calendar-day small { font-size:11px; color:var(--ink-soft); }
.ts-calendar-day.off-day { background:var(--surface-sunk); }
.ts-calendar-day.selected { border-color:var(--brand-red); box-shadow:inset 0 0 0 1px var(--brand-red); background:var(--surface-sunk); }
.ts-calendar-note { font-size:12px; margin:16px 0 0; }
.ts-day-editor { padding:18px; min-width:0; }
.ts-day-head { display:flex; flex-direction:column; align-items:flex-start; gap:8px; margin-bottom:18px; }
.ts-day-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.ts-day-fields > div:nth-child(5) { grid-column:1 / -1; }
.ts-day-fields > div:last-child { grid-column:1 / -1; }
.ts-day-fields .field-label { display:block; margin-bottom:6px; }
.ts-day-fields .field-input { width:100%; min-width:0; }
.ts-pattern-preview { margin-bottom:18px; }
@media (max-width:1199px) {
    .ts-calendar-layout { grid-template-columns:minmax(0,1fr); }
    .ts-day-fields { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (max-width:899px) {
    .ts-selection-layout { grid-template-columns:minmax(0,1fr); }
    .ts-list-items { max-height:350px; }
}
@media (max-width:575px) {
    .ts-preview { padding:16px; }
    .ts-preview-totals { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
    .ts-calendar { padding:8px; }
    .ts-calendar-weekdays,.ts-calendar-days { gap:3px; }
    .ts-calendar-day { min-height:82px; padding:8px 3px; gap:8px; border-radius:5px; }
    .ts-calendar-day > span { font-size:10px; }
    .ts-calendar-day strong { font-size:14px; }
    .ts-calendar-day small { font-size:9px; }
    .ts-day-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.ts-register-summary { padding:12px 16px; gap:12px; margin-bottom:12px; }
.ts-register-summary strong { font-size:20px; }
.ts-register-summary small { font-size:11px; }
.ts-register-toolbar .list-toolbar-row { gap:8px; }
.ts-register-toolbar .list-search { flex:1 1 180px; min-width:160px; max-width:none; }
.ts-register-toolbar .list-toolbar-filters { flex:1 1 auto; }
.ts-register-toolbar .ts-status-filter { width:120px; }
.ts-register-toolbar .ts-period-filter { flex:1; min-width:190px; }
@media(max-width:575px) {
    .ts-register-toolbar .list-toolbar-filters { width:100%; }
    .ts-register-toolbar .ts-period-filter { min-width:0; }
    .ts-register-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Payroll worksheets (owner review 2026-09-28): the steps are a slim bar across the top, the work fills the width
   beneath it, and the run's totals sit in a bar under the work instead of a card above it. The pay run, the new-run
   setup and the Timesheets screen share this look. */
.pay-run-title { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.pay-run-title h1 { margin:0; }
.pay-setup-layout { display:grid; gap:14px; }
.pay-stage-content { min-width:0; display:grid; gap:18px; }
.pay-process-rail, .ts-steps { display:flex; align-items:stretch; margin:0; padding:0; list-style:none; border-top:1px solid var(--line); border-bottom:1px solid var(--line); overflow-x:auto; overflow-y:hidden; }
.pay-process-rail button, .ts-steps li { flex:1 1 0; min-width:0; display:flex; align-items:center; gap:10px; padding:10px 12px; border:0; border-bottom:2px solid transparent; background:transparent; text-align:left; color:var(--ink); font:inherit; cursor:pointer; }
.ts-steps li { cursor:default; }
.pay-process-rail button > span:last-child, .ts-steps li > div { min-width:0; }
.pay-process-rail button:hover { background:var(--surface-sunk); }
.pay-process-rail button.selected, .ts-steps li.current { border-bottom-color:var(--brand-red); }
.pay-process-rail button:disabled { opacity:.6; cursor:default; }
.pay-process-rail strong, .pay-process-rail small, .ts-steps li strong, .ts-steps li div > span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pay-process-rail strong, .ts-steps li strong { font-size:var(--type-body); }
.pay-process-rail small, .ts-steps li div > span { color:var(--ink-soft); font-size:12px; margin-top:1px; }
.pay-step-number { flex:0 0 22px; width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:var(--surface-sunk); border:1px solid var(--line); font-size:11.5px; }
.pay-process-rail button.selected .pay-step-number { background:var(--brand-fill); border-color:var(--brand-fill); color:var(--on-fill); }
.pay-process-rail button.done .pay-step-number, .ts-steps li.done .pay-step-number { background:var(--ok-wash); border-color:transparent; color:var(--ok-ink); }
.ts-steps li.done strong { color:var(--ok-ink); }
.ts-steps { margin-bottom:14px; }

/* The Review stage: the people on the run beside the one being worked on ("Whole run" is the exceptions and table). */
.pay-worksheet { display:grid; grid-template-columns:220px minmax(0,1fr); gap:18px; align-items:start; }
.pay-worksheet-main { min-width:0; display:grid; gap:18px; }
.pay-people { position:sticky; top:80px; display:flex; flex-direction:column; gap:2px; min-width:0; }
.pay-people-label { padding:12px 10px 4px; color:var(--ink-soft); font-size:12px; }
.pay-person { display:flex; justify-content:space-between; align-items:center; gap:8px; width:100%; padding:8px 10px; border:0; border-radius:8px; background:transparent; color:var(--ink); font:inherit; font-size:var(--type-body); text-align:left; cursor:pointer; }
.pay-person:hover { background:var(--surface-sunk); }
.pay-person.selected { background:var(--brand-red-wash); }
.pay-person.selected .pay-person-name { color:var(--brand-red); }
.pay-person .num { color:var(--ink-soft); font-variant-numeric:tabular-nums; white-space:nowrap; }
.pay-person-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; }
.pay-person-all .pay-person-name { font-weight:600; }
.pay-person-changed { display:inline-block; width:6px; height:6px; margin-left:6px; border-radius:50%; background:var(--warn-ink); vertical-align:middle; }
.pay-panel-head { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.pay-panel-note { margin:10px 0 0; }
.pay-exceptions { background:var(--surface-sunk); }

/* The run's totals, under the work and kept in view while scrolling. */
.pay-totals-bar { position:sticky; bottom:12px; z-index:5; display:flex; justify-content:space-between; align-items:center; gap:12px 20px; flex-wrap:wrap; padding:10px 16px; background:var(--surface); border:1px solid var(--line-strong); border-radius:10px; box-shadow:0 4px 16px rgba(0,0,0,.06); }
.pay-totals-bar dl, .payslip-figures, .ts-hours-line { display:flex; flex-wrap:wrap; gap:6px 22px; margin:0; }
.pay-totals-bar dl > div, .ts-hours-line > div { display:flex; align-items:baseline; gap:6px; }
.pay-totals-bar dt, .payslip-figures dt, .ts-hours-line dt { color:var(--ink-soft); font-size:12px; }
.pay-totals-bar dd, .payslip-figures dd, .ts-hours-line dd { margin:0; font-variant-numeric:tabular-nums; }

/* One payslip: its figures beside its Save, and pay items added as rows of the items table. */
.payslip-foot { display:flex; justify-content:space-between; align-items:center; gap:14px 20px; flex-wrap:wrap; margin-top:14px; padding-top:12px; border-top:1px solid var(--line-strong); }
.payslip-figures > div { display:flex; flex-direction:column; gap:2px; }
.pay-item-add { position:relative; display:inline-block; margin-top:8px; }
.pay-item-add > summary { list-style:none; border-style:dashed; }
.pay-item-add > summary::-webkit-details-marker { display:none; }
.pay-item-add .row-actions-panel { left:0; right:auto; min-width:230px; }
.pay-item-draft, .pay-item-draft-actions { background:var(--surface-sunk); }

@media(max-width:900px) {
    .pay-worksheet { grid-template-columns:minmax(0,1fr); }
    .pay-people { position:static; flex-direction:row; flex-wrap:wrap; gap:6px; }
    .pay-people-label { display:none; }
    .pay-person { width:auto; border:1px solid var(--line); }
    .pay-totals-bar { position:static; }
}
.pay-focused-action .review-action { grid-template-columns:minmax(0,1fr); border:0; padding:0; }
.pay-focused-action .review-action-num { display:none; }
.pay-setup { display:grid; gap:20px; }
.pay-run-kinds { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.pay-kind { display:grid; gap:6px; padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--surface); text-align:left; color:var(--ink); cursor:pointer; }
.pay-kind.selected { border-color:var(--brand-red); box-shadow:inset 0 0 0 1px var(--brand-red); }
.pay-kind span { color:var(--ink-soft); font-size:13px; }
.pay-setup-body { max-width:900px; }
.pay-employee-picks { border:1px solid var(--line); border-radius:8px; padding:12px; display:grid; gap:10px; max-height:300px; overflow:auto; }
.pay-inclusions { margin:20px 0; }
.pay-inclusions > div { display:flex; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.pay-inclusions dd { margin:0; font-weight:650; }
@media(max-width:575px) {
    .pay-run-kinds { grid-template-columns:minmax(0,1fr); }
}
.pay-employee-heading { display:flex; align-items:start; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.pay-calculation { border:1px solid var(--line); padding:12px 16px; border-radius:8px; }
.pay-calculation summary { cursor:pointer; font-weight:600; }
.pay-calculation dd { white-space:nowrap; }
.pay-stage-content .payslip-editor { padding:0; }
.pay-stage-content [hidden] { display:none; }
.pay-process-nav { min-width:0; }
.pay-stage-select { display:none; }
@media(max-width:767px) { .pay-process-nav .pay-process-rail { display:none; } .pay-stage-select { display:block; } }
h2.review-action-title { margin:0; }
.pay-stage-content > .card { min-width:0; }
.pay-stage-content:focus { outline:none; }

/* Payroll employee records: saved summaries with one focused editor. */
.payroll-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.payroll-record-heading h2 { margin: 0; font-size: 16px; }
.payroll-record-summary { margin: 12px 0 0; }
.payroll-record-summary > div { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.payroll-record-summary dt { color: var(--ink-soft); }
.payroll-record-summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.payroll-record-fields { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.employee-section-select { display: none; }
@media (max-width: 767px) {
    .employee-section-tabs { display: none; }
    .employee-section-select { display: block; padding: 16px 18px; border-bottom: 1px solid var(--line); }
    .payroll-record-summary > div { grid-template-columns: 1fr; gap: 4px; }
}

/* Who a deduction is paid to, under the GL account and amount columns of the pay items table (payroll slice 3.4b). */
.deduction-payee { grid-column: span 2; }

/* Payroll dashboard: posted employer cost first, current pay below, with an adaptive work list. */
.payroll-cost-summary { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.6fr); padding: 0; margin-bottom: 16px; }
.payroll-cost-ytd { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; padding: 24px; border-right: 1px solid var(--line); min-width: 0; }
.payroll-cost-ytd .dashboard-hero-value { margin: 4px 0; font-size: clamp(28px, 3vw, 42px); overflow-wrap: anywhere; }
.payroll-cost-ytd .faint { font-size: 12px; }
.payroll-cost-ytd .dashboard-figure-link { margin-top: 12px; }
.payroll-cost-chart { padding: 22px 24px 18px; min-width: 0; }
.payroll-cost-chart-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.payroll-cost-chart-heading h2 { margin: 0; font-size: 14px; }
.payroll-cost-chart-heading .faint { font-size: 12px; }
.payroll-cost-chart .spark-plot { height: 132px; }
.payroll-cost-chart .spark-bar { max-width: 38px; }
.payroll-cost-chart-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 11px; color: var(--ink-faint); }
.payroll-workspace .payroll-overview-main { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px; }
.payroll-workspace .payroll-overview-title { font-size: clamp(22px, 2.1vw, 28px); }
.payroll-current-net { display: flex; flex-direction: column; gap: 6px; padding-left: 24px; border-left: 1px solid var(--line); min-width: 0; }
.payroll-current-net strong { font-size: 26px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.payroll-current-net .is-empty { font-size: 16px; }
.payroll-current-net .faint { font-size: 12px; }
.payroll-workspace .payroll-overview-figures { display: flex; flex-wrap: wrap; gap: 12px 30px; padding: 12px 24px; }
.payroll-workspace .payroll-overview-figure { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; padding: 0; border: 0; }
.payroll-workspace .payroll-overview-figure strong { font-size: 13px; }
.payroll-workspace .payroll-overview-figure .dashboard-figure-link { margin-top: 0; }
.payroll-all-clear { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: 12px; color: var(--ok-ink); }
.payroll-work-list { display: grid; gap: 14px; min-width: 0; }
.payroll-work-list .payroll-recent { margin-top: 0; }
.payroll-lower--solo { grid-template-columns: minmax(0, 1fr); }
.payroll-work-list .payroll-recent-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
.payroll-work-list .payroll-recent-list li > div:first-child { grid-column: 1; grid-row: 1 / 3; align-self: start; }
.payroll-work-list .payroll-recent-list li > div:nth-child(2) { grid-column: 2; grid-row: 1; align-items: flex-end; }
.payroll-work-list .payroll-recent-amount { grid-column: 2; grid-row: 2; }
@media (max-width: 1100px) {
    .payroll-cost-summary { grid-template-columns: minmax(0, 1fr); }
    .payroll-cost-ytd { border-right: 0; border-bottom: 1px solid var(--line); }
    .payroll-workspace .payroll-overview-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .payroll-workspace .payroll-overview-main > .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
    .payroll-cost-ytd, .payroll-cost-chart { padding: 20px 16px; }
    .payroll-workspace .payroll-overview-figures { padding: 12px 16px; }
}
@media (max-width: 520px) {
    .payroll-workspace .payroll-overview-main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .payroll-current-net { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
    .payroll-work-list .payroll-recent-list li { grid-template-columns: minmax(0, 1fr); }
    .payroll-work-list .payroll-recent-list li > div { grid-column: auto; grid-row: auto; align-items: flex-start; }
    .payroll-work-list .payroll-recent-amount { text-align: left; }
}

/* The work inbox separates personal action, tracking and communication history. */
.work-inbox-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:18px 0 24px; }
.work-inbox-mobile, .work-inbox-mobile-label { display:none; }
.work-inbox-route { min-width:170px; }
.work-inbox-blocked { color:var(--warn-ink, var(--ink)); font-weight:600; }
.work-inbox-body { min-width:0; }
.work-inbox-routing { margin-top:24px; }
@media (max-width:700px) {
    .work-inbox-tabs { display:none; }
    .work-inbox-mobile { display:flex; margin:16px 0; }
    .work-inbox-body .data-table { display:block; width:100%; min-width:0; }
    .work-inbox-body .data-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
    .work-inbox-body .data-table tbody { display:block; }
    .work-inbox-body .data-table tr { display:block; position:relative; padding:12px 0; border-bottom:1px solid var(--line); }
    .work-inbox-body .data-table tr:last-child { border-bottom:0; }
    .work-inbox-body .data-table td { display:block; min-width:0; width:auto; padding:4px 14px; border:0; white-space:normal; overflow-wrap:anywhere; }
    .work-inbox-body .data-table .select-col { float:right; width:auto; }
    .work-inbox-body .data-table .document-ref { clear:both; }
    .work-inbox-body .mail-table td.mail-actions > .mail-actions-inline { display:flex; flex-wrap:wrap; justify-content:flex-start; }
    .work-inbox-body .mail-table td.mail-actions > .mail-actions-menu { display:none; }
    .work-inbox-body .data-table .mail-since { font-size:12px; }
    .work-inbox-body .work-inbox-route { padding-top:8px; }
    .work-inbox-body .mail-sent-subject { max-width:none; }
    .work-inbox-body .table-scroll { overflow:visible; }
    .work-inbox-mobile-label { display:inline; }
    .work-inbox-body .section-heading { flex-wrap:wrap; gap:6px; }
    .work-inbox-body #sent .section-heading { flex-direction:column; align-items:flex-start; }
}
.reminder-stages { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }

/* ══ Settings pages (UI-13) ══════════════════════════════════════════════════════════════════
   What used to be inline styles on the Settings pages, one block per page, each class prefixed with its page. They sit at
   the end of the sheet on purpose: an inline style beat every rule, so each class must come after the base rule it
   overrides (.card, .field-row, .grid-table .row, .wizard-card). Where a base rule is more specific, the class is
   qualified to match it, as noted. The shared spacing and type utilities they use are in the Utilities section. */

/* ── Settings: onboarding wizard (Onboarding.razor) ─────────────────────────────────────────
   The wizard card is 460px by default; each step picks the width its content needs. These sit
   after .wizard-card (equal specificity), so they win on width and leave its padding alone. */
.onb-card { width: 560px; }
.onb-card-wide { width: 640px; }        /* the steps with the most choice cards (business type, opening balances) */
.onb-card-done { width: 520px; }        /* the closing summary */
/* The closing summary's big tick and heading. */
.onb-done-mark { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.onb-done-title { font-size: 20px; margin-bottom: 6px; }
/* Every step's heading and the one intro paragraph under it. A step whose intro leads straight into
   choice cards or a form gives it 2px more room. */
.onb-step-title { font-size: 19px; margin-bottom: 6px; }
.onb-intro { font-size: 13px; line-height: 1.6; margin: 0 0 18px; }
.onb-intro-loose { margin-bottom: 20px; }
/* "Adding accounts…" while a starter chart is being applied, in place of the card's tick. */
.onb-applying { font-size: 11.5px; margin-top: 2px; display: block; }
/* A one-line note under a field (price per employee, financial year). */
.onb-field-note { font-size: 12px; margin: 4px 0 0; }
/* Plan step: the two plan choices side by side, each add-on's checkbox beside its text, the
   "After the trial" total and the small print under it. */
.onb-plan-choice { display: flex; gap: 10px; margin-bottom: 18px; }
.onb-addon-choice { display: flex; gap: 10px; align-items: flex-start; }
.onb-addon-check { margin-top: 3px; }
.onb-plan-total { justify-content: space-between; margin-top: 16px; font-weight: 700; }
.onb-fine-print { font-size: 12px; line-height: 1.6; margin: 0; }
/* Bank step: the account code column, kept one width so the name inputs line up. */
.onb-bank-code { width: 52px; font-variant-numeric: tabular-nums; }
/* "· optional" beside the Invite your team heading. */
.onb-optional-tag { font-weight: 600; font-size: 14px; }
/* The footer's error line, beside the Continue button. */
.onb-foot-error { font-size: 12px; font-weight: 600; color: var(--warn-ink); }

/* ── Settings: add a company (NewCompanyPage.razor) ─────────────────────────────────────────
   A plain .card carries no padding of its own; this page's two cards set theirs and stay form-width. */
.newco-card { padding: 24px; max-width: 640px; }

/* ── Settings: company opening / preparing (CompanyOpenPage.razor, CompaniesPreparingPage.razor) ──
   The two hand-off pages shown while a new company is switched to or provisioned: one centred card
   with a spinner, then an error and a way out if it fails. The spin keyframes stay in each page. */
.coprep-card { padding: 28px; max-width: 520px; text-align: center; }
.coprep-card-wide { max-width: 560px; }  /* the preparing page's longer sentence */
.coprep-spinner {
    margin: 0 auto 16px; width: 32px; height: 32px;
    border: 3px solid var(--line); border-top-color: var(--brand-red); border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.coprep-actions { justify-content: center; gap: 8px; margin-top: 14px; }

/* ── Settings: opening balances wizard (OpeningBalances.razor) ── */
/* Step 1's card: the question and the line under it. */
.ob-card-title { font-size: 19px; margin-bottom: 8px; }
.ob-card-intro { font-size: 13px; line-height: 1.6; margin: 0 0 24px; }
/* The go-live date is the one answer this step asks for, so its box is drawn in the brand colour before it has focus.
   Qualified past `.field input.invalid` (0,2,1), the strongest rule that also sets its border colour. */
.wizard-card .field input.ob-start-date { border-color: var(--brand-red); }
/* Steps 2 to 4: each step's heading and intro line. */
.ob-step-title { font-size: 16px; margin-bottom: 4px; }
.ob-step-intro { font-size: 12.5px; margin-bottom: 14px; }
/* The amount, number and date boxes inside the wizard's tables are slimmer than a form field. !important because the
   control-sizing contract (`.field-input:not(textarea):not([type=...])` x5, specificity 0,6,1) zeroes the vertical
   padding, and the inline style these replace out-ranked it; matching that selector chain here would tie this rule to
   the contract's exact wording. */
.ob-cell-input { padding: 5px 8px !important; }
/* Open invoices and bills: the card's title line with its buttons. */
.ob-open-head { justify-content: space-between; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
/* The list of rows a CSV upload could not read. */
.ob-upload-errors { margin: 6px 0 0; padding-left: 18px; }
/* Assets: heading beside the buttons. */
.ob-assets-head { justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
/* The footer's error line beside the buttons. */
.ob-foot-error { font-size: 12px; font-weight: 600; color: var(--warn-ink); }

/* ── Settings: journal CSV import (CsvJournalImportPage.razor) ── */
/* The three numbered step cards. Qualified to match `.settings-body > .card`, which sets the same padding. */
.settings-body > .csvj-step { padding: 20px; margin-bottom: 16px; }
.settings-body > .csvj-review { padding: 20px; }
.csvj-step-title { font-weight: 700; margin-bottom: 6px; }
.csvj-intro { font-size: 12.5px; line-height: 1.55; margin: 0 0 12px; max-width: 780px; }
/* The company's dimension names, one badge each. */
.csvj-slots { gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.csvj-errors { margin: 8px 0 0 18px; line-height: 1.55; }

/* ── Settings: document branding (DocumentThemesPage.razor) ── */
.dt-name-input { max-width: 340px; }
/* The native colour picker sits inside a .field, whose `.field input` rule (0,1,1) sets width and padding for text
   inputs; qualifying with .field lets the swatch keep its own small square. */
.field .dt-colour-swatch { width: 44px; height: 34px; padding: 2px; }
.row-inline.dt-icon-actions { gap: 4px; }
.dt-opts-note { font-size: 11px; display: block; margin-top: 6px; }
.row-inline.dt-payto-check { align-self: end; gap: 8px; font-size: 13px; padding-bottom: 9px; min-width: 180px; }
.dt-block-editor { border: 1px solid var(--line); border-radius: 7px; padding: 12px; margin-top: 8px; }
.row-inline.dt-block-head { justify-content: space-between; align-items: center; margin-bottom: 8px; }
/* The preview card is flush: its head and foot carry their own padding and rules around the iframe. */
.theme-preview.dt-preview-card { padding: 0; overflow: hidden; }
.dt-preview-head { justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dt-preview-foot { font-size: 11.5px; padding: 10px 16px; border-top: 1px solid var(--line-soft); }

/* ── Settings: reporting dimensions (DimensionsPage.razor) ── */
/* One card per dimension, a little tighter than the settings default. `.card.dim-card` matches the specificity of
   `.settings-body > .card { padding: 20px }` and comes later, so it wins as the inline padding did. */
.card.dim-card { padding: 18px 20px; }
.dim-card-inactive { opacity: .6; }

.dim-value-inactive { opacity: .55; }
/* The small outlined "reserved" tag beside the Unallocated value. */
.dim-reserved { font-size: 10.5px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; }
/* Qualified with .pill so it also beats `.pill:hover`, which the inline colour did. */
.pill.dim-add-value { color: var(--brand-red); }
.dim-slots-free { font-size: 11.5px; margin-left: 10px; }
/* The inline dimension / value editors sit sunk inside their dimension's card. */
.card.dim-form { padding: 14px; background: var(--surface-sunk); }
.dim-code-field { max-width: 130px; }

/* ── Settings: support access (SupportAccessPage.razor) ── */
.section-title.sa-section-title { border: none; padding-top: 0; }
/* The red edge marks a session that is live right now. */
.card.sa-active-card { border-left: 3px solid var(--brand-red); }

/* ── Settings: people and access (CompanyUsersPage.razor) ── */
.cu-intro-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
/* Qualified with .field-row, whose own align-items (flex-start) has the same single-class weight. */
.field-row.cu-invite-row { margin-top: 18px; align-items: end; }
.cu-member-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.field-input.cu-role-select { max-width: 170px; }
.cu-invitation-line { font-size: 13px; padding: 5px 0; }
.field-row.cu-transfer-row { align-items: end; }
.cu-transfer-field { flex: 1; max-width: 320px; }

/* ── Settings: tax codes (TaxCodesPage.razor) ── */

.tc-row-inactive { opacity: .55; }
.card.tc-edit-card { background: var(--surface-sunk); }
.field-row.tc-form-row { align-items: end; gap: 12px; flex-wrap: wrap; }
.tc-code-field { max-width: 150px; }
/* `.field input` sets `font: inherit`, which would reset the tabular figures; this selector outweighs it. */
.field input.tc-code-input { text-transform: uppercase; font-variant-numeric: tabular-nums; }
/* `.field-row > .field` sets min-width: 160px at (0,2,0); this must outweigh it to keep the 200px floor. */
.field-row > .field.tc-name-field { min-width: 200px; flex: 1; }
.row-inline.tc-active-toggle { gap: 6px; padding-bottom: 9px; }
.btn.tc-add-btn { border-style: dashed; margin-top: 12px; }

/* ── Settings: currencies (CurrenciesPage.razor) ── */
.cur-status-row { justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Set on the header and each currency row, not on the .grid-table: the "no currencies yet" row has no column template. */

.cur-row-inactive { opacity: .55; }
.cur-add-row { align-items: end; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
/* ".field-row > .field" sets its own min-width, so this has to match its specificity to win. */
.field-row > .cur-add-field { min-width: 280px; }
.cur-stale-row { align-items: end; gap: 12px; }
.cur-stale-field { max-width: 170px; }

/* ── Settings: exchange rates (ExchangeRatesPage.razor) ── */
.fxr-entry-card { background: var(--surface-sunk); }
.fxr-entry-row { align-items: end; gap: 12px; flex-wrap: wrap; }
.fxr-short-field { max-width: 190px; }
.fxr-date-field { max-width: 170px; }
/* ".field-row > .field" sets flex and min-width, so this has to match its specificity to win. */
.field-row > .fxr-note-field { min-width: 180px; flex: 1; }

/* ── Settings: chart of accounts (ChartOfAccounts.razor) ── */
/* ".settings-body > .card" sets the card padding, so the empty card is qualified the same way to keep its own. */
.settings-body > .coa-empty-card { padding: 28px; text-align: center; }
/* One template on the .grid-table for the header, every group row and every account row (it was a C# constant). */

.coa-tree-mark { margin-right: 7px; }

/* ── Settings: getting paid (OnlinePaymentsPage.razor) ── */
/* Two columns at every width, as the inline template was: it also beats the phone rule that makes .settings-form-grid one column. */
.op-two-col-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Settings: email (EmailSettingsPage.razor) ── */
.es-two-col-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Settings: VAT and tax (TaxSettingsPage.razor) ── */
.taxset-basis-field { max-width: 320px; }
.taxset-rate-row { gap: 12px; align-items: end; flex-wrap: wrap; }

/* ── Settings: modules (ModulesSettingsPage.razor) ── */
.mods-row { justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }

/* ── Settings: records (RecordsSettingsPage.razor) ── */
.rec-retention-field { max-width: 320px; }

/* ── Settings: integrations (SettingsIntegrationsPage.razor) ── */
/* The new API key callout stacks its heading, key and actions instead of laying them out in a row. */
.integ-token-callout { flex-direction: column; align-items: stretch; gap: 10px; }

/* ── Settings: sales reminders and transaction lock (SalesSettingsPage.razor, AccountingSettingsPage.razor) ── */
/* Four reminder stages side by side at every width, as the inline template was (it also beats the phone one-column rule). */
.settings-reminder-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings-reopen-field { max-width: 260px; }

/* ── UI-20 tables moved off the .grid-table, per area (2026-09-29) ─────────────────────────────────────────
   Column widths and page-specific touches for the registers converted to <table class="data-table">. */
/* UI-20 batch A: accounting, assets, audit, cashbook, planning */
/* Accounting → New revaluation: the closing-rate input keeps the 180px column the grid gave it. */
.fxr-col-rate { width: 180px; }
/* Accounting → Period close: the controls and the cash-flow check share one column plan, so their figures line up. */
.pc-controls-table { table-layout: fixed; min-width: 760px; }
.pc-col-amount { width: 140px; }
.pc-col-result { width: 110px; }
/* Accounting → Summary: a fixed amount column, the header-account indent (16px a level on top of the cell padding) and
   the heavier rule over each pane's closing line. */
.acs-col-amount { width: 150px; }
.data-table td.acs-indent-1 { padding-left: 30px; }
.data-table td.acs-indent-2 { padding-left: 46px; }
.data-table td.acs-indent-3 { padding-left: 62px; }
.data-table td.acs-indent-4 { padding-left: 78px; }
.data-table td.acs-indent-5 { padding-left: 94px; }
.data-table td.acs-indent-6 { padding-left: 110px; }
.data-table tr.total.acs-grand > th,
.data-table tr.total.acs-grand > td { border-top-width: 2px; }
/* Cash receipt / payment detail: a line with a settlement note reads from the top of the row, as the grid did. */
.data-table.ctd-lines td { vertical-align: top; }
/* Planning dashboard: the favourable / unfavourable colour still shows on the net-profit total line. */
.data-table tr.total > td.planning-pos { color: var(--ok-ink); }
.data-table tr.total > td.planning-neg { color: var(--danger-ink); }
/* Accounting → New journal entry: the line-entry table. Desktop keeps the grid's column plan and tighter cells; on a
   phone .stack-sm turns each line into a stacked form and these widths step aside. */
.gj-col-account { width: 33%; }
.gj-col-amount { width: 124px; }
.gj-col-actions { width: 76px; }
.gj-totals-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.data-table.gj-lines tbody tr:hover { background: transparent; }
@media (min-width: 901px) {
    .data-table.gj-lines th,
    .data-table.gj-lines td { padding: 7px 4px; }
    .data-table.gj-lines th:first-child,
    .data-table.gj-lines td:first-child { padding-left: 12px; }
    .data-table.gj-lines th:last-child,
    .data-table.gj-lines td:last-child { padding-right: 12px; }
    .data-table.gj-lines tr.gj-line:has(+ tr.gj-dims) > td { border-bottom: 0; }
    .data-table.gj-lines tr.gj-dims > td { padding: 0 12px 8px; }
    .data-table.gj-lines tr.gj-tools-row > td { padding: 0; border-bottom: 0; }
}
@media (max-width: 900px) {
    .gj-lines colgroup { display: none; }
}

/* UI-20 batch B: banking */
/* Bank & cash reports: one table per account, fixed columns so the accounts line up down the page. */
.bank-history-table { table-layout: fixed; min-width: 640px; }
.bank-history-table .bank-history-col-md { width: 150px; }
.bank-history-table .bank-history-col-sm { width: 100px; }
.bank-history-caption { caption-side: top; padding: 10px 14px; text-align: left; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--line); }
/* Reconcile: the match lists keep their column heads in view while each list scrolls on its own. */
.recon-match-list .data-table thead th { position: sticky; top: 0; z-index: 2; }
/* Statement lines: a row can open an inline editor, so cells sit at the top and the Clear column keeps its room. */
.recon-lines-table td { vertical-align: top; }
/* Cash coding and statement lines hold account pickers whose lists drop below the row; a scroller would clip them. */
.recon-table-card.recon-picker-table { overflow: visible; }
.recon-lines-table .recon-lines-clear { width: 280px; min-width: 280px; }
.data-table tr.bank-rules-inactive { opacity: .55; }
.data-table tr.bank-import-duplicate { opacity: .5; }
.bank-import-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; }

/* UI-20 batch C1: payroll set-up and employee pages */
/* Pay periods (PayPeriods.razor) and the set-up wizard's preview (PayPeriodSetupWizard.razor): a weekly calendar is 52+
   rows, so each table scrolls in its own box; the period an operator acts on carries the "next" wash; dates stay on one
   line so a narrow screen scrolls the table sideways instead of wrapping every cell. */
.pp-period-preview { max-height: 460px; overflow: auto; }
.pp-period-list { max-height: 620px; overflow: auto; }
.pp-period-table th,
.pp-period-table td { white-space: nowrap; }
.pp-period-table tr.next > td { background: var(--ok-wash); }
/* Pay periods → Schedule health: one finding per line, its severity badge beside the title and detail. */
.pp-health-list { list-style: none; margin: 0; padding: 0; }
.pp-health-list > li {
    display: grid; grid-template-columns: 110px minmax(140px, 1fr); column-gap: 10px; align-items: start;
    padding: 10px 14px; font-size: 12.5px; border-top: 1px solid var(--line-soft);
}
.pp-health-list .badge { padding: 2px 8px; }

/* UI-20 batch C2: payroll runs and records */
/* Pay run review checks: the mark and the fix link take only their own width, the check the rest, all top-aligned so a
   two-line reason reads beside its badge. */
.review-checks td { vertical-align: top; }
.review-checks .review-check-mark,
.review-checks .review-check-fix { width: 1%; white-space: nowrap; }
/* The payslip editor's draft pay item: the "take-home" choice and the Add button share one line under the row. */
.pay-item-draft-actions > td > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Line tables whose cells hold an account picker: the picker's list opens below its field and a scrolling box would clip
   it, so these size to fit and only scroll where they truly cannot (as .cols-pay-items). Fixed layout keeps the typed
   columns from collapsing to their inputs' minimum width. */
.ws-items-scroll.table-scroll,
.payslip-record-lines-scroll.table-scroll { overflow: visible; }
@media (max-width: 860px) {
    .ws-items-scroll.table-scroll,
    .payslip-record-lines-scroll.table-scroll { overflow-x: auto; }
}
.ws-items { table-layout: fixed; min-width: 720px; }
.ws-items .ws-col-type { width: 130px; }
.ws-items .ws-col-taxable { width: 110px; }
.ws-items .ws-col-amount { width: 120px; }
.ws-items .ws-col-remove { width: 48px; }
.payslip-record-lines { table-layout: fixed; min-width: 560px; }
.payslip-record-lines .payslip-record-col-amount { width: 140px; }
.payslip-record-lines .payslip-record-col-account { width: 220px; }
.payslip-record-lines .payslip-record-col-remove { width: 56px; }
/* Payroll home, "Needs attention": always stacked in its narrow panel (who and how bad, what is wrong, the fix). */
.payroll-exception-list { list-style: none; margin: 2px -18px -6px; padding: 0; }
.payroll-exception-list > li {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
    column-gap: 10px; row-gap: 5px; padding: 10px 18px; font-size: 12.5px; border-top: 1px solid var(--line-soft);
}
.payroll-exception-list > li > div { min-width: 0; }
.payroll-exception-list > li > div:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; overflow-wrap: anywhere; }
.payroll-exception-list > li > div:nth-child(3) { grid-column: 2; grid-row: 1; }
.payroll-exception-list > li > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
.payroll-exception-list > li > div:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
.payroll-exception-list .badge { padding: 2px 8px; }
.payroll-exception-list .pill { font-size: 11.5px; white-space: nowrap; }
/* Full Payroll upgrade page, "What you get". */
.section-title.payroll-upgrade-benefits-title { border: none; padding-top: 0; }
.payroll-upgrade-benefits { margin: 0; padding-left: 18px; line-height: 1.9; }
/* Record a payslip (Lite): the section note and the net pay line under the totals. */
.payslip-record-optional { font-weight: normal; font-size: .85em; }
.payslip-record-net { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.payslip-record-net-figure { font-weight: 700; font-size: 1.15em; }

/* UI-20 batch D: sales and purchases registers */
/* Payment run worksheet: the Pay and Cheque number cells hold a full-width input, which gives the column no width of its
   own, so those two columns keep the widths the old grid gave them. */
.data-table .payment-run-col-pay { width: 150px; }
.data-table .payment-run-col-cheque { width: 170px; }

/* UI-20 batch E: reports */
/* A financial report is one table whose sections share its columns. Every amount column (a comparison period, a
   dimension value) keeps the fixed width the old grid gave it, so the figures line up down the page and the account
   column takes what is left; a figure never wraps. */
.rpt-table th.num,
.rpt-table td.num { white-space: nowrap; }
.rpt-table col.rpt-col-amount { width: 150px; }
.rpt-table col.rpt-col-code { width: 80px; }
.rpt-table th.rpt-col-account { min-width: 200px; }
/* The line that closes a statement (liabilities + equity, net profit, closing cash) sits under a heavier rule. */
.data-table tr.total.rpt-grand-total > td { border-top-width: 2px; }
/* An account's depth in the header-account tree (and a cash-flow line under its section), 16px a level. */
.data-table.compact td.rpt-depth-1 { padding-left: 30px; }
.data-table.compact td.rpt-depth-2 { padding-left: 46px; }
.data-table.compact td.rpt-depth-3 { padding-left: 62px; }
.data-table.compact td.rpt-depth-4 { padding-left: 78px; }
.data-table.compact td.rpt-depth-5 { padding-left: 94px; }
.data-table.compact td.rpt-depth-6 { padding-left: 110px; }
/* The comparison-columns editor above a statement: a date (or two) per row, the name, and the move/remove buttons
   squeezed to their own width. */
.rpt-columns col.rpt-col-date { width: 170px; }
.rpt-columns col.rpt-col-moves { width: 1%; }
/* Owner money movements: a long description stops at one line instead of widening the table. */
.owner-report-movements td.owner-report-description { max-width: 320px; }

/* UI-20 batch F: settings and shared */
/* Journal CSV import: each journal in the preview is its own small bordered table, all with the same columns. */
.csvj-journal-scroll { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; }
.data-table.csvj-journal { table-layout: fixed; min-width: 720px; }
.csvj-journal .csvj-col-code { width: 104px; }
.csvj-journal .csvj-col-amount { width: 134px; }
.csvj-journal .csvj-col-dims { width: 194px; }
/* Dimensions: every dimension's value table lines up with the next one. */
.data-table.dim-values { table-layout: fixed; }
.dim-values .dim-col-code { width: 124px; }
.dim-values .dim-col-narrow { width: 104px; }
/* Adjust opening balances: the account picker opens a list below its field, which a scroller would clip, so the lines
   only scroll where the table cannot fit. */
.oba-lines-scroll { width: 100%; max-width: 100%; min-width: 0; }
.opening-adjust-grid .oba-col-amount { width: 144px; }
.opening-adjust-grid .oba-col-action { width: 58px; }
.data-table td.oba-tools-cell { padding: 6px 14px; }
@media (max-width: 900px) { .oba-lines-scroll { overflow-x: auto; overscroll-behavior-inline: contain; } }
/* Budget variance (Planning, Reports, a job): seven columns keep their width and scroll on a narrow screen. */
.data-table.planning-variance-table { min-width: 1040px; }
.planning-variance-table th:first-child,
.planning-variance-table td:first-child { min-width: 200px; }
/* Cash receipt / payment form: the open documents to settle, and the coded lines. */
.data-table.cash-alloc { min-width: 640px; }
.cash-alloc .cash-col-select { width: 40px; }
.cash-alloc .cash-col-due { width: 130px; }
.cash-alloc .cash-col-outstanding { width: 150px; }
.cash-alloc .cash-col-apply { width: 160px; }
.cash-alloc .cash-col-full { width: 90px; }
.data-table.cash-lines { table-layout: fixed; }
.cash-lines .cash-col-account { width: 254px; }
.cash-lines .cash-col-qty { width: 104px; }
.cash-lines .cash-col-vat { width: 86px; }
.cash-lines .cash-col-amount { width: 164px; }
.cash-lines .cash-col-remove { width: 58px; }
.data-table.cash-lines > tbody > tr.cash-line > td { vertical-align: top; }
.data-table.cash-lines > tbody > tr.cash-line > td.cash-qty-none { vertical-align: middle; }
.field-input.cash-item-account { display: flex; align-items: center; background: var(--surface-sunk); color: var(--ink-soft); }
.data-table td.cash-asset-cell { padding: 0 0 6px; }
.card.cash-asset-card { padding: 12px; background: var(--surface-sunk); border: 1px solid var(--line); }
.cash-lines-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
@media (max-width: 900px) { .data-table.stack-sm colgroup { display: none; } }

/* UI-20: document detail pages, timesheets, opening balances */
/* The posted-document reversal panel (ReversalPanel.razor): a card outlined in the brand red, no wider than its form. */
.card.reversal-panel,
.card.confirm-panel { padding: 18px; margin-bottom: 16px; max-width: 560px; border: 1px solid var(--brand-red); }
/* "Reduced the cost of: …" under a supplier credit note's lines. */
.doc-reduced-assets { padding: 10px 20px 14px; border-top: 1px solid var(--line); font-size: 12px; }
/* The title line over a document's preview frame. */
.row-inline.doc-preview-head { justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
/* Reclassify a posted document's line accounts: the picker column gets room, and its list must not be clipped. */
.reclassify-table td.cell-input { width: 45%; }
/* A detail page's line list reads from the top of each row: a line can carry a second line (a link, a dimension). */
.data-table tr.va-top > td { vertical-align: top; }
/* A tracked-stock line's account, fixed to Inventory on Hand: shown in the field's place, greyed. */
.line-control-locked { background: var(--surface-sunk); color: var(--ink-soft); }
/* A small form set into an editor card (capitalise a bill line, a capture note), on the sunken surface. */
.card.inset-card { padding: 12px; background: var(--surface-sunk); border: 1px solid var(--line); }
/* The Sales / Purchases reports landing: report cards in as many columns as fit. */
.reports-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
/* A pay run's record: ten columns, so the employee column keeps a floor and the table scrolls in its card instead. */
.payroll-record-table td:first-child { min-width: 170px; }
/* "Registered in the asset register: …" under a bill's lines. */
.doc-registered-assets { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; }
/* Timesheet daily rows (TimesheetEditor): wide enough for every field on a desktop, scrolling inside the card; a weekend
   row is shaded; on a phone the day's name moves beside its date because its own column is hidden there. */
/* Opening balances wizard (OpeningBalances.razor): the trial balance, open invoices / bills and assets. On a desktop the
   money columns keep a steady width; on a phone each row stacks into its name and labelled figures (.stack-sm), and the
   account code moves in front of the name because its own column is hidden there. */
.ob-tb-table .num, .ob-asset-table .num { width: 150px; }
.ob-tb-table .ob-code-inline { display: none; margin-right: 8px; }
.ob-open-table { table-layout: fixed; }
.ob-open-table col.ob-col-party { width: 34%; }
.ob-open-table col.ob-col-date { width: 150px; }
.ob-open-table col.ob-col-amount { width: 130px; }
.ob-open-table col.ob-col-remove { width: 52px; }
@media (max-width: 900px) {
    .ob-tb-table .num, .ob-asset-table .num { width: auto; }
    .ob-tb-table .ob-code-inline { display: inline; }
    .ob-open-table { table-layout: auto; }
}
.ts-entry-table { min-width: 950px; }
.ts-entry-table tr.ts-weekend > * { background: var(--surface-sunk); }
.ts-entry-table .field-label { display: none; }
.ts-entry-table .ts-day-inline { display: none; font-weight: 400; }
@media (max-width: 900px) {
    .ts-entry-table { min-width: 0; }
    .ts-entry-table .ts-day-inline { display: inline; }
    .ts-entry-table tr.ts-weekend { background: var(--surface-sunk); }
}
