/* Stock Manager - application chrome.
   Design: flat surfaces, hairline borders, one accent, soft elevation. No gradients
   as decoration and no blurred glass: this is a ledger the shopkeeper reads all day,
   so contrast and row rhythm come first.
   Light is the shipped palette; [data-theme="dark"] re-maps the same tokens, so every
   rule below stays colour-agnostic. */
:root {
    color-scheme: light;

    /* type */
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;

    /* brand */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-press: #1e40af;
    --accent-soft: #e4e7ef;
    --accent-soft-bd: #ccd3e2;
    --accent-ink: #ffffff;
    --brand: #23272e;

    /* text: the ink is lifted off pure black as well. Glare is a pair of problems -
       how bright the surface is, and how hard the text fights it - and a 17:1 pair
       on a 100% white card is the combination people describe as tiring */
    --ink: #23272e;
    --ink-2: #414855;
    --muted: #565b62;
    --muted-2: #676c73;

    /* surfaces: a low-chroma paper scale, not cream. Every step keeps its place in
       the elevation order - page < card < field - so the layout still reads as
       stacked sheets rather than one flat wash */
    --bg: #e9e7e0;
    --surface: #f7f5f0;
    --surface-2: #f1efe8;
    --surface-3: #e9e7e0;
    --field: #fbfaf6;
    --field-off: #eae8e1;
    --line: #dbd7cc;
    --line-2: #c5c0b2;
    --row-line: #e4e1d8;
    --row-alt: #f3f1eb;
    --row-hover: #ebe8df;
    --th-bg: #efece5;
    --head: #f2f0ea;

    /* chrome that sits on the light surface */
    --chip-bg: #ebe9e2;
    --chip-bd: #d8d5cb;
    --chip-ink: #4b5157;
    --kbd-bg: #ebe9e2;
    --kbd-bd: #d3cfc5;
    --caret: #9b978d;

    /* the splash's veil: the page background with a little depth taken out of it, so
       the screen behind is dimmed rather than blurred away */
    --veil: rgba(233, 231, 224, .975);
    /* the logo disc is no longer the brightest thing on the page */
    --mark-tile: #fbfaf6;

    /* status: the pale fills come down to the paper's own brightness too. A mint or
       blush that is lighter than the card it sits on reads as a hole punched in the
       page, which is the opposite of what a quiet status pill is for */
    --ok: #05674c;
    --ok-bg: #e0ece2;
    --ok-bd: #b3d3bd;
    --bad: #a91f1f;
    --bad-bg: #f3e5e1;
    --bad-bd: #e2bdb6;
    --amb: #8a4a10;
    --amb-bg: #f2e8d3;
    --amb-bd: #ddc294;
    --mut: #5f646c;
    --mut-bg: #ebe9e2;
    --mut-bd: #d2cec3;
    --red: #a91f1f;
    --green: #05674c;
    --amber: #8a4a10;

    /* elevation: two quiet steps, never glassy. The shadow is warmed to match, or a
       navy gloom under a paper card looks like a smudge */
    --sh-1: 0 1px 2px rgba(43, 38, 28, .07);
    --sh-2: 0 1px 2px rgba(43, 38, 28, .07), 0 8px 24px -12px rgba(43, 38, 28, .18);
    --sh-pop: 0 12px 32px -8px rgba(43, 38, 28, .22), 0 2px 6px rgba(43, 38, 28, .09);
    --ring: 0 0 0 3px rgba(37, 99, 235, .18);

    /* geometry */
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --rail-w: 236px;
    --panel-w: 214px;
}

