/* =====================================================================
   Lorimak ePayslips
   ---------------------------------------------------------------------
   Palette is taken straight off the Lorimak Africa mark: indigo #393185
   and orange #EF7F1A. Everything else is built around those two.

   Type does the heavy lifting:
     Sora            headings and figures — geometric, matches the mark
     Instrument Sans interface text
     IBM Plex Mono   every identifier, amount and balance

   The mono is the point. This is a payroll register, so anything that
   would appear in a ledger column is set in mono with tabular figures
   and right aligned. Numbers line up down the page the way they do on
   a printed payslip.

   The signature detail is the stub edge: a punched-hole strip down the
   left of the metric cards, the way a payslip's counterfoil tears off.
   It appears in exactly one place. Everything else stays quiet.
   ===================================================================== */

/* ---------- Tokens -------------------------------------------------- */
:root {
    /* Brand */
    --indigo:        #393185;
    --indigo-lift:   #4B41A6;
    --indigo-deep:   #2A2465;
    --amber:         #EF7F1A;
    --amber-lift:    #FF9435;
    --amber-soft:    #FDF1E4;

    /* Chrome */
    --ink:           #17153B;
    --ink-soft:      #211E4D;
    --ink-line:      rgba(255, 255, 255, .09);

    /* Surfaces */
    --paper:         #F4F3F9;
    --card:          #FFFFFF;
    --card-sunk:     #FAFAFD;
    --indigo-wash:   #F3F2FB;   /* row picked out in a table */
    --line:          #E5E3EF;
    --line-soft:     #EFEDF6;

    /* Text */
    --text:          #1C1A33;
    --text-mid:      #56536F;
    --text-dim:      #8A87A3;
    --text-invert:   #FFFFFF;

    /* Semantic */
    --ok:            #12855C;
    --ok-soft:       #E4F5EE;
    --warn:          #B7791F;
    --warn-soft:     #FDF4E3;
    --danger:        #C22F49;
    --danger-soft:   #FCEBEE;
    --info:          #2C6FB5;
    --info-soft:     #E9F2FB;

    /* Geometry */
    --r-sm:  6px;
    --r:     10px;
    --r-lg:  16px;
    --r-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(23, 21, 59, .06);
    --shadow-sm: 0 2px 6px rgba(23, 21, 59, .06), 0 1px 2px rgba(23, 21, 59, .04);
    --shadow-md: 0 8px 24px rgba(23, 21, 59, .08), 0 2px 6px rgba(23, 21, 59, .04);
    --shadow-lg: 0 24px 60px rgba(23, 21, 59, .16);

    --rail:        268px;
    --rail-narrow: 88px;
    --topbar:      66px;

    --ease: cubic-bezier(.4, .14, .3, 1);

    /* Type */
    --font-display: 'Sora', system-ui, sans-serif;
    --font-body:    'Instrument Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

/* ---------- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--indigo-lift); }

img { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
    border-radius: 3px;
}

::selection { background: rgba(239, 127, 26, .22); }

/* Anything that behaves like a ledger figure */
.num, .mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
    letter-spacing: -.02em;
}

/* ---------- Scrollbars ---------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #CFCCE0;
    border-radius: var(--r-pill);
    border: 3px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #B4B0CC; background-clip: content-box; }

/* =====================================================================
   AUTH SCREENS
   ===================================================================== */

.auth-stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background:
        radial-gradient(1000px 640px at 12% -10%, rgba(75, 65, 166, .55), transparent 62%),
        radial-gradient(760px 520px at 92% 108%, rgba(239, 127, 26, .34), transparent 60%),
        var(--ink);
    position: relative;
    overflow: hidden;
}

/* One soft highlight over the gradient, nothing else. The sign-in screen
   stays clean — the ledger motif belongs inside the app, not here. */
.auth-stage::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .07), transparent 70%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 432px;
    background: var(--card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 38px 34px;
    animation: rise .5s var(--ease) both;
}

/* Torn stub edge along the top of the sign-in card */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 8px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background:
        linear-gradient(90deg, var(--indigo) 0 62%, var(--amber) 62% 100%);
}

.auth-logo { width: 188px; margin: 10px auto 24px; }

.auth-card h1 {
    font-size: 21px;
    text-align: center;
    margin-bottom: 4px;
}

.auth-sub {
    text-align: center;
    color: var(--text-dim);
    font-size: 13.5px;
    margin: 0 0 26px;
}

.auth-foot {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    text-align: center;
    font-size: 12.5px;
    color: var(--text-dim);
}

.auth-mark {
    position: absolute;
    bottom: 20px;
    left: 0; right: 0;
    text-align: center;
    color: rgba(255, 255, 255, .38);
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

/* The 6-digit code entry */
.code-input {
    font-family: var(--font-mono);
    font-size: 30px;
    letter-spacing: .42em;
    text-align: center;
    text-indent: .42em;
    padding: 14px 10px;
}

/* =====================================================================
   APP SHELL
   ===================================================================== */

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ---------- Rail ---------------------------------------------------- */
.rail {
    width: var(--rail);
    flex: 0 0 var(--rail);
    background: var(--ink);
    color: rgba(255, 255, 255, .74);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    transition: width .22s var(--ease), transform .26s var(--ease);
}

.rail-head {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--ink-line);
    flex: 0 0 auto;
}

/* The logo is the brand, so it gets room. Sized against the rail rather
   than the topbar, which is why the masthead is no longer height-locked. */
.rail-head img {
    width: 74px;
    flex: 0 0 74px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .32));
}

.rail-wordmark {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16.5px;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -.01em;
    white-space: nowrap;
}
.rail-wordmark span {
    display: block;
    margin-top: 1px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .17em;
    text-transform: uppercase;
    color: var(--amber);
}

.rail-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 0 20px; }
.rail-scroll::-webkit-scrollbar { width: 4px; }
.rail-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border: 0; }

.rail-group {
    padding: 16px 20px 7px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .19em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .34);
    white-space: nowrap;
}

.rail-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    margin: 1px 10px;
    border-radius: var(--r-sm);
    color: rgba(255, 255, 255, .74);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.rail-link i { width: 17px; text-align: center; font-size: 14.5px; flex: 0 0 17px; }
.rail-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.rail-link.is-active {
    background: var(--indigo);
    color: #fff;
}
.rail-link.is-active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 19px;
    border-radius: 0 3px 3px 0;
    background: var(--amber);
}