[data-theme="dark"] {
    color-scheme: dark;

    /* brand */
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-press: #93c5fd;
    --accent-soft: #16263f;
    --accent-soft-bd: #24406b;
    --accent-ink: #0b1220;
    --brand: #e5edf8;

    /* text */
    --ink: #e6edf6;
    --ink-2: #c3d0e0;
    --muted: #93a3b8;
    --muted-2: #6d8098;

    /* surfaces */
    --bg: #0b1120;
    --surface: #111a2b;
    --surface-2: #142034;
    --surface-3: #18263c;
    --field: #0f1727;
    --field-off: #18263c;
    --line: #223047;
    --line-2: #2f4160;
    --row-line: #1c2940;
    --row-alt: #131e30;
    --row-hover: #17283f;
    --th-bg: #16223a;
    --head: #131e30;

    --chip-bg: #18263c;
    --chip-bd: #2b3d5a;
    --chip-ink: #b3c3d8;
    --kbd-bg: #18263c;
    --kbd-bd: #2f4160;
    --caret: #7f93ad;

    --veil: rgba(11, 17, 32, .98);
    /* the wave in the logo is dark blue and pale stripe alike, so on a dark screen it
       sits on its own light tile rather than being recoloured - the mark stays the
       mark in both themes */
    --mark-tile: #f8fafc;

    /* status */
    --ok: #4ade80;
    --ok-bg: #10281f;
    --ok-bd: #1f5340;
    --bad: #fca5a5;
    --bad-bg: #2b1417;
    --bad-bd: #5b2a30;
    --amb: #fcd34d;
    --amb-bg: #2a2011;
    --amb-bd: #5c461f;
    --mut: #9fb1c7;
    --mut-bg: #182436;
    --mut-bd: #2c3d56;
    --red: #fca5a5;
    --green: #4ade80;
    --amber: #fcd34d;

    /* elevation */
    --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sh-2: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .8);
    --sh-pop: 0 16px 40px -10px rgba(0, 0, 0, .75), 0 2px 8px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(59, 130, 246, .28);
}

/* ---------- base ---------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button {
    font: inherit;
    color: inherit;
}

svg {
    width: 16px;
    height: 16px;
    display: block;
    flex: 0 0 auto;
}

/* ================= RATES =================
   A rupee figure the shopkeeper reads off a shelf, so it keeps tabular digits and
   stays in the ink colour a quantity uses rather than the grey of a count: an
   unpriced item shows a dash, because zero would be a price and a dash is not. */
.tbl td.rate,
.tbl td.val {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tbl td.rate .sub {
    font-size: 10.5px;
    margin-top: 1px;
}

.unpriced {
    color: var(--muted-2);
    font-weight: 400;
}

/* the words, not the dash: set smaller so the column is sized by the money in it
   rather than by the explanation of its absence */
.unpriced.txt {
    font-size: 10px;
    letter-spacing: .02em;
}

.hidden {
    display: none !important;
}

.spacer {
    flex: 1 1 auto;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ctr {
    text-align: center;
}

.name {
    font-weight: 600;
    color: var(--ink);
}

.sub {
    color: var(--muted);
}

.neg {
    color: var(--red);
}

.pos {
    color: var(--green);
}

/* ---------- shell ---------- */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ---------- top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 56px;
    flex: 0 0 56px;
    background: var(--surface);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-1);
    z-index: 5;
}

.tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--chip-bg);
    border: 1px solid var(--chip-bd);
    color: var(--chip-ink);
    border-radius: var(--r-sm);
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .12s, color .12s, border-color .12s;
}

.tb-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-soft-bd);
    color: var(--accent);
}

.tb-btn:active {
    transform: translateY(1px);
}

.tb-btn svg {
    width: 17px;
    height: 17px;
}

.tb-btn svg[hidden] {
    display: none;
}

.company {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.company .mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: var(--sh-1);
}

.company .mark svg {
    width: 19px;
    height: 19px;
}

.company .cname {
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company .cyear {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* busy indicator */
.busy {
    display: none;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--muted);
    padding: 4px 10px 4px 8px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-bd);
    border-radius: 999px;
    color: var(--accent);
}

.busy.on {
    display: inline-flex;
}

.spin {
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: .85;
    animation: sp .7s linear infinite;
}

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

/* sync chip */
.sync {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-bd);
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--chip-ink);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .12s, background .12s;
}

.sync:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.sync b {
    font-weight: 650;
    letter-spacing: -.005em;
}

.sync .sdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
    flex: 0 0 auto;
}

.sync.ok .sdot {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.sync.amb .sdot {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}

.sync.bad .sdot {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}

.sync.busy .sdot {
    background: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: .35;
    }

    50% {
        opacity: 1;
    }
}

.sync .sage {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--chip-bd);
    padding-left: 7px;
    margin-left: 1px;
}

.tb-date {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
    padding-left: 10px;
    border-left: 1px solid var(--line);
}

.tb-date b {
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.tb-date span {
    font-size: 10.5px;
    color: var(--muted);
    letter-spacing: .02em;
}

/* ---------- body ---------- */
.body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

/* ---------- nav rail ---------- */
.rail {
    flex: 0 0 var(--rail-w);
    background: var(--surface);
    color: var(--ink-2);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
    border-right: 1px solid var(--line);
    transition: flex-basis .16s ease;
}

.rail.mini {
    flex-basis: 58px;
}

.rail.mini .grp-title,
.rail.mini .nav-item .lbl,
.rail.mini .nav-item .kbd {
    display: none;
}

.rail.mini .nav-item {
    justify-content: center;
    padding: 9px 0;
}

.grp-title {
    padding: 12px 10px 6px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted-2);
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: none;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.nav-item svg {
    width: 17px;
    height: 17px;
    color: var(--muted);
    transition: color .12s;
}

.nav-item:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.nav-item:hover svg {
    color: var(--ink-2);
}

.nav-item.sel {
    background: var(--accent-soft);
    border-color: var(--accent-soft-bd);
    color: var(--accent);
    font-weight: 650;
}

.nav-item.sel svg {
    color: var(--accent);
}

.nav-item .kbd {
    margin-left: auto;
    font-size: 10px;
    font-family: var(--mono);
    color: var(--muted-2);
}

/* ---------- stage ---------- */
.stage {
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
    background: var(--bg);
    padding: 16px;
}

.sheet {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-2);
    margin-bottom: 16px;
    overflow: hidden;
}

.rpt-head {
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--head);
}

.rpt-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
}

.rpt-head p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--muted);
    max-width: 74ch;
}

/* ---------- toolbar ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.toolbar .lab {
    font-size: 10.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 650;
}

.toolbar .field {
    min-width: 190px;
}

/* ---------- fields ---------- */
.field {
    background: var(--field);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    padding: 6px 10px;
    font: inherit;
    font-size: 12.5px;
    color: var(--ink);
    min-height: 30px;
    transition: border-color .12s, box-shadow .12s, background .12s;
}

.field::placeholder {
    color: var(--muted-2);
}

.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
    background: var(--field);
}

.field:disabled {
    background: var(--field-off);
    color: var(--muted);
    cursor: not-allowed;
}

.field.num {
    font-variant-numeric: tabular-nums;
    /* the native spinner sits inside the box: leave it room so a typed quantity
       is never hidden behind the arrows */
    padding-right: 26px;
}

/* the calendar glyph is black by default, which reads as broken on a dark field */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .55;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: .9;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: .6;
}

/* search field with its icon tucked inside */
.search {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 210px;
}

.search svg {
    position: absolute;
    left: 9px;
    width: 15px;
    height: 15px;
    color: var(--muted-2);
    pointer-events: none;
}

.search .field {
    padding-left: 30px;
    width: 100%;
    min-width: 0;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    min-height: 30px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--sh-1);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 550;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}

.btn svg {
    width: 15px;
    height: 15px;
    color: var(--muted);
}

.btn:hover {
    background: var(--surface-3);
    border-color: var(--line-2);
    color: var(--ink);
}

.btn:hover svg {
    color: var(--ink-2);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-color: var(--accent);
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    box-shadow: var(--sh-1);
}

.btn.primary svg {
    color: var(--accent-ink);
}

.btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-ink);
}

.btn.primary:active {
    background: var(--accent-press);
}

.btn .kb {
    margin-left: 2px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-bd);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.4;
}

.btn.primary .kb {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .28);
    color: var(--accent-ink);
}

/* a bare text action inside a table row */
.lnk {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 0;
    padding: 4px 8px;
    border-radius: 5px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, color .12s;
}

.lnk svg {
    width: 13px;
    height: 13px;
    opacity: .8;
}

.lnk:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.lnk.green {
    color: var(--green);
}

.lnk.green:hover {
    background: var(--ok-bg);
}