.rail-badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: var(--amber);
    color: #2A1500;
    padding: 1px 7px;
    border-radius: var(--r-pill);
    font-weight: 600;
}

.rail-foot {
    flex: 0 0 auto;
    border-top: 1px solid var(--ink-line);
    padding: 13px 16px;
}

.credit-chip {
    display: block;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--ink-line);
    border-radius: var(--r);
    padding: 10px 13px;
    color: rgba(255,255,255,.8);
}
.credit-chip:hover { background: rgba(255,255,255,.09); color: #fff; }
.credit-chip .lbl {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255,255,255,.42);
    display: block;
}
.credit-chip .val {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.02em;
}
.credit-chip.is-low .val { color: var(--amber-lift); }

/* Collapsed rail */
body.rail-narrow .rail { width: var(--rail-narrow); flex-basis: var(--rail-narrow); }
body.rail-narrow .main { margin-left: var(--rail-narrow); }
body.rail-narrow .rail-wordmark,
body.rail-narrow .rail-group,
body.rail-narrow .rail-link span,
body.rail-narrow .rail-badge,
body.rail-narrow .credit-chip .lbl { display: none; }
body.rail-narrow .rail-link { justify-content: center; padding: 11px 0; }
body.rail-narrow .rail-head { justify-content: center; padding: 16px 0 14px; }
body.rail-narrow .rail-head img { width: 48px; flex-basis: 48px; }
body.rail-narrow .credit-chip { text-align: center; padding: 9px 4px; }
body.rail-narrow .credit-chip .val { font-size: 13px; }

/* ---------- Main ---------------------------------------------------- */
.main {
    flex: 1 1 auto;
    margin-left: var(--rail);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin .22s var(--ease);
}

.topbar {
    height: var(--topbar);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--text-mid);
    cursor: pointer;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.icon-btn:hover { background: var(--line-soft); color: var(--text); }

.topbar-title { min-width: 0; }
.topbar-title h1 {
    font-size: 16.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title p {
    margin: 1px 0 0;
    font-size: 12px;
    color: var(--text-dim);
}

.topbar-spacer { flex: 1 1 auto; }

/* User menu */
.usermenu { position: relative; }
.usermenu-btn {
    display: flex; align-items: center; gap: 9px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    transition: border-color .14s var(--ease), background .14s var(--ease);
}
.usermenu-btn:hover { background: var(--card); border-color: #D3CFE6; }

.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--indigo), var(--indigo-lift));
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    flex: 0 0 30px;
}
.avatar.lg { width: 52px; height: 52px; font-size: 17px; flex-basis: 52px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; flex-basis: 26px; }
.avatar.amber { background: linear-gradient(140deg, var(--amber), #F5A356); color: #341A00; }
.avatar.slate { background: linear-gradient(140deg, #5C5980, #7B78A0); }

.usermenu-meta { text-align: left; line-height: 1.2; }
.usermenu-meta strong { display: block; font-size: 13px; font-weight: 600; }
.usermenu-meta span { font-size: 11px; color: var(--text-dim); }

.dropdown {
    position: absolute;
    right: 0; top: calc(100% + 9px);
    min-width: 232px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s var(--ease), transform .15s var(--ease), visibility .15s;
    z-index: 70;
}
.dropdown.is-open { opacity: 1; visibility: visible; transform: none; }

.dropdown-head {
    padding: 10px 12px 11px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 5px;
}
.dropdown-head strong { display: block; font-size: 13.5px; }
.dropdown-head span { font-size: 11.5px; color: var(--text-dim); }

.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    color: var(--text-mid);
    background: none; border: 0;
    text-align: left;
    cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--paper); color: var(--text); }
.dropdown a i, .dropdown button i { width: 15px; font-size: 13px; color: var(--text-dim); }
.dropdown .is-danger { color: var(--danger); }
.dropdown .is-danger i { color: var(--danger); }
.dropdown hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 0; }

/* ---------- Page ---------------------------------------------------- */
.page { padding: 26px; flex: 1 1 auto; }
.page-wide { max-width: 1440px; margin: 0 auto; }
.page-narrow { max-width: 780px; margin: 0 auto; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head .eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0 0 5px;
}
.page-head h2 { font-size: 25px; letter-spacing: -.028em; }
.page-head p.lede { margin: 5px 0 0; color: var(--text-mid); font-size: 13.5px; max-width: 62ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* =====================================================================
   COMPONENTS
   ===================================================================== */

/* ---------- Buttons ------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 17px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -.005em;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s var(--ease), border-color .15s var(--ease),
                box-shadow .15s var(--ease), transform .08s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 12.5px; }

.btn-primary {
    background: var(--indigo);
    color: #fff;
    box-shadow: 0 1px 2px rgba(57, 49, 133, .3);
}
.btn-primary:hover { background: var(--indigo-lift); color: #fff; }

.btn-amber {
    background: var(--amber);
    color: #2E1600;
    box-shadow: 0 1px 2px rgba(239, 127, 26, .34);
}
.btn-amber:hover { background: var(--amber-lift); color: #2E1600; }

.btn-ghost {
    background: var(--card);
    border-color: var(--line);
    color: var(--text-mid);
}
.btn-ghost:hover { border-color: #CFCBE4; color: var(--text); }

.btn-quiet { background: transparent; color: var(--text-mid); }
.btn-quiet:hover { background: var(--line-soft); color: var(--text); }

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

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }

/* ---------- Cards --------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
}
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head p { margin: 1px 0 0; font-size: 12px; color: var(--text-dim); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--line-soft);
    background: var(--card-sunk);
    border-radius: 0 0 var(--r) var(--r);
    font-size: 12.5px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Metric cards — the stub edge ---------------------------- */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 17px 20px 16px 30px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.metric:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* punched holes down the counterfoil edge */
.metric::before {
    content: '';
    position: absolute;
    left: 9px; top: 12px; bottom: 12px;
    width: 4px;
    background-image: radial-gradient(circle, var(--line) 1.6px, transparent 1.7px);
    background-size: 4px 10px;
}
.metric::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--indigo);
    opacity: .85;
}
.metric.accent-amber::after  { background: var(--amber); }
.metric.accent-ok::after     { background: var(--ok); }
.metric.accent-danger::after { background: var(--danger); }
.metric.accent-info::after   { background: var(--info); }