/* ---------- tables ---------- */
.tbl-scroll {
    overflow-x: auto;
}

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.tbl thead th {
    background: var(--th-bg);
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding: 9px 12px;
    font-weight: 650;
    font-size: 10.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.tbl thead th.num {
    text-align: right;
}

.tbl thead th.ctr {
    text-align: center;
}

.tbl tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--row-line);
    white-space: nowrap;
    color: var(--ink-2);
}

/* The ledger is the widest table in the app - ten columns on a shop screen that is
   often 1366px - so its cells earn tighter sides than the rest. Without this the
   rate column pushed the entry number and the Alter button off a 1280px screen;
   with it the table fits from about 1305px up, and everything below that scrolls
   inside its own frame the way a long narration already did before rates existed. */
#screen-stock .tbl thead th,
#screen-stock .tbl tbody td {
    padding-left: 6px;
    padding-right: 6px;
}

#screen-stock .tbl thead th:first-child,
#screen-stock .tbl tbody td:first-child {
    padding-left: 10px;
}

#screen-stock .tbl thead th:last-child,
#screen-stock .tbl tbody td:last-child {
    padding-right: 10px;
}

/* Narration is the only column whose length is whatever the shopkeeper happened to
   type, so it is the one that gets a ceiling: a 40-word note would otherwise push
   the entry number and the Alter button off the screen. The whole text stays on the
   row's tooltip and in the search box, which already reads the narration. */
#screen-stock .tbl td.narr {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.tbl tbody tr:nth-child(even) {
    background: var(--row-alt);
}

.tbl tbody tr:hover {
    background: var(--row-hover);
}

.tbl tbody td .sub {
    font-size: 11px;
}

/* status pills */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border: 1px solid var(--mut-bd);
    border-radius: 999px;
    background: var(--mut-bg);
    color: var(--mut);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .01em;
    line-height: 1.65;
    white-space: nowrap;
}

.tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .85;
}

.tag.ok {
    background: var(--ok-bg);
    border-color: var(--ok-bd);
    color: var(--ok);
}

.tag.bad {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
    color: var(--bad);
}

.tag.amb {
    background: var(--amb-bg);
    border-color: var(--amb-bd);
    color: var(--amb);
}

.tag.mut {
    background: var(--mut-bg);
    border-color: var(--mut-bd);
    color: var(--mut);
}

/* an IN / OUT pill keeps its sign without a dot */
.tag.plain::before {
    display: none;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 40px 12px;
    text-align: center;
    color: var(--muted);
}

.empty svg {
    width: 26px;
    height: 26px;
    color: var(--muted-2);
    margin-bottom: 2px;
}

.empty b {
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
}

/* ---------- pager ---------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pager b {
    color: var(--ink);
    font-weight: 650;
}

.pager .pg {
    display: flex;
    gap: 6px;
}

.pager button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    min-height: 28px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 550;
    transition: background .12s, border-color .12s, color .12s;
}

.pager button svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
}

.pager button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.pager button:hover:not(:disabled) svg {
    color: var(--accent);
}

.pager button:disabled {
    opacity: .45;
    cursor: default;
}

/* ---------- right action panel ---------- */
.panel {
    flex: 0 0 var(--panel-w);
    background: var(--surface);
    border-left: 1px solid var(--line);
    padding: 14px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.panel .ptitle {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted-2);
    font-weight: 700;
    margin-bottom: 3px;
    padding: 0 2px;
}

.panel .btn {
    justify-content: flex-start;
    width: 100%;
}

.panel .hint {
    margin-top: auto;
    padding: 12px 2px 2px;
    font-size: 10.5px;
    color: var(--muted);
    line-height: 1.9;
}

.panel .hint kbd {
    display: inline-block;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-bd);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 5px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-2);
}

/* ---------- key bar ---------- */
.keybar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px 16px;
    flex-wrap: wrap;
    padding: 7px 14px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
}

.keybar .fk {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.keybar .fk b {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-bd);
    color: var(--ink-2);
}

.keybar .credit {
    margin-left: auto;
    color: var(--muted);
    font-size: 10.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.keybar .credit button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font-weight: 650;
    font-size: 10.5px;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.keybar .credit button:hover {
    border-bottom-color: var(--accent);
}

/* ---------- vouchers ---------- */
.v-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--head);
}

.v-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
}

.v-head .v-sub {
    font-size: 11.5px;
    color: var(--muted);
    width: 100%;
    margin-top: -2px;
}

.v-body {
    padding: 18px;
}

.v-grid {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 12px 18px;
    align-items: center;
    max-width: 860px;
}

.v-grid label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
}

.v-grid label .req {
    color: var(--red);
    margin-left: 2px;
}

/* a divider that names the block of fields under it */
.v-sec {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding: 0 0 6px;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.v-sec:first-child {
    margin-top: 0;
}

.v-grid .field {
    width: 100%;
    max-width: 340px;
}

.v-grid .pair {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 460px;
}

.v-grid .pair>div {
    flex: 1 1 150px;
    min-width: 0;
}

.v-grid .v-note {
    grid-column: 2;
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 10px 12px;
    max-width: 620px;
    line-height: 1.6;
}

.v-grid .v-note b {
    color: var(--ink);
    font-weight: 650;
}

.v-grid .v-warn {
    grid-column: 2;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--amb);
    background: var(--amb-bg);
    border: 1px solid var(--amb-bd);
    border-left: 3px solid #f59e0b;
    border-radius: var(--r);
    padding: 10px 12px;
    max-width: 620px;
    line-height: 1.55;
}

.v-grid .v-only-alter {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 12px 18px;
    align-items: center;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
    margin-top: 4px;
}

.v-grid .v-only-out {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 12px 18px;
    align-items: center;
}

/* the value line spans under the field it explains */
.v-grid .v-only-out .v-note {
    grid-column: 2;
}

.v-grid .v-only-out.hidden {
    display: none;
}

.v-grid .v-hist {
    grid-column: 1 / -1;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 14px;
    font-size: 11.5px;
    color: var(--muted);
    max-width: 860px;
}

.v-grid .v-hist b {
    color: var(--ink);
}

.v-hist .h-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) 200px;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--line);
    margin-top: 7px;
    align-items: baseline;
}

.v-hist .h-row b {
    font-weight: 650;
    color: var(--ink);
}

/* ---------- searchable dropdown ---------- */
.dd {
    position: relative;
    width: 100%;
    max-width: 340px;
}

.dd .field {
    width: 100%;
    padding-right: 30px;
}

/* the caret is the sprite's own chevron, so it recolours with the text */
.dd .dd-ico {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    color: var(--muted-2);
    pointer-events: none;
    transition: color .12s, transform .12s;
}

.dd.open .dd-ico {
    color: var(--accent);
    transform: translateY(-50%) rotate(180deg);
}

.dd .opts {
    display: none;
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 5px);
    max-height: 262px;
    overflow-y: auto;
    margin: 0;
    padding: 5px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--sh-pop);
}

.dd.open .opts {
    display: block;
}