.metric .m-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .17em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
}
.metric .m-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 29px;
    font-weight: 600;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--text);
}
.metric .m-value small {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: -.02em;
}
.metric .m-foot {
    margin-top: 9px;
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend { font-weight: 600; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.trend.up   { color: var(--ok); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--text-dim); }

/* ---------- Grid ---------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-8-4 { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); }
.grid-7-5 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

/* ---------- Tables -------------------------------------------------- */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 10px 16px;
    background: var(--card-sunk);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table.data tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:hover { background: #FBFAFE; }
table.data td.num, table.data th.num { text-align: right; }
table.data .muted { color: var(--text-dim); }
table.data .strong { font-weight: 600; }

/* Row picked out as the one currently being looked at — used by the
   client delivery report's run list, where one row is the subject of the
   panel above it. */
table.data tbody tr.is-selected,
table.data tbody tr.is-selected:hover {
    background: var(--indigo-wash, #F4F3FB);
    box-shadow: inset 3px 0 0 var(--indigo);
}
/* A figure that is bad news in an otherwise neutral column. */
table.data td.is-danger { color: var(--danger); font-weight: 600; }

/* Wide tables keep a floor width and scroll inside .table-wrap on a phone,
   rather than cramming five columns into 390px and wrapping every cell to
   three lines. Percentage column widths above are respected once there is
   room for them. */
table.data.data-wide { min-width: 660px; }

/* Two-column definition list inside a card body — the compact sibling of
   .kv, for short label/number pairs that should not stretch full width. */
.pairs { display: grid; grid-template-columns: minmax(140px, 55%) 1fr; gap: 10px 16px;
         font-size: 13.5px; margin: 0; }
.pairs dt { color: var(--text-dim); font-size: 12.5px; }
.pairs dd { margin: 0; font-weight: 600; }
@media (max-width: 720px) {
    .pairs { grid-template-columns: 1fr; gap: 2px 0; }
    .pairs dd { margin-bottom: 10px; }
}

/* Preformatted blocks that carry commands or a log excerpt. Long lines
   wrap instead of forcing the card to scroll sideways. */
.codeblock {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--card-sunk);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 0;
    overflow-x: auto;
}


.cell-stack { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-stack .t { min-width: 0; line-height: 1.3; }
.cell-stack .t strong { display: block; font-weight: 600; font-size: 13.5px; }
.cell-stack .t span { font-size: 11.5px; color: var(--text-dim); }

/* ---------- Pills --------------------------------------------------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: -.005em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.pill i { font-size: 8px; }
.pill-ok     { background: var(--ok-soft);     color: var(--ok); }
.pill-warn   { background: var(--warn-soft);   color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info   { background: var(--info-soft);   color: var(--info); }
.pill-busy   { background: var(--amber-soft);  color: #B35F0B; }
.pill-draft  { background: #EEEDF6;            color: #5B5880; }
.pill-muted  { background: #F1F0F5;            color: var(--text-dim); }
.pill-brand  { background: #EEECF9;            color: var(--indigo); }
.pill-outline { background: transparent; border-color: var(--line); color: var(--text-mid); }

/* Pulsing dot for anything mid-flight */
.pill-busy i { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }

/* ---------- Progress ------------------------------------------------ */
.meter {
    height: 6px;
    background: var(--line-soft);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.meter > i {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--indigo);
    transition: width .7s var(--ease);
}
.meter.ok > i     { background: var(--ok); }
.meter.warn > i   { background: var(--amber); }
.meter.danger > i { background: var(--danger); }
.meter.sm { height: 4px; }

/* ---------- Forms --------------------------------------------------- */
.field { margin-bottom: 17px; }
.field:last-child { margin-bottom: 0; }

.field label, .lbl {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 6px;
}
.field .hint {
    font-size: 12px;
    color: var(--text-dim);
    margin: 6px 0 0;
    line-height: 1.45;
}
.field .err {
    font-size: 12px;
    color: var(--danger);
    margin: 6px 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.input, .select, textarea.input {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
    font-size: 14px;
    color: var(--text);
    transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.input::placeholder { color: #A9A6BE; }
.input:hover, .select:hover { border-color: #CFCBE4; }
.input:focus, .select:focus, textarea.input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(57, 49, 133, .12);
}
.input.has-error { border-color: var(--danger); }
.input.has-error:focus { box-shadow: 0 0 0 3px rgba(194, 47, 73, .12); }
.input:disabled, .select:disabled { background: var(--card-sunk); color: var(--text-dim); cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 88px; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238A87A3' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 34px;
}

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 38px; }
.input-group > i.lead {
    position: absolute;
    left: 14px;
    font-size: 13.5px;
    color: var(--text-dim);
    pointer-events: none;
}
.input-group .peek {
    position: absolute;
    right: 6px;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: 0; background: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: var(--r-sm);
}
.input-group .peek:hover { background: var(--line-soft); color: var(--text); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* Toggle
   The input itself is the switch. Styling the element directly rather than
   a sibling span means there is no way for the markup to drift out of sync
   with the CSS and leave a raw checkbox on screen. */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }

.switch {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    margin: 1px 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-pill);
    background: #CFCCE0;
    position: relative;
    cursor: pointer;
    transition: background .18s var(--ease);
}
.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(23, 21, 59, .25);
    transition: transform .18s var(--ease);
}
.switch:checked { background: var(--indigo); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.toggle .tl { line-height: 1.35; }
.toggle .tl strong { display: block; font-size: 13.5px; font-weight: 600; }
.toggle .tl span { font-size: 12px; color: var(--text-dim); }

/* Pick grid — multi-select cards, used for assigning companies to a person */
.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}
.pick {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    cursor: pointer;
    transition: border-color .14s var(--ease), background .14s var(--ease);
}
.pick:hover { border-color: #CFCBE4; background: #FCFCFE; }
.pick input { margin-top: 2px; accent-color: var(--indigo); flex: 0 0 auto; }
.pick.is-picked { border-color: var(--indigo); background: #F8F7FD; box-shadow: 0 0 0 1px var(--indigo); }
.pick-body { min-width: 0; line-height: 1.3; }
.pick-body strong { display: block; font-size: 13px; font-weight: 600; }
.pick-body span { display: block; color: var(--text-dim); }

/* Radio cards — used for picking a role */
.choice-set { display: grid; gap: 9px; }
.choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    cursor: pointer;
    background: var(--card);
    transition: border-color .14s var(--ease), background .14s var(--ease);
}
.choice:hover { border-color: #CFCBE4; background: #FCFCFE; }
.choice input { margin-top: 3px; accent-color: var(--indigo); flex: 0 0 auto; }
.choice.is-picked { border-color: var(--indigo); background: #F8F7FD; box-shadow: 0 0 0 1px var(--indigo); }
.choice .c-body strong { display: block; font-size: 13.5px; font-weight: 600; }
.choice .c-body span { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }

/* ---------- Alerts -------------------------------------------------- */
.alert {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--r);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert i.ico { font-size: 15px; margin-top: 1px; flex: 0 0 auto; }
.alert strong { font-weight: 600; }
.alert-ok      { background: var(--ok-soft);     color: #0B6344; border-color: #BFE6D5; }
.alert-warn    { background: var(--warn-soft);   color: #8A5A12; border-color: #F2DFB8; }
.alert-danger  { background: var(--danger-soft); color: #96233A; border-color: #F3C9D1; }
.alert-info    { background: var(--info-soft);   color: #1F5486; border-color: #C6DDF2; }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; }
.alert .close:hover { opacity: 1; }

/* Toast stack */
.toasts {
    position: fixed;
    top: 78px; right: 22px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: 380px;
}
.toast {
    display: flex;
    gap: 11px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--indigo);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 12px 15px;
    font-size: 13.5px;
    animation: slide-in .3s var(--ease) both;
}
.toast.ok     { border-left-color: var(--ok); }
.toast.warn   { border-left-color: var(--amber); }
.toast.danger { border-left-color: var(--danger); }
.toast.info   { border-left-color: var(--info); }
.toast.is-going { animation: slide-out .25s var(--ease) both; }

/* ---------- Empty state --------------------------------------------- */
.empty {
    text-align: center;
    padding: 46px 24px;
    color: var(--text-dim);
}
.empty .ring {
    width: 58px; height: 58px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--indigo);
    font-size: 21px;
}
.empty h4 { font-size: 15px; margin-bottom: 5px; color: var(--text); }
.empty p { margin: 0 auto; max-width: 42ch; font-size: 13px; line-height: 1.55; }
.empty .btn { margin-top: 17px; }

/* ---------- Activity feed ------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.feed li:last-child { border-bottom: 0; }
.feed .fi {
    width: 29px; height: 29px;
    flex: 0 0 29px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11.5px;
    background: var(--paper);
    color: var(--text-mid);
    border: 1px solid var(--line);
}
.feed .fi.ok    { background: var(--ok-soft);     color: var(--ok);    border-color: #C9E9DA; }
.feed .fi.warn  { background: var(--warn-soft);   color: var(--warn);  border-color: #F1DFBC; }
.feed .fi.info  { background: var(--info-soft);   color: var(--info);  border-color: #CCDFF3; }
.feed .fi.brand { background: #EEECF9;            color: var(--indigo);border-color: #D9D5F0; }
.feed .fi.amber { background: var(--amber-soft);  color: #B35F0B;      border-color: #F5DCC0; }
.feed .fb { min-width: 0; flex: 1; }
.feed .fb p { margin: 0; font-size: 13px; line-height: 1.45; }
.feed .fb .meta {
    font-size: 11.5px;
    color: var(--text-dim);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Run tape ------------------------------------------------ */
/* Horizontal strip of recent runs, set like a receipt printout. */
.tape { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; }
.tape-item {
    flex: 0 0 190px;
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 3px solid var(--indigo);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    transition: box-shadow .16s var(--ease), transform .16s var(--ease);
}
.tape-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.tape-item.s-distributed { border-top-color: var(--ok); }
.tape-item.s-generated   { border-top-color: var(--info); }
.tape-item.s-draft       { border-top-color: #B9B5D2; }
.tape-item.s-discarded   { border-top-color: #CFCCE0; opacity: .62; }
.tape-item .ref {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
    letter-spacing: .04em;
}
.tape-item .co {
    font-weight: 600;
    font-size: 13.5px;
    margin: 3px 0 1px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tape-item .pe { font-size: 11.5px; color: var(--text-dim); }
.tape-item .ct {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 17px;
    font-weight: 600;
    margin-top: 9px;
    letter-spacing: -.03em;
}
.tape-item .ct small { font-size: 11px; font-weight: 400; color: var(--text-dim); letter-spacing: 0; }

/* ---------- Chart shells -------------------------------------------- */
.chart-box { position: relative; height: 268px; }
.chart-box.sm { height: 196px; }
.chart-box.lg { height: 310px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-mid); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* ---------- Segmented control --------------------------------------- */
.segmented {
    display: inline-flex;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 2px;
    gap: 2px;
}
.segmented a, .segmented button {
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-mid);
    background: none;
    border: 0;
    cursor: pointer;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .is-on { background: var(--card); color: var(--indigo); box-shadow: var(--shadow-xs); }

/* ---------- Misc ---------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.stack-md { gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.push { margin-left: auto; }
.dim { color: var(--text-dim); }
.mid { color: var(--text-mid); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

.divider { border: 0; border-top: 1px solid var(--line-soft); margin: 20px 0; }

.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 11px 18px; font-size: 13.5px; }
.kv dt { color: var(--text-dim); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 500; }

.scroll-y { overflow-y: auto; }
.h-320 { max-height: 320px; }
.h-420 { max-height: 420px; }

/* Recovery codes block */
.codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--card-sunk);
    border: 1px dashed var(--line);
    border-radius: var(--r);
    padding: 16px;
}
.codes span { letter-spacing: .06em; }

/* QR frame */
.qr-frame {
    width: 188px; height: 188px;
    margin: 0 auto;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r);
    display: grid;
    place-items: center;
}
.qr-frame canvas, .qr-frame img { width: 100% !important; height: 100% !important; }

/* Mobile rail scrim */
.scrim {
    position: fixed;
    inset: 0;
    background: rgba(23, 21, 59, .48);
    backdrop-filter: blur(2px);
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s var(--ease), visibility .22s;
}
.scrim.is-on { opacity: 1; visibility: visible; }

/* =====================================================================
   MOTION
   ===================================================================== */
@keyframes rise      { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slide-in  { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes slide-out { to   { opacity: 0; transform: translateX(22px); } }

.reveal { animation: rise .42s var(--ease) both; }
.reveal:nth-child(1) { animation-delay: .02s; }
.reveal:nth-child(2) { animation-delay: .07s; }
.reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .17s; }
.reveal:nth-child(5) { animation-delay: .22s; }
.reveal:nth-child(6) { animation-delay: .27s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 1180px) {
    .grid-8-4, .grid-7-5 { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .rail { transform: translateX(-100%); box-shadow: none; }
    body.rail-open .rail { transform: none; box-shadow: var(--shadow-lg); }
    body.rail-narrow .rail { width: var(--rail); flex-basis: var(--rail); }
    body.rail-narrow .rail-wordmark,
    body.rail-narrow .rail-group,
    body.rail-narrow .rail-link span,
    body.rail-narrow .credit-chip .lbl { display: revert; }
    body.rail-narrow .rail-link { justify-content: flex-start; padding: 9px 20px; }
    body.rail-narrow .rail-head { justify-content: flex-start; padding: 18px 18px 16px; }
    body.rail-narrow .rail-head img { width: 74px; flex-basis: 74px; }

    .main, body.rail-narrow .main { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .page { padding: 18px 15px; }
    .topbar { padding: 0 15px; gap: 10px; }
    .page-head h2 { font-size: 21px; }
    .page-head .actions { margin-left: 0; width: 100%; }
    .usermenu-meta { display: none; }
    .usermenu-btn { padding: 4px; border-color: transparent; }
    .toasts { top: 74px; left: 14px; right: 14px; max-width: none; }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 11px; }
    .metric { padding: 14px 15px 13px 26px; }
    .metric .m-value { font-size: 24px; }
    .field-row { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 3px 0; }
    .kv dd { margin-bottom: 11px; }
    .auth-card { padding: 32px 24px 26px; }
    .codes { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .metric .m-label { font-size: 9px; letter-spacing: .13em; }
    table.data thead th, table.data tbody td { padding: 10px 12px; }
    .hide-xs { display: none !important; }
}

/* =====================================================================
   PRINT — reports go to the GM's printer looking like a report
   ===================================================================== */
@media print {
    .rail, .topbar, .toasts, .actions, .scrim, .btn { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    .page { padding: 0; }
}

/* =====================================================================
   TABS — section navigation within a company
   ===================================================================== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-mid);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .14s var(--ease), border-color .14s var(--ease);
}
.tab i { font-size: 12.5px; opacity: .75; }
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--indigo); border-bottom-color: var(--indigo); }
.tab.is-on i { opacity: 1; }

/* =====================================================================
   PAYSLIP
   ---------------------------------------------------------------------
   Everything below is scoped to .ps so it cannot leak into the app
   chrome, and so Stage 4 can lift this block wholesale into the PDF
   stylesheet. Colours come from the per-company custom properties set
   inline by render_payslip(), which is why nothing here hardcodes a
   brand colour.
   ===================================================================== */
.ps-stage {
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 4px;
}

.ps {
    --ps-primary: #393185;
    --ps-accent:  #EF7F1A;
    --ps-font:    'Helvetica Neue', Arial, sans-serif;
    --ps-size:    9px;

    width: 100%;
    max-width: 720px;
    background: #fff;
    color: #1A1A22;
    font-family: var(--ps-font);
    font-size: var(--ps-size);
    line-height: 1.4;
    border: 1px solid #D8D6E2;
    box-shadow: 0 8px 28px rgba(23, 21, 59, .10);
    position: relative;
    overflow: hidden;
}

.ps-accentbar {
    height: 6px;
    background: linear-gradient(90deg, var(--ps-primary) 0 68%, var(--ps-accent) 68% 100%);
}
.ps-rule {
    height: 2px;
    margin: 0 18px;
    background: linear-gradient(90deg, var(--ps-primary), var(--ps-accent));
}

/* ---- Masthead ---- */
.ps-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px 12px;
}
.ps-head-flip { flex-direction: row-reverse; }
.ps-head-flip .ps-who { text-align: left; }

.ps-logo { flex: 0 0 auto; }
.ps-logo img { width: 74px; height: 52px; object-fit: contain; }
.ps-logo-fallback {
    width: 52px; height: 52px;
    border-radius: 8px;
    display: grid; place-items: center;
    background: var(--ps-primary);
    color: #fff;
    font-size: calc(var(--ps-size) + 6px);
    font-weight: 700;
    letter-spacing: .02em;
}

.ps-title { flex: 1 1 auto; min-width: 0; }
.ps-title h1 {
    font-family: var(--ps-font);
    font-size: calc(var(--ps-size) + 6px);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ps-primary);
    margin: 0;
    line-height: 1.2;
}
.ps-doc {
    margin: 2px 0 0;
    font-size: calc(var(--ps-size) + 1px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .13em;
    color: var(--ps-accent);
}
.ps-period { margin: 1px 0 0; color: #6B6880; }

.ps-who { text-align: right; flex: 0 0 auto; }
.ps-who strong { display: block; font-size: calc(var(--ps-size) + 2px); }
.ps-who span { color: #6B6880; }

/* ---- Employee detail grid ---- */
.ps-meta {
    --cols: 3;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: 1px;
    background: #E4E2EC;
    border-top: 1px solid #E4E2EC;
    border-bottom: 1px solid #E4E2EC;
}
.ps-meta-cell { background: #FAFAFC; padding: 6px 10px; min-width: 0; }
.ps-meta-cell .k {
    display: block;
    font-size: calc(var(--ps-size) - 1.5px);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #85829B;
}
.ps-meta-cell .v {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Currency band (multi-currency runs) ---- */
.ps-curband {
    background: var(--ps-primary);
    color: #fff;
    padding: 4px 18px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-size: calc(var(--ps-size) - .5px);
}

/* ---- Earnings / deductions ---- */
.ps-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.ps-cols .ps-table + .ps-table { border-left: 1px solid #E4E2EC; }

.ps-table { width: 100%; border-collapse: collapse; }
.ps-table th {
    text-align: left;
    padding: 5px 10px;
    background: #F2F1F7;
    border-bottom: 1px solid #E4E2EC;
    font-size: calc(var(--ps-size) - 1px);
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #56536F;
    font-weight: 600;
}
.ps-table td {
    padding: 3.5px 10px;
    border-bottom: 1px solid #F3F2F7;
    vertical-align: top;
}
.ps-table .a { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-table .c { width: 1%; color: #85829B; white-space: nowrap; }
.ps-table .u { color: #6B6880; white-space: nowrap; }
.ps-table .dimmed { color: #9B98AE; }
.ps-table tfoot td {
    border-top: 1.5px solid var(--ps-primary);
    border-bottom: 0;
    padding-top: 5px;
    font-weight: 700;
}

/* ---- Net pay strip ---- */
.ps-net {
    display: flex;
    gap: 1px;
    background: #E4E2EC;
    border-top: 1px solid #E4E2EC;
}
.ps-net-cell {
    flex: 1;
    background: #FAFAFC;
    padding: 7px 12px;
}
.ps-net-cell .k {
    display: block;
    font-size: calc(var(--ps-size) - 1.5px);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #85829B;
}
.ps-net-cell .v {
    display: block;
    font-weight: 700;
    font-size: calc(var(--ps-size) + 2px);
    font-variant-numeric: tabular-nums;
}
.ps-net-cell.is-net { background: var(--ps-primary); }
.ps-net-cell.is-net .k { color: rgba(255, 255, 255, .68); }
.ps-net-cell.is-net .v { color: #fff; }

/* ---- Year to date ---- */
.ps-ytd { padding: 10px 18px 4px; border-top: 1px solid #E4E2EC; }
.ps-ytd h2 {
    font-size: calc(var(--ps-size) - .5px);
    text-transform: uppercase;
    letter-spacing: .13em;
    color: #85829B;
    margin: 0 0 6px;
    font-weight: 600;
    font-family: var(--ps-font);
}
.ps-ytd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 14px; }
.ps-ytd-cell { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted #DCDAE6; padding-bottom: 2px; }
.ps-ytd-cell .k { color: #6B6880; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-ytd-cell .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Bank ---- */
.ps-bank {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 8px 18px;
    border-top: 1px solid #E4E2EC;
    color: #56536F;
}
.ps-bank strong { color: #85829B; text-transform: uppercase; letter-spacing: .07em;
                  font-size: calc(var(--ps-size) - 1.5px); font-weight: 600; margin-right: 4px; }

/* ---- Footer ---- */
.ps-foot { padding: 9px 18px 13px; border-top: 1px solid #E4E2EC; }
.ps-note {
    margin: 0 0 7px;
    padding: 5px 9px;
    background: #FBF3E8;
    border-left: 2px solid var(--ps-accent);
    color: #7A5418;
    font-size: calc(var(--ps-size) - .5px);
}
.ps-foot-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: #85829B;
    font-size: calc(var(--ps-size) - .5px);
}
.ps-powered { white-space: nowrap; font-weight: 600; color: var(--ps-primary); }

@media (max-width: 900px) {
    #layoutGrid { grid-template-columns: minmax(0, 1fr) !important; }
    #layoutGrid .card[style*="sticky"] { position: static !important; }
    .ps-cols { grid-template-columns: 1fr; }
    .ps-cols .ps-table + .ps-table { border-left: 0; border-top: 1px solid #E4E2EC; }
    .ps-ytd-grid { grid-template-columns: 1fr 1fr; }
    .ps-head { flex-wrap: wrap; }
    .ps-who { text-align: left; width: 100%; }
}


/* =====================================================================
   HANDOVER — the confirmation screen for reassigning a company
   ===================================================================== */
.handover {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 18px;
    background: var(--card-sunk);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.handover-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-align: center;
    min-width: 0;
}
.handover-side .lbl {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .17em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.handover-side strong { font-size: 13.5px; }
.handover-arrow { color: var(--amber); font-size: 17px; flex: 0 0 auto; }

/* Consequence lists — what moves, and what stays put */
.consequence { list-style: none; margin: 0; padding: 0; }
.consequence li {
    display: flex;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 6px;
}
.consequence li i { margin-top: 3px; flex: 0 0 15px; text-align: center; font-size: 12.5px; }
.consequence .is-change { background: var(--amber-soft); color: #7A4E10; }
.consequence .is-change i { color: var(--amber); }
.consequence .is-keep { background: var(--card-sunk); color: var(--text-mid); }
.consequence .is-keep i { color: var(--text-dim); }

/* A company somebody else already holds cannot be ticked here */
.pick.is-locked {
    opacity: .72;
    cursor: not-allowed;
    background: var(--card-sunk);
    border-style: dashed;
}
.pick.is-locked:hover { border-color: var(--line); background: var(--card-sunk); }
.pick.is-locked input { cursor: not-allowed; }
.pick-body a { display: inline-block; margin-top: 2px; font-weight: 600; }

@media (max-width: 560px) {
    .handover { flex-direction: column; gap: 12px; }
    .handover-arrow { transform: rotate(90deg); }
}

/* =====================================================================
   IMPORT WIZARD
   ===================================================================== */
.steps {
    display: flex;
    gap: 4px;
    margin-bottom: 22px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.step {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--card);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
    flex: 0 0 auto;
}
.step-dot {
    width: 22px; height: 22px;
    flex: 0 0 22px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--line-soft);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.step.is-done { color: var(--text-mid); border-color: #CFE6DA; }
.step.is-done .step-dot { background: var(--ok); color: #fff; }
a.step.is-done:hover { border-color: var(--ok); background: var(--ok-soft); }
.step.is-now {
    color: #fff;
    background: var(--indigo);
    border-color: var(--indigo);
    box-shadow: 0 2px 8px rgba(57, 49, 133, .26);
}
.step.is-now .step-dot { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---- Dropzone ---- */
.dropzone {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: var(--r-lg);
    background: var(--card-sunk);
    padding: 40px 24px;
    text-align: center;
    transition: border-color .16s var(--ease), background .16s var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--indigo); background: #F8F7FD; }
.dropzone.has-file { border-color: var(--ok); background: var(--ok-soft); border-style: solid; }
.dropzone > i { font-size: 30px; color: var(--indigo); display: block; margin-bottom: 12px; }
.dropzone strong { display: block; font-size: 15px; margin-bottom: 3px; }
.dropzone input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone-name {
    display: block;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ok);
    font-weight: 600;
}

/* ---- Mapping grid ---- */
.map-table tbody td { padding: 9px 12px; vertical-align: top; }
.map-table tr.is-flagged { background: #FEFBF4; }
.map-table tr.is-flagged:hover { background: #FDF6E9; }
.map-table tr.is-flagged td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.map-table .select, .map-table .input { width: 100%; }

/* Fill gauge beside each column */
.profile { min-width: 150px; }
.profile-bar {
    height: 5px;
    background: var(--line-soft);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-bottom: 5px;
}
.profile-bar > i {
    display: block;
    height: 100%;
    background: var(--indigo);
    border-radius: var(--r-pill);
}

@media (max-width: 900px) {
    .step-label { display: none; }
    .step { padding: 9px 11px; }
    .map-table { font-size: 12.5px; }
}

/* =====================================================================
   GENERATION
   ===================================================================== */
.genbar .meter { background: var(--line-soft); }

.genlog {
    max-height: 190px;
    overflow-y: auto;
    background: var(--ink);
    border-radius: var(--r-sm);
    padding: 10px 13px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .72);
}
.genlog-row { white-space: pre-wrap; word-break: break-word; }
.genlog-row.good { color: #6EE7B7; }
.genlog-row.bad  { color: #FCA5A5; }

/* ---- Name mapping status ---- */
.namebox {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px;
    background: var(--card-sunk);
}
.namebox.is-ok      { border-color: #BFE6D5; background: var(--ok-soft); }
.namebox.is-missing { border-color: #F3C9D1; background: var(--danger-soft); }

.namebox-head { display: flex; gap: 11px; align-items: flex-start; }
.namebox-head > i { font-size: 15px; margin-top: 2px; flex: 0 0 auto; }
.namebox.is-ok .namebox-head > i      { color: var(--ok); }
.namebox.is-missing .namebox-head > i { color: var(--danger); }
.namebox-head strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.namebox-head span { font-size: 12.5px; color: var(--text-mid); line-height: 1.5; }

.namebox-sample {
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, .07);
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.namebox-sample .lbl {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.namebox-sample .val {
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-display);
    letter-spacing: -.02em;
}

/* ---------------------------------------------------------------------
   Classic payslip — the traditional printed look.
   Overrides sit here rather than in a second template so both styles
   render from exactly the same markup and can never drift apart.
   --------------------------------------------------------------------- */
.ps-classic {
    --ps-primary: #000000;
    --ps-accent:  #000000;
    border: 1px solid #000;
    box-shadow: none;
    color: #000;
}
.ps-classic .ps-accentbar { display: none; }
.ps-classic .ps-rule { background: #000; height: 1px; margin: 0 14px; }

.ps-classic .ps-title h1 { color: #000; font-weight: 700; letter-spacing: 0; }
.ps-classic .ps-doc { color: #000; }
.ps-classic .ps-period,
.ps-classic .ps-who span,
.ps-classic .ps-meta-cell .k,
.ps-classic .ps-net-cell .k,
.ps-classic .ps-ytd h2,
.ps-classic .ps-ytd-cell .k,
.ps-classic .ps-bank,
.ps-classic .ps-bank strong,
.ps-classic .ps-foot-row,
.ps-classic .ps-table .u,
.ps-classic .ps-table .c,
.ps-classic .ps-table .dimmed { color: #000; }

.ps-classic .ps-logo-fallback { background: #fff; color: #000; border: 1px solid #000; border-radius: 0; }

.ps-classic .ps-meta { background: #000; border-color: #000; }
.ps-classic .ps-meta-cell { background: #fff; }

.ps-classic .ps-curband { background: #fff; color: #000; border-top: 1px solid #000; border-bottom: 1px solid #000; }

.ps-classic .ps-table th { background: #fff; border-bottom: 1px solid #000; color: #000; }
.ps-classic .ps-table td { border-bottom: 1px dotted #999; }
.ps-classic .ps-table tfoot td { border-top: 1px solid #000; }
.ps-classic .ps-cols .ps-table + .ps-table { border-left: 1px solid #000; }
.ps-classic .ps-pad td { border-bottom: 1px dotted #ddd; }

.ps-classic .ps-net { background: #000; border-top: 1px solid #000; }
.ps-classic .ps-net-cell { background: #fff; }
.ps-classic .ps-net-cell.is-net { background: #fff; }
.ps-classic .ps-net-cell.is-net .k,
.ps-classic .ps-net-cell.is-net .v { color: #000; }
.ps-classic .ps-net-cell.is-net { outline: 1px solid #000; outline-offset: -1px; }

.ps-classic .ps-note { background: #fff; border: 1px solid #000; border-left-width: 1px; color: #000; }
.ps-classic .ps-powered { color: #000; }
.ps-classic .ps-ytd-cell { border-bottom: 1px dotted #999; }

/* Padding rows exist only to line the two totals up */
.ps-pad td { color: transparent; }

/* =====================================================================
   MAPPING — two stages
   ===================================================================== */
.substeps { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

.substep {
    flex: 1 1 240px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.substep:hover { border-color: #CFCBE4; }
.substep-dot {
    width: 26px; height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--line-soft);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}
.substep strong { display: block; font-size: 13.5px; }
.substep em { font-style: normal; font-size: 12px; color: var(--text-dim); }

.substep.is-now { border-color: var(--indigo); background: #F8F7FD; }
.substep.is-now .substep-dot { background: var(--indigo); color: #fff; }
.substep.is-now strong { color: var(--indigo); }
.substep.is-done .substep-dot { background: var(--ok); color: #fff; }
.substep.is-incomplete .substep-dot { background: var(--danger); color: #fff; }

/* ---- Key field pickers ---- */
.keyfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }

.keyfield {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--card-sunk);
}
.keyfield.is-set { background: var(--card); border-color: #C9E9DA; }
.keyfield.is-required:not(.is-set) { border-color: #F3C9D1; background: #FEF7F8; }
.keyfield-label strong { display: block; font-size: 13px; font-weight: 600; }
.keyfield-label .req { color: var(--danger); }
.keyfield-pick { display: flex; flex-direction: column; gap: 4px; }
.keyfield-pick .select { width: 100%; font-size: 13px; padding: 7px 28px 7px 10px; }
.keyfield-sample {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    min-height: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Include switch and excluded rows ---- */
.switch-sm { width: 34px; height: 20px; flex-basis: 34px; }
.switch-sm::after { width: 14px; height: 14px; }
.switch-sm:checked::after { transform: translateX(14px); }

.map-table tr.is-excluded { background: #FAFAFC; }
.map-table tr.is-excluded td:not(:first-child) { opacity: .5; }
.map-table tr.is-excluded td:first-child { box-shadow: inset 3px 0 0 #B9B5D2; }
.map-table tr.is-excluded .map-label,
.map-table tr.is-excluded .t strong { text-decoration: line-through; }
.map-table .excl-badge { display: none; }
.map-table tr.is-excluded .excl-badge { display: inline-flex; }
.map-table tr.is-excluded.is-flagged { background: #FAFAFC; }

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-scrim {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 21, 59, .52);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s var(--ease), visibility .18s;
}
.modal-scrim.is-open { opacity: 1; visibility: visible; }
body.modal-open { overflow: hidden; }

.modal {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(10px) scale(.98);
    transition: transform .2s var(--ease);
}
.modal-scrim.is-open .modal { transform: none; }

.modal-head { display: flex; gap: 14px; padding: 22px 24px 18px; }
.modal-icon {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: #EEECF9;
    color: var(--indigo);
    font-size: 16px;
}
.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal-head h3 { font-size: 16px; margin-bottom: 5px; }
.modal-head p { margin: 0; font-size: 13.5px; color: var(--text-mid); line-height: 1.55; }

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 15px 24px;
    background: var(--card-sunk);
    border-top: 1px solid var(--line-soft);
}

@media (max-width: 560px) {
    .modal-scrim { place-items: end center; padding: 0; }
    .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
}

/* =====================================================================
   BULK SELECTION
   ===================================================================== */
.bulkbar {
    position: sticky;
    bottom: 14px;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0 0;
    padding: 12px 16px;
    background: var(--ink);
    color: #fff;
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    transform: translateY(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.bulkbar.is-on { opacity: 1; visibility: visible; transform: none; }
.bulkbar .count { font-family: var(--font-mono); font-weight: 600; font-size: 14px; }
.bulkbar .dimmed { color: rgba(255, 255, 255, .6); font-size: 12.5px; }
.bulkbar .btn-quiet { color: rgba(255, 255, 255, .78); }
.bulkbar .btn-quiet:hover { background: rgba(255, 255, 255, .1); color: #fff; }

td.pick-cell, th.pick-cell { width: 1%; padding-right: 4px; }
input.rowpick { accent-color: var(--indigo); width: 15px; height: 15px; cursor: pointer; }
tr.is-picked { background: #F4F3FC !important; }

/* =====================================================================
   ORDERING THE PAYSLIP LINES
   ===================================================================== */
.orderlist { list-style: none; margin: 0; padding: 0; counter-reset: ord; }

.orderitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line-soft);
    counter-increment: ord;
    background: var(--card);
    transition: background .25s var(--ease);
}
.orderitem:last-child { border-bottom: 0; }
.orderitem::before {
    content: counter(ord);
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
    width: 18px;
    flex: 0 0 18px;
    text-align: right;
}
.orderitem-grip { color: #C7C3DC; font-size: 12px; flex: 0 0 auto; }
.orderitem-label {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.orderitem-moves { display: flex; gap: 2px; flex: 0 0 auto; }
.orderitem-moves .icon-btn { width: 28px; height: 28px; font-size: 11px; }
.orderitem-moves .icon-btn:disabled { opacity: .25; pointer-events: none; }

/* A brief tint so the eye follows the row that just moved */
.orderitem.just-moved { background: #EEECF9; animation: settle 1s var(--ease) forwards; }
@keyframes settle { from { background: #E4E0F7; } to { background: var(--card); } }

.orderlist-empty {
    padding: 22px 14px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* =====================================================================
   PAGINATION AND SEARCH
   ===================================================================== */
.pager {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--line-soft);
    background: var(--card-sunk);
    border-radius: 0 0 var(--r) var(--r);
    font-size: 12.5px;
    color: var(--text-dim);
}
.pager-count b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.pager-links { display: flex; gap: 3px; margin-left: auto; align-items: center; }

.pager-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text-mid);
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
}
.pager-btn:hover { border-color: #CFCBE4; color: var(--text); }
.pager-btn.is-on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.pager-btn.is-off { opacity: .35; pointer-events: none; }
.pager-gap { padding: 0 3px; color: var(--text-dim); }

.searchbox { position: relative; display: flex; align-items: center; }
.searchbox > i {
    position: absolute;
    left: 12px;
    font-size: 12px;
    color: var(--text-dim);
    pointer-events: none;
}
.searchbox .input { padding-left: 33px; padding-right: 30px; width: 230px; font-size: 13px; }
.searchbox-clear {
    position: absolute;
    right: 9px;
    color: var(--text-dim);
    font-size: 12px;
}
.searchbox-clear:hover { color: var(--text); }

@media (max-width: 560px) {
    .searchbox .input { width: 100%; }
    .pager { padding: 12px 15px; }
    .pager-links { margin-left: 0; width: 100%; justify-content: center; }
}

/* ---- Payslip sections that are not this month's pay ---- */
.ps-extra { padding: 10px 18px 6px; border-top: 1px solid #E4E2EC; }
.ps-extra h2 {
    font-size: calc(var(--ps-size) - .5px);
    text-transform: uppercase;
    letter-spacing: .13em;
    color: var(--ps-primary);
    margin: 0;
    font-weight: 700;
    font-family: var(--ps-font);
}
.ps-extra-note {
    margin: 1px 0 7px;
    font-size: calc(var(--ps-size) - 1.5px);
    color: #85829B;
}
.ps-extra-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 14px; }
.ps-extra-cell {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dotted #DCDAE6;
    padding-bottom: 2px;
}
.ps-extra-cell .k { color: #6B6880; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-extra-cell .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ps-classic .ps-extra h2 { color: #000; }
.ps-classic .ps-extra-note,
.ps-classic .ps-extra-cell .k { color: #000; }
.ps-classic .ps-extra-cell { border-bottom: 1px dotted #999; }

@media (max-width: 900px) { .ps-extra-grid { grid-template-columns: 1fr 1fr; } }

/* ---- Key field groups ---- */
.keygroup { margin-bottom: 20px; }
.keygroup:last-of-type { margin-bottom: 0; }
.keygroup-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}
.keygroup-head strong { font-size: 13.5px; }
.keygroup-head .push { margin-left: auto; }