.dd .opt {
    padding: 7px 10px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd .opt:hover,
.dd .opt.hl {
    background: var(--accent-soft);
    color: var(--accent);
}

.dd .opt.add {
    color: var(--accent);
    font-weight: 600;
}

.dd .opt.q {
    color: var(--muted-2);
    cursor: default;
    font-style: italic;
}

.dd .opt.q:hover {
    background: none;
    color: var(--muted-2);
}

/* ---------- toasts ---------- */
.toasts {
    position: fixed;
    /* clear of the action panel: a toast that covers the Accept button is a toast
       the shopkeeper reads too late */
    right: calc(var(--panel-w) + 18px);
    bottom: 56px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: min(370px, calc(100vw - 36px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    position: relative;
    padding: 11px 14px 11px 15px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--muted);
    border-radius: var(--r);
    box-shadow: var(--sh-pop);
    font-size: 12.5px;
    color: var(--ink);
    animation: pop .18s ease-out;
    line-height: 1.5;
}

.toast .ticon {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: var(--muted);
}

.toast.ok .ticon {
    color: #10b981;
}

.toast.err .ticon {
    color: #ef4444;
}

.toast.warn .ticon {
    color: #f59e0b;
}

.toast.info .ticon {
    color: var(--accent);
}

.toast.ok {
    border-left-color: #10b981;
}

.toast.err {
    border-left-color: #ef4444;
}

.toast.warn {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: var(--accent);
}

.toast.out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .24s, transform .24s;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- developer page ---------- */
.dev-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dev-head .mk {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-bd);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.dev-head .mk img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.dev-kind {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* the build stamp, set apart from the tagline by the mono face it is quoted in */
.dev-ver {
    font: 500 11px/1.5 var(--mono);
    color: var(--muted);
    margin-top: 4px;
    letter-spacing: .01em;
}

.dev-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    padding: 18px;
}

.dev-col+.dev-col>.v-sec {
    border-top: 0;
    padding-top: 0;
}

.dev-col>.v-sec:first-child {
    font-size: 10.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
    grid-column: auto;
    max-width: none;
    font-weight: 700;
}

.about-body .row {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--row-line);
    font-size: 12px;
}

.about-body .row:last-child {
    border-bottom: 0;
}

.about-body .row span {
    color: var(--muted);
    font-weight: 600;
}

.dev-cols .about-body .row>div {
    color: var(--ink);
    word-break: break-word;
}

/* ================= THE SPLASH =================
   Full-screen, dead centre, and it covers rather than blurs: no backdrop-filter
   anywhere, because the effect that sells glass is exactly the one this design is
   not using. The veil is a near-opaque wash of the page colour instead, which reads
   cleaner over a table of numbers anyway. */
.loader {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    background: var(--veil);
    opacity: 0;
    visibility: hidden;
    /* pointer-events is not an animatable property, so it flips the moment .on comes
       off. The fade and the visibility delay can stall - a tab left in the background
       freezes transitions, and a shopkeeper who opens this app in a spare tab and
       comes back to it must find the page clickable, not a veil that never finished
       leaving. This is what makes that true. */
    pointer-events: none;
    /* leaving: fade, then give up the tab order */
    transition: opacity .22s ease, visibility 0s linear .22s;
}

.loader.on {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* entering: quick, so a fast navigation does not feel like the veil is lagging */
    transition: opacity .1s ease;
}

.loader-in {
    display: grid;
    justify-items: center;
    /* the splash is a screen, not a card: it has no border and no panel behind it */
}

.loader-mark {
    width: 104px;
    height: 104px;
    object-fit: contain;
    padding: 15px;
    border-radius: 50%;
    background: var(--mark-tile);
    box-shadow: 0 0 0 1px var(--line), var(--sh-2);
    animation: markBreathe 1.7s ease-in-out infinite;
}

.loader-text {
    margin-top: 20px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
}

/* under the loading line, as asked: the mark, then what it is waiting for, then who
   built it */
.loader-brand {
    margin-top: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    color: var(--ink);
}

.loader-track {
    margin-top: 16px;
    width: 132px;
    height: 2px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
    position: relative;
}

.loader-track>i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 42%;
    border-radius: 2px;
    background: var(--accent);
    animation: trackSlide 1.15s cubic-bezier(.65, .05, .35, 1) infinite;
}

@keyframes markBreathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.045);
    }
}

@keyframes trackSlide {
    0% {
        transform: translateX(-105%);
    }

    100% {
        transform: translateX(255%);
    }
}

/* The splash still has to say something when it cannot move, so the veil and the
   mark stay and only the motion goes: an unanimated bar reads as "waiting", which
   is the whole message. */
@media (prefers-reduced-motion: reduce) {
    .loader-mark {
        animation: none;
    }

    .loader-track>i {
        animation: none;
        width: 100%;
        opacity: .45;
    }

    .loader {
        transition: none;
    }

    .spin {
        animation: none;
    }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
    :root {
        --rail-w: 60px;
    }

    .rail .grp-title,
    .rail .nav-item .lbl,
    .rail .nav-item .kbd {
        display: none;
    }

    .rail .nav-item {
        justify-content: center;
        padding: 9px 0;
    }

    :root {
        --panel-w: 186px;
    }
}

@media (max-width: 900px) {
    .sync .sage {
        display: none;
    }

    .tb-date {
        display: none;
    }

    .panel {
        flex-basis: 172px;
    }

    .v-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .v-grid label {
        margin-top: 8px;
    }

    .v-grid .v-note,
    .v-grid .v-warn,
    .v-grid .v-only-alter,
    .v-grid .v-only-out {
        grid-column: 1;
    }

    .v-grid .v-only-alter,
    .v-grid .v-only-out {
        grid-template-columns: minmax(0, 1fr);
    }

    .v-hist .h-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
    }
}

@media (max-width: 720px) {
    .stage {
        padding: 10px;
    }

    .topbar {
        gap: 7px;
        padding: 0 9px;
    }

    .company .cyear {
        display: none;
    }

    .body {
        flex-direction: column;
    }

    .rail {
        flex: 0 0 auto;
        width: 100%;
        display: flex;
        /* wraps rather than scrolls: as a scrolling strip the fourth report was
           simply not there until someone guessed to drag the row sideways, and a
           shopkeeper cannot see a tab they have to swipe to discover */
        flex-wrap: wrap;
        gap: 5px;
        padding: 7px 9px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow-x: visible;
    }

    .rail .grp-title {
        display: none;
    }

    .rail .nav-item {
        width: auto;
        margin: 0;
        padding: 7px 11px;
        /* share the row rather than each taking its own width, so two sit side by
           side and every report stays on screen at once */
        flex: 1 1 auto;
        justify-content: center;
    }

    .rail .nav-item .lbl {
        display: inline;
        font-size: 12px;
    }

    .panel {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 10px;
        gap: 7px;
    }

    .panel .ptitle {
        width: 100%;
        margin: 0;
    }

    .panel .btn {
        width: auto;
        flex: 1 1 auto;
    }

    .panel .hint {
        display: none;
    }

    .toasts {
        /* the panel has moved under the report here, so the toasts go to the top:
           nothing they say should hide the buttons they are about */
        left: 10px;
        right: 10px;
        top: 62px;
        bottom: auto;
        width: auto;
    }

    .keybar {
        font-size: 10.5px;
        gap: 3px 10px;
    }

    .tbl-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- print ---------- */
@media print {

    .topbar,
    .rail,
    .panel,
    .keybar,
    .toasts,
    .toolbar,
    .pager {
        display: none !important;
    }

    .app,
    .body,
    .stage {
        display: block;
        height: auto;
        overflow: visible;
        background: #fff;
    }

    .sheet {
        border: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .tbl thead th {
        position: static;
    }
}
/* ================= SIGN-IN GATE =================
   The one screen the app shows before it knows who is typing. It reuses the same
   tokens as the ledger, so a shop that lives in dark mode never sees a white card
   flash at them on the way in. */
body.locked .app {
    display: none;
}

.gate {
    position: fixed;
    inset: 0;
    z-index: 320;
    display: none;
    place-items: center;
    padding: 18px;
    background: var(--bg);
}

.gate.on {
    display: grid;
}

.gate-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-2);
    overflow: hidden;
}

.gate-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--head);
}

.gate-mark {
    width: 44px;
    height: 38px;
    object-fit: contain;
    flex: 0 0 auto;
}

.gate-head h1 {
    margin: 0;
    font-size: 17px;
    letter-spacing: -.01em;
    color: var(--ink);
}

.gate-head p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
}

.gate-body {
    padding: 18px 20px 20px;
    display: grid;
    gap: 6px;
}

.gate-body label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-top: 6px;
}

.gate-body .field {
    min-height: 36px;
    font-size: 14px;
}

.btn.wide {
    justify-content: center;
    width: 100%;
    min-height: 36px;
    margin-top: 14px;
    font-size: 13.5px;
}

.gate-note {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid var(--bad-bd);
    border-radius: var(--r-sm);
    background: var(--bad-bg);
    color: var(--bad);
    font-size: 12px;
    line-height: 1.45;
}

.gate-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--row-line);
    font-size: 11.5px;
}

/* The gate note answers both a refusal and a success, and a green box on this paper
   would look like a different kind of control. The border carries the difference. */
.gate-note.ok {
    border-color: var(--ok-bd);
    background: var(--ok-bg);
    color: var(--ok);
}

/* A password typed on a phone, in daylight, at a counter, with no way to check it.
   The eye sits inside the field's row rather than under it, because a control two
   lines below the thing it reveals is a control people do not find. */
.pw-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pw-row .field {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-eye {
    flex: 0 0 auto;
    font-size: 11px;
    letter-spacing: .02em;
    padding: 4px 6px;
}

/* The activation block is a second way in, so it is divided from the first rather
   than stacked under it - two forms that both end in "sign in" need a line between
   them or the reader cannot tell which one they are filling in. */
.gate-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 4px;
    font-size: 11px;
    color: var(--muted-2);
}

.gate-sep::before,
.gate-sep::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--row-line);
}

.gate-sep span {
    flex: 0 0 auto;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

/* A code that exists once, in one answer, must not look like a caption. It is set in
   the mono face at a size that survives being read aloud over a phone. */
.act-shown {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--accent-soft-bd);
    border-radius: var(--r-sm);
    background: var(--accent-soft);
}

.act-code {
    flex: 1 1 auto;
    font-family: var(--mono);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--ink);
    user-select: all;
}

.chk {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-2);
}

/* ================= WHOSE SHOP IS THIS =================
   A caption in the single-shop build, a control in this one: the platform admin has
   to know which shop the numbers belong to without reading the page twice. */
.vendor-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--chip-bg);
}

.vs-lab {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.vendor-switch select {
    min-height: 26px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--field);
    border-color: var(--line-2);
    max-width: 220px;
}

.vs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--chip-ink);
    cursor: pointer;
}

.vs-btn svg {
    width: 15px;
    height: 15px;
}

.vs-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.role {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.role.admin {
    background: var(--amb-bg);
    border-color: var(--amb-bd);
    color: var(--amb);
}

.role.vendor {
    background: var(--ok-bg);
    border-color: var(--ok-bd);
    color: var(--ok);
}

.tb-btn.signout:hover {
    border-color: var(--bad-bd);
    color: var(--bad);
}

/* ================= PLATFORM OVERVIEW TILES ================= */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
    margin: 0 0 16px;
}

.tile {
    display: grid;
    gap: 2px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
}

.tile .tl {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.tile b {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.tile .tn {
    font-size: 11px;
    color: var(--muted);
}

.tile.bad {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
}

.tile.bad b,
.tile.bad .tn {
    color: var(--bad);
}

.tile.ok {
    background: var(--ok-bg);
    border-color: var(--ok-bd);
}

.tile.ok b,
.tile.ok .tn {
    color: var(--ok);
}

/* the shop the admin is standing inside, marked in its own row */
.tbl tr.sel-row td {
    background: var(--accent-soft);
}

.tbl tr.sel-row:first-child td {
    border-top: 1px solid var(--accent-soft-bd);
}

@media (max-width: 720px) {
    .gate-head {
        padding: 14px 16px;
    }

    .gate-body {
        padding: 14px 16px 18px;
    }

    .vendor-switch {
        order: 5;
    }

    .vendor-switch select {
        max-width: 130px;
    }

    .role {
        order: 6;
    }

    .tiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media print {

    .gate,
    .vendor-switch,
    .role {
        display: none !important;
    }
}

/* Platform Activity tables. The generic .tbl cells are white-space:nowrap, which is
   right for a stock row but here made a 39-character IPv6 push "From" off the screen
   and set the whole sheet scrolling. Fixed layout plus declared widths keep both
   tables inside the column they live in; the address is elided in the JS as well, so
   this is the belt. */
table.tbl.fixed {
    table-layout: fixed;
}

.tbl.fixed tbody td {
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
}

.tbl.fixed thead th {
    white-space: normal;
}

.act-tbl .c-when { width: 15%; }
.act-tbl .c-mail { width: 27%; }
.act-tbl .c-res { width: 9%; }
.act-tbl .c-why { width: 19%; }
.act-tbl .c-addr { width: 21%; }
.act-tbl .c-from { width: 9%; }

.act-tbl2 .c-when { width: 16%; }
.act-tbl2 .c-who { width: 17%; }
.act-tbl2 .c-what { width: 19%; }
.act-tbl2 .c-target { width: 26%; }
.act-tbl2 .c-detail { width: 22%; }

/* The action names and the timestamps are the two columns nobody should have to
   guess at, so they keep their own line rather than wrapping mid-word. */
.act-tbl2 tbody td:nth-child(3) {
    font-variant-numeric: tabular-nums;
}
