/* The app's one stylesheet. Tokens first (light, then dark twice: device preference and the
   per-user switch), components below. Teal is the brand, coral is "this needs you", warm greys
   carry the rest; green/amber/red are status colours and stay separate from both. */
:root {
    color-scheme: light;
    --bg: #f5f3ef;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --surface-3: #f2efe9;
    --border: #e7e2d9;
    --border-strong: #d4cdc1;
    --text: #26221e;
    --muted: #625a50;
    --faint: #7a7166;
    --input-bg: #ffffff;

    --accent: #0f6e56;
    --accent-hover: #0a5a46;
    --accent-ink: #ffffff;
    --accent-soft: #e3f4ee;
    --accent-deep: #085041;

    --coral: #b83c22;
    --coral-bright: #ec6a4c;
    --coral-ink: #ffffff;
    --coral-soft: #fdece6;
    --coral-line: #f3c5b8;

    --green: #1f7a3d;
    --green-soft: #e4f3e6;
    --green-line: #bfe0c4;
    --red: #b3202f;
    --red-soft: #fbe8ea;
    --red-line: #efc1c6;
    --amber: #8a5a00;
    --amber-soft: #fcefd0;
    --amber-line: #ecd49a;
    --blue: #2a5db0;
    --blue-soft: #e7eefa;
    --blue-line: #c3d4f0;
    --purple: #6140c0;
    --purple-soft: #eeeafb;
    --grey-soft: #eeebe5;
    --grey-text: #4d463e;

    --rail: #085041;
    --rail-accent: #f0997b;
    --rail-hover: #0f6e56;
    --rail-text: #b5d8cf;
    --rail-active: #ffffff;
    --rail-active-bg: rgba(255, 255, 255, .14);
    --doc-head: #085041;
    --chart-in: #0f6e56;
    --chart-out: #ec6a4c;
    --overlay: rgba(23, 20, 17, .5);
    --ring: 0 0 0 3px rgba(15, 110, 86, .28);

    --radius: 14px;
    --radius-sm: 9px;
    --radius-lg: 20px;
    --shadow: none;
    --shadow-lg: 0 14px 36px rgba(38, 34, 30, .16), 0 2px 6px rgba(38, 34, 30, .06);

    --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --font: "Plus Jakarta Sans", "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Dark, when the device prefers it and the user has not picked Light. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #151311;
        --surface: #1e1b18;
        --surface-2: #252220;
        --surface-3: #2d2924;
        --border: #35312b;
        --border-strong: #4a443b;
        --text: #efeae2;
        --muted: #b3aa9d;
        --faint: #988f82;
        --input-bg: #181614;
        --accent: #3cbf99;
        --accent-hover: #5fd0ad;
        --accent-ink: #04211e;
        --accent-soft: #143429;
        --accent-deep: #9fe1cb;
        --coral: #f0997b;
        --coral-bright: #ff7a59;
        --coral-ink: #2a0e07;
        --coral-soft: #3b211a;
        --coral-line: #5e3328;
        --green: #63cf8b;
        --green-soft: #16301f;
        --green-line: #244d33;
        --red: #ff8189;
        --red-soft: #3b1d21;
        --red-line: #5e2c32;
        --amber: #f2b84d;
        --amber-soft: #392b10;
        --amber-line: #5c4619;
        --blue: #82b2ff;
        --blue-soft: #1b2840;
        --blue-line: #2d426a;
        --purple: #bba6ff;
        --purple-soft: #2b2444;
        --grey-soft: #2b2824;
        --grey-text: #c9c1b5;
        --rail: #07302a;
        --rail-accent: #f0997b;
        --rail-hover: #0e4a3d;
        --rail-text: #8fc4b3;
        --rail-active-bg: rgba(255, 255, 255, .1);
        --doc-head: #085041;
        --chart-in: #3cbf99;
        --chart-out: #ff7a59;
        --overlay: rgba(0, 0, 0, .62);
        --ring: 0 0 0 3px rgba(60, 191, 153, .35);
        --shadow-lg: 0 14px 36px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #151311;
    --surface: #1e1b18;
    --surface-2: #252220;
    --surface-3: #2d2924;
    --border: #35312b;
    --border-strong: #4a443b;
    --text: #efeae2;
    --muted: #b3aa9d;
    --faint: #988f82;
    --input-bg: #181614;
    --accent: #3cbf99;
    --accent-hover: #5fd0ad;
    --accent-ink: #04211e;
    --accent-soft: #143429;
    --accent-deep: #9fe1cb;
    --coral: #f0997b;
    --coral-bright: #ff7a59;
    --coral-ink: #2a0e07;
    --coral-soft: #3b211a;
    --coral-line: #5e3328;
    --green: #63cf8b;
    --green-soft: #16301f;
    --green-line: #244d33;
    --red: #ff8189;
    --red-soft: #3b1d21;
    --red-line: #5e2c32;
    --amber: #f2b84d;
    --amber-soft: #392b10;
    --amber-line: #5c4619;
    --blue: #82b2ff;
    --blue-soft: #1b2840;
    --blue-line: #2d426a;
    --purple: #bba6ff;
    --purple-soft: #2b2444;
    --grey-soft: #2b2824;
    --grey-text: #c9c1b5;
    --rail: #07302a;
        --rail-accent: #f0997b;
    --rail-hover: #0e4a3d;
    --rail-text: #8fc4b3;
    --rail-active-bg: rgba(255, 255, 255, .1);
    --doc-head: #085041;
    --chart-in: #3cbf99;
    --chart-out: #ff7a59;
    --overlay: rgba(0, 0, 0, .62);
    --ring: 0 0 0 3px rgba(60, 191, 153, .35);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -.01em; font-optical-sizing: auto; }
h1 { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; overflow: auto; white-space: pre; }
::selection { background: var(--accent-soft); color: var(--accent-deep); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.inline { display: inline; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt-sm { margin-top: .5rem; } .mb-0 { margin-bottom: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 1rem; }
/* money and counts line up in columns */
.num, .stat-value, .bank-balance, .totals td:last-child, .unbilled-total, .money { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; }

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

/* ---------------------------------------------------------------- shell: icon rail, top bar */
.shell { display: flex; min-height: 100vh; }
.rail { width: 68px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: .8rem 0 .7rem; position: sticky; top: 0; height: 100vh; z-index: 45; }
.rail-brand { width: 42px; height: 42px; border-radius: 50%; display: block; margin-bottom: .7rem; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .22); }
.rail-brand img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.rail-brand:hover { box-shadow: 0 0 0 2px rgba(255, 255, 255, .45); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--coral-bright); color: #2a0e07 !important; display: inline-grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 1rem; letter-spacing: .02em; flex: none; }
.rail-list { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; width: 100%; }
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding-top: .5rem; border-top: 1px solid rgba(255, 255, 255, .1); margin-top: .35rem; }
.rail-item { position: relative; width: 100%; display: flex; justify-content: center; }
.rail-btn { position: relative; width: 46px; height: 46px; border-radius: 13px; border: 0; background: transparent; color: var(--rail-text); display: grid; place-items: center; cursor: pointer; font: inherit; text-decoration: none !important; padding: 0; }
.rail-btn:hover, .rail-item.open > .rail-btn { background: var(--rail-hover); color: #fff; }
.rail-btn.active { background: var(--rail-active-bg); color: var(--rail-active); }
.rail-btn.active::before { content: ""; position: absolute; left: -11px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rail-accent); }
.rail-btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.rail-label { display: none; }
.rail-count { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--rail-accent); color: #2a0e07; font-size: .7rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.rail-more { display: none; }
/* tooltip with the area name (flyout areas show their panel instead) */
.rail-btn[data-tip]::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); background: var(--text); color: var(--bg); font-size: .82rem; font-weight: 600; padding: .3rem .6rem; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 80; }
.rail-btn[data-tip]:hover::after, .rail-btn[data-tip]:focus-visible::after { opacity: 1; }
.rail-item.has-fly:hover > .rail-btn::after, .rail-item.has-fly.open > .rail-btn::after { opacity: 0; }

/* flyout panel listing an area's pages */
.fly { display: none; position: fixed; left: 76px; min-width: 232px; max-width: 300px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .45rem; z-index: 70; text-align: left; }
.fly::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }
.fly-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; padding: .45rem .65rem .4rem; color: var(--text); }
.fly a { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .48rem .65rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; }
.fly a:hover { background: var(--surface-3); }
.fly a.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.rail-item.open > .fly { display: block; }
@media (hover: hover) and (pointer: fine) { .rail-item.has-fly:hover > .fly { display: block; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; padding: 0 1.6rem; position: sticky; top: 0; z-index: 30; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.menu-toggle { display: none; }
.wordmark { display: inline-flex; align-items: center; margin-right: .5rem; }
.wordmark img { height: 26px; width: auto; display: block; }
.logo-dark { display: none !important; }
@media (max-width: 1180px) { .wordmark { display: none; } }
.org-btn { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); background: var(--surface); padding: .3rem .65rem .3rem .35rem; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; color: var(--text); max-width: 280px; }
.org-btn:hover { border-color: var(--border-strong); }
.org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; flex: none; }
.org-avatar.sm { width: 24px; height: 24px; font-size: .66rem; margin-right: .5rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent-deep); font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; }
.avatar:hover { background: var(--accent-soft); }
.vms-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .28rem .65rem; border-radius: 999px; background: var(--green-soft); color: var(--green); text-decoration: none !important; white-space: nowrap; }
.vms-pill.vms-mock { background: var(--purple-soft); color: var(--purple); }
.vms-pill.vms-alert { background: var(--coral-soft); color: var(--coral); }
.content { padding: 1.9rem 2rem 4rem; max-width: 1440px; width: 100%; }

/* command bar: the field in the top bar opens the palette */
.cmd-trigger { flex: 1; max-width: 480px; display: flex; align-items: center; gap: .55rem; height: 40px; padding: 0 .5rem 0 .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font: inherit; cursor: pointer; text-align: left; text-decoration: none !important; }
.cmd-trigger:hover { border-color: var(--border-strong); color: var(--text); }
.cmd-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 600 .72rem var(--font); padding: .1rem .42rem; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.cmd { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem; }
.cmd[hidden] { display: none; }
.cmd-scrim { position: absolute; inset: 0; background: var(--overlay); }
.cmd-box { position: relative; width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmd-input-row { display: flex; align-items: center; gap: .65rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); color: var(--muted); }
.cmd-input-row input { flex: 1; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent !important; padding: .2rem 0 !important; font-size: 1.05rem; color: var(--text); width: 100%; }
.cmd-list { list-style: none; margin: 0; padding: .4rem; overflow-y: auto; flex: 1; }
.cmd-group { padding: .6rem .7rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.cmd-opt { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.cmd-opt .icon { color: var(--muted); }
.cmd-opt-main { flex: 1; min-width: 0; }
.cmd-opt-main strong { font-weight: 600; }
.cmd-opt-sub { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-opt[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.cmd-opt[aria-selected="true"] .icon, .cmd-opt[aria-selected="true"] .cmd-opt-sub { color: var(--accent-deep); }
.cmd-opt mark { background: var(--coral-soft); color: var(--coral); border-radius: 3px; padding: 0 1px; }
.cmd-empty { padding: 1.4rem 1rem; text-align: center; color: var(--muted); }
.cmd-foot { display: flex; gap: 1rem; align-items: center; padding: .55rem 1rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); background: var(--surface-2); }

/* dropdowns */
.dropdown { position: relative; }
.menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; z-index: 50; }
.menu-right { left: auto; right: 0; }
.menu-wide { min-width: 540px; }
.dropdown.open > .menu { display: block; }
.menu-item { display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; padding: .5rem .65rem; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.current { background: var(--accent-soft); color: var(--accent-deep); }
.menu-item .muted { margin-left: auto; }
.menu-item.danger { color: var(--red); }
.menu-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: .5rem .65rem .25rem; font-weight: 700; }
.menu-sep { border-top: 1px solid var(--border); margin: .35rem 0; }
.menu-head { padding: .5rem .65rem .65rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; }
.menu-theme { padding: .4rem .65rem .5rem; }
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .84rem; font-weight: 600; padding: .32rem .8rem; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent-deep); box-shadow: 0 0 0 1px var(--border-strong); }
.menu-theme .seg { display: flex; }
.menu-theme .seg-btn { flex: 1; justify-content: center; padding: .32rem .3rem; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none !important; } :root:not([data-theme="light"]) .logo-dark { display: block !important; } }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

/* phones: the "More" sheet behind the bottom tab bar */
.sheet { position: fixed; inset: 0; z-index: 90; }
.sheet[hidden] { display: none; }
.sheet-scrim { position: absolute; inset: 0; background: var(--overlay); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: .5rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: .35rem auto .8rem; }
.sheet h3 { margin: 1rem 0 .3rem; font-size: 1rem; color: var(--muted); }
.sheet a { display: flex; align-items: center; gap: .7rem; padding: .7rem .4rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; border-bottom: 1px solid var(--border); }
.sheet a.active { color: var(--accent-deep); font-weight: 600; }
.sheet a .icon { color: var(--muted); }

/* ---------------------------------------------------------------- page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; align-items: center; gap: .3rem; font-size: .86rem; color: var(--muted); margin-bottom: .3rem; }
.crumbs a { color: var(--muted); }

/* flat cards: a hairline border, no shadow */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.3rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.3rem; }
.card-body.tight { padding: 0; }
.card-foot { padding: .85rem 1.3rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }

/* stat tiles */
.stat { padding: 1.15rem 1.3rem; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-value { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin-top: .2rem; letter-spacing: -.01em; }
.stat-sub { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.stat-value.neg { color: var(--red); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.3; transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--green); border-color: var(--green); color: var(--surface); }
.btn-success:hover { background: var(--green); filter: brightness(.92); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--grey-soft); }
.btn-sm { padding: .3rem .75rem; font-size: .88rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1.05rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: .35rem; border-radius: var(--radius-sm); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--grey-soft); color: var(--text); }
.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------------------------------------------------------------- badges */
.badge { font-family: var(--font); display: inline-flex; align-items: center; gap: .25rem; padding: .14rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
.badge-grey { background: var(--grey-soft); color: var(--grey-text); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-coral { background: var(--coral-soft); color: var(--coral); }
.badge-teal { background: var(--accent-soft); color: var(--accent-deep); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; background: transparent; white-space: nowrap; border-bottom: 1px solid var(--border-strong); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-3); }
.table tr.clickable { cursor: pointer; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table td.neg { color: var(--red); }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.table .sub-row td { padding-top: 0; border-top: 0; }
.table-compact th, .table-compact td { padding: .5rem .8rem; }
.table tr.total td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.table tr.group td { font-weight: 600; background: var(--surface-2); }
.card > .table tfoot tr:last-child td:first-child, .table-wrap > .table tfoot tr:last-child td:first-child { border-bottom-left-radius: calc(var(--radius) - 1px); }
.card > .table tfoot tr:last-child td:last-child, .table-wrap > .table tfoot tr:last-child td:last-child { border-bottom-right-radius: calc(var(--radius) - 1px); }
.table tr.indent td:first-child { padding-left: 1.8rem; }
.table a.row-link { color: var(--text); font-weight: 600; }
.table a.row-link:hover { color: var(--accent); }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.3rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.3rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem 1.3rem; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .32rem; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.req { color: var(--coral); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], input:not([type]), select, textarea {
    width: 100%; padding: .55rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; color: var(--text); background: var(--input-bg); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: var(--ring); }
input[readonly] { background: var(--surface-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
textarea { resize: vertical; }
select { padding-right: 1.6rem; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400 !important; cursor: pointer; }
.check input { margin-top: .2rem; width: auto; }
.form-actions { display: flex; gap: .6rem; align-items: center; padding-top: 1.1rem; margin-top: 1.1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: .9rem 1.3rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; align-items: center; z-index: 5; border-radius: 0 0 var(--radius) var(--radius); }
.input-group { display: flex; }
.input-group > * + * { margin-left: -1px; }
.input-group .addon { padding: .55rem .75rem; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); white-space: nowrap; }
.input-group > :first-child:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :last-child:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .35rem; }

/* line item editor */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; text-align: left; padding: .55rem .45rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.lines td { padding: .45rem .35rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines .num { text-align: right; }
.lines input, .lines select { padding: .42rem .5rem; }
.lines .col-item { min-width: 220px; }
.lines .col-qty { width: 80px; }
.lines .col-rate { width: 115px; }
.lines .col-disc { width: 70px; }
.lines .col-tax { width: 150px; }
.lines .col-acc { width: 190px; }
.lines .col-amt { width: 115px; text-align: right; font-variant-numeric: tabular-nums; padding-top: .7rem; font-weight: 600; }
.lines .col-del { width: 34px; }
.lines textarea { margin-top: .3rem; font-size: .9rem; min-height: 34px; }
.line-stock { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.totals { width: 100%; max-width: 380px; margin-left: auto; border-collapse: collapse; }
.totals td { padding: .4rem .4rem; }
.totals td:last-child { text-align: right; }
.totals tr.grand td { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; border-top: 2px solid var(--border-strong); padding-top: .65rem; }
.totals input { max-width: 120px; text-align: right; }

/* ---------------------------------------------------------------- misc components */
.flash { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.flash-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.flash-info { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.flash-warning { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.flash-close { margin-left: auto; border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .7; }
.notice { padding: .8rem 1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--border); }
.notice-warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.notice-danger { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.notice-ok { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: .6rem .95rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-deep); border-bottom-color: var(--coral-bright); }
.filterbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.filterbar select, .filterbar input { width: auto; }
.filterbar input[type=search] { min-width: 240px; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; padding: .85rem 1.1rem; color: var(--muted); font-size: .9rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .icon { color: var(--faint); margin-bottom: .6rem; }
.empty h3 { color: var(--text); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .45rem .8rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .55rem 0 .55rem 1.1rem; border-left: 2px solid var(--border); position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .9rem; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.dl-list { display: flex; flex-direction: column; gap: .35rem; }
.chart-box { height: 240px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 0 .25rem; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar-chart .bar { width: 42%; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar-chart .bar.in { background: var(--chart-in); }
.bar-chart .bar.out { background: var(--chart-out); }
.bar-chart .lbl { font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* document view ("paper"): always light, like the PDF it previews, whatever theme the app is in */
.paper, .force-light {
    color-scheme: light;
    --surface: #ffffff; --surface-2: #faf8f5; --surface-3: #f2efe9; --border: #e7e2d9; --border-strong: #d4cdc1;
    --text: #26221e; --muted: #625a50; --faint: #7a7166; --input-bg: #ffffff;
    --accent: #0f6e56; --accent-hover: #0a5a46; --accent-ink: #ffffff; --accent-soft: #e3f4ee; --accent-deep: #085041;
    --coral: #b83c22; --coral-soft: #fdece6; --coral-line: #f3c5b8;
    --green: #1f7a3d; --green-soft: #e4f3e6; --green-line: #bfe0c4;
    --red: #b3202f; --red-soft: #fbe8ea; --red-line: #efc1c6;
    --amber: #8a5a00; --amber-soft: #fcefd0; --amber-line: #ecd49a;
    --blue: #2a5db0; --blue-soft: #e7eefa; --blue-line: #c3d4f0;
    --purple: #6140c0; --purple-soft: #eeeafb; --grey-soft: #eeebe5; --grey-text: #4d463e;
    color: var(--text);
}
.paper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.4rem 2.6rem; position: relative; overflow: hidden; }
.paper-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 1.6rem; }
.paper-logo { max-height: 64px; max-width: 220px; }
.paper-title { text-align: right; }
.paper-title h2 { font-size: 1.7rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: .2rem; }
.paper .meta { display: grid; grid-template-columns: auto auto; gap: .15rem 1rem; justify-content: end; font-size: .92rem; }
.paper .meta dt { color: var(--muted); text-align: right; }
.paper .meta dd { margin: 0; text-align: right; }
.paper .bill-to { margin-bottom: 1.4rem; }
.paper table.items { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.paper table.items th { background: var(--doc-head); color: #fff; font-weight: 600; font-size: .82rem; padding: .55rem .65rem; text-align: left; }
.paper table.items td { padding: .6rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.paper table.items .num { text-align: right; white-space: nowrap; }
.paper .ribbon { position: absolute; top: 22px; left: -46px; transform: rotate(-45deg); width: 180px; text-align: center; padding: .3rem 0; color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .08em; }
.ribbon-draft { background: #6f685e; } .ribbon-paid { background: #1f7a3d; } .ribbon-void { background: #b3202f; } .ribbon-overdue { background: #8a5a00; } .ribbon-open { background: #2a5db0; }
.fiscal-box { display: flex; gap: 1.2rem; align-items: flex-start; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1rem; margin-top: 1.2rem; background: var(--surface-2); }
.fiscal-box .qr svg { width: 132px; height: 132px; display: block; background: #fff; }
.fiscal-box .kv { grid-template-columns: 150px 1fr; font-size: .88rem; }
.fiscal-box h4 { margin-bottom: .5rem; }
.not-fiscal { font-size: 1.3rem; font-weight: 800; text-align: center; border: 2px solid var(--red); color: var(--red); padding: .4rem; margin: 1rem 0; letter-spacing: .04em; }
.journal-text { font-family: var(--mono); font-size: .8rem; line-height: 1.35; white-space: pre; background: var(--surface); border: 1px solid var(--border); padding: .8rem; overflow-x: auto; }

/* auth / bare pages: deep teal with a coral glow */
body.bare { min-height: 100vh; background: radial-gradient(900px 520px at 88% -8%, rgba(236, 106, 76, .30), transparent 60%), radial-gradient(800px 560px at -8% 108%, rgba(69, 191, 177, .26), transparent 62%), var(--rail); }
.bare-main { max-width: 460px; margin: 0 auto; padding: 9vh 1rem 2rem; }
.bare-main.wide { max-width: 720px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.2rem 2rem; box-shadow: var(--shadow-lg); }
.bare-logo { display: block; text-align: center; margin: 0 0 1.6rem; }
.bare-logo img { display: inline-block; max-width: 70%; height: auto; }
.auth-brand { display: none; align-items: center; align-items: center; gap: .7rem; font-family: var(--serif); font-weight: 600; font-size: 1.45rem; letter-spacing: -.01em; margin-bottom: 1.5rem; }
.auth-card .field { margin-bottom: .95rem; }
.portal-main { max-width: 980px; margin: 0 auto; padding: 2rem 1rem; }
body.portal { background: var(--bg); }

.error-page { text-align: center; padding: 4rem 1rem; }
.error-code { font-family: var(--serif); font-size: 4.5rem; font-weight: 700; color: var(--border-strong); }

/* print */
.print-body { background: #fff; padding: 1.5rem; }
.print-toolbar { margin-bottom: 1rem; display: flex; gap: .5rem; }
@media print {
    .no-print, .rail, .topbar, .page-actions, .flash, .tabs, .filterbar, .cmd, .sheet { display: none !important; }
    body { background: #fff; color: #111; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 0; background: #fff; color: #111; }
    .paper { border: 0; box-shadow: none; padding: 0; }
}

/* responsive */
@media (max-width: 1100px) {
    .layout-side { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 640px) {
    .rail { gap: 2px; padding-top: .5rem; }
    .rail-btn { width: 40px; height: 40px; border-radius: 11px; }
    .rail-brand { width: 36px; height: 36px; margin-bottom: .3rem; }
}
@media (max-width: 860px) {
    .cmd-trigger kbd { display: none; }
    .content { padding: 1.3rem 1.1rem 5rem; }
    .topbar { padding: 0 1rem; }
    .grid-2, .grid-3, .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .menu-wide { min-width: 280px; }
    .quick-grid { grid-template-columns: 1fr; }
    .paper { padding: 1.2rem; }
    .paper-head { flex-direction: column; }
    .org-name { max-width: 120px; }
    .vms-pill { display: none; }
    h1 { font-size: 1.55rem; }
    .card > table.table { display: block; overflow-x: auto; }
}
/* phones: the rail becomes a bottom tab bar (four main areas + More) */
@media (max-width: 760px) {
    .shell { display: block; }
    .rail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: calc(62px + env(safe-area-inset-bottom)); padding: 0 .4rem env(safe-area-inset-bottom); flex-direction: row; align-items: stretch; justify-content: space-around; gap: 0; z-index: 60; border-top: 1px solid rgba(255, 255, 255, .12); }
    .rail-brand, .rail-foot, .rail-item:not(.tab-main) { display: none; }
    .rail-list { flex-direction: row; justify-content: space-around; align-items: stretch; gap: 0; }
    .rail-item { flex: 1; width: auto; }
    .rail-btn { width: 100%; height: 100%; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: transparent; }
    .rail-btn::after { display: none !important; }
    .rail-btn.active { background: transparent; color: #fff; }
    .rail-btn.active::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
    .rail-label { display: block; font-size: .68rem; font-weight: 600; line-height: 1; }
    .rail-item.rail-more { display: flex; }
    .rail-count { top: 6px; right: calc(50% - 20px); }
    .fly { left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); top: auto !important; max-width: none; max-height: 60vh; }
    .fly::before { display: none; }
    .rail-item.open > .fly { display: block; }
    .topbar { height: 56px; gap: .45rem; }
    .org-btn { max-width: 150px; }
    .cmd-trigger { height: 38px; flex: none; width: 38px; padding: 0; justify-content: center; }
    .cmd-trigger span, .cmd-trigger kbd { display: none; }
    .topbar-right { gap: .4rem; flex: none; }
    .org-switch:not(.branch-switch) .org-name { display: none; }
    .branch-switch .org-name { max-width: 84px; }
    .org-name { max-width: 100px; }
    .cmd { padding-top: 4vh; }
    .cmd-box { max-height: 80vh; }
}
/* ---- reports & dashboard */
.neg-text { color: var(--red); }
.pos-text { color: var(--green); }

/* reports index */
.report-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.report-index .card + .card { margin-top: 0; }
.report-list { list-style: none; margin: 0; padding: .35rem 0; }
.report-list li { padding: .5rem 1.1rem; }
.report-list li + li { border-top: 1px solid var(--border); }
.report-list a { font-weight: 500; }

/* report page */
.report-filters .filterbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .75rem; box-shadow: var(--shadow); }
.report-filter { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.report-filter select { max-width: 260px; }
.report-head { text-align: center; padding: 1.2rem 1rem .9rem; border-bottom: 1px solid var(--border); }
.report-head h2 { font-size: 1.3rem; margin: .15rem 0 .2rem; }
.report-org { font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; }
.report-body { padding: 0 0 .5rem; }
.report-alert { display: flex; align-items: center; gap: .5rem; margin: .9rem 1.1rem 0; }
.report-table-heading { margin: 1.2rem 1.1rem .5rem; }
.report-empty { padding: 2.5rem 1rem; text-align: center; }
.report-table { font-size: .92rem; }
.report-table td a { color: inherit; }
.report-table td a:hover { color: var(--accent); }
.report-table td.num a { color: var(--accent); }
.report-table tr.group td { text-transform: none; font-size: .9rem; border-top: 1px solid var(--border-strong); }
.report-table tr.subgroup td { font-weight: 600; color: var(--text); padding-left: 1.4rem; }
.report-table tr.indent td:first-child { padding-left: 2rem; }
.report-table tr.subtotal td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.report-table tr.total td { font-weight: 700; background: var(--surface-2); }
.report-table tr.grand td { font-weight: 700; font-size: 1.02rem; border-top: 2px solid var(--text); border-bottom: 3px double var(--text); background: var(--surface-2); }
.report-table tr.warn td { background: var(--red-soft); color: var(--red); font-weight: 700; }
.report-table tr.journal-head td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border-strong); }
.report-table tr.muted-row td { font-weight: 400; color: var(--muted); font-size: .85rem; }
.report-table tfoot tr + tr td { border-top: 0; }
.report-notes { padding: .8rem 1.1rem 0; color: var(--muted); font-size: .85rem; }
.report-notes p { margin-bottom: .4rem; }
.report-print .report-head { border-bottom: 2px solid var(--text); margin-bottom: .8rem; }
.report-print .report-alert { margin: .6rem 0; }
.report-print .report-table-heading { margin: 1rem 0 .4rem; }
.report-print .report-notes { padding: .8rem 0 0; }
.report-generated { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: .5rem; }
@media print {
    .report-print .table th { background: #fff; }
    .report-table { font-size: 10.5pt; }
    .report-table tr { page-break-inside: avoid; }
    .report-table thead { display: table-header-group; }
    .report-table a { color: inherit !important; text-decoration: none; }
    .print-body { padding: 0; }
}

/* dashboard */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.hello h1 { margin: 0 0 .15rem; font-size: 2.1rem; }
.hello-date { color: var(--muted); font-size: 1rem; }
.hello-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.today { margin-bottom: 2.2rem; }
.today-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.today-head h2 { margin: 0; font-size: 1.35rem; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.today-item { display: flex; align-items: center; gap: 1rem; padding: .95rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-left-width: 5px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; transition: border-color .12s, background-color .12s; }
.today-item:hover { background: var(--surface-2); border-color: var(--border-strong); }
.today-item:focus-visible { outline-offset: 2px; }
.today-fig { flex: none; min-width: 3.1rem; text-align: center; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; line-height: 1; padding: .55rem .4rem; border-radius: 12px; font-variant-numeric: tabular-nums; }
.today-body { flex: 1; min-width: 0; }
.today-title { display: block; font-weight: 600; line-height: 1.3; }
.today-sub { color: var(--muted); font-size: .86rem; margin-top: .15rem; }
.today-cta { flex: none; display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; font-size: .86rem; color: var(--accent-deep); }
.today-item.tone-coral { border-left-color: var(--coral-bright); }
.today-item.tone-coral .today-fig { background: var(--coral-soft); color: var(--coral); }
.today-item.tone-red { border-left-color: var(--red); }
.today-item.tone-red .today-fig { background: var(--red-soft); color: var(--red); }
.today-item.tone-amber { border-left-color: var(--amber); }
.today-item.tone-amber .today-fig { background: var(--amber-soft); color: var(--amber); }
.today-item.tone-teal { border-left-color: var(--accent); }
.today-item.tone-teal .today-fig { background: var(--accent-soft); color: var(--accent-deep); }
.today-item.tone-grey { border-left-color: var(--border-strong); }
.today-item.tone-grey .today-fig { background: var(--grey-soft); color: var(--grey-text); }
.today-clear { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.3rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface); }
.today-clear .icon { color: var(--green); }
.today-clear strong { color: var(--text); font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.section-title { font-size: 1.35rem; margin: 0 0 .8rem; }

.dash-tile { display: block; color: var(--text); text-decoration: none !important; transition: border-color .15s; }
.dash-tile:hover { border-color: var(--border-strong); }
.dash-tiles .card + .card { margin-top: 0; }
.dash-split { display: flex; height: 6px; border-radius: 3px; background: var(--grey-soft); overflow: hidden; margin: .6rem 0 .4rem; }
.dash-split .cur { background: var(--accent); }
.dash-split .late { background: var(--coral-bright); }
.dash-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .3rem; }
.dash-dot.cur { background: var(--accent); }
.dash-dot.late { background: var(--coral-bright); }
.dash-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.dash-row .card + .card, .dash-grid .card + .card { margin-top: 0; }
.dash-chart { width: 100%; height: auto; display: block; }
.dash-chart .grid { stroke: var(--border); stroke-width: 1; }
.dash-chart .base { stroke: var(--border-strong); stroke-width: 1; }
.dash-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.dash-chart .axis.faint { fill: var(--faint); font-size: 10px; }
.dash-chart .b-in { fill: var(--chart-in); }
.dash-chart .b-out { fill: var(--chart-out); }
.dash-vms .kv { grid-template-columns: 110px 1fr; }
.dash-bars { list-style: none; margin: 0 0 .75rem; padding: 0; }
.dash-bars li + li { margin-top: .75rem; }
.dash-bar { height: 6px; background: var(--grey-soft); border-radius: 3px; margin-top: .3rem; overflow: hidden; }
.dash-bar span { display: block; height: 100%; background: var(--coral-bright); border-radius: 3px; }
.dash-start { border-color: var(--accent); }
.dash-progress { height: 6px; background: var(--grey-soft); border-radius: 3px; overflow: hidden; }
.dash-progress span { display: block; height: 100%; background: var(--accent); }
.dash-checklist { list-style: none; margin: 0; padding: 0; }
.dash-checklist li { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; }
.dash-checklist li + li { border-top: 1px solid var(--border); }
.dash-checklist li.done a { color: var(--muted); text-decoration: line-through; }
.dash-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-grid; place-items: center; flex: none; color: var(--accent-ink); }
.dash-checklist li.done .dash-check { background: var(--accent); border-color: var(--accent); }
@media (max-width: 1100px) {
    .report-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-row { grid-template-columns: minmax(0, 1fr); }
    .today-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .report-index { grid-template-columns: 1fr; }
    .hello h1 { font-size: 1.7rem; }
    .today-item { padding: .85rem .9rem; gap: .8rem; }
    .today-cta span { display: none; }
}
/* ---- banking & accountant */
.bank-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.bank-cards .card + .card { margin-top: 0; }
.bank-card { display: flex; flex-direction: column; }
.bank-card .card-body { flex: 1; }
.bank-card-off { opacity: .7; }
.bank-balance { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.bank-balance.neg { color: var(--red); }
.money-in { color: var(--green); }
.stat-value.neg, .stat-value .neg { color: var(--red); }
.grid-input { width: 100%; min-width: 84px; text-align: right; padding: .32rem .45rem !important; font-variant-numeric: tabular-nums; }
.budget-grid th, .budget-grid td { padding: .3rem .3rem; }
.budget-grid .grid-input { min-width: 88px; }
.budget-grid td:first-child, .budget-grid th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 210px; box-shadow: 1px 0 0 var(--border); }
.budget-grid tr.group td:first-child { background: var(--surface-2); }
.recon-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.recon-diff.zero { color: var(--green); }
.recon-diff.off { color: var(--red); }
.panel-tabs { margin-bottom: 0; }
.panel[hidden] { display: none; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 860px) {
    .recon-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bank-cards { grid-template-columns: 1fr; }
}

/* ---- recurring & purchases */
.recur-every { display: flex; gap: .5rem; }
.recur-every input { width: 5rem; flex: none; }
.recur-every select { flex: 1; min-width: 0; }
.recur-ends { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.recur-ends .check { align-items: center; }
.recur-ends .check input { margin-top: 0; }
.recur-ends input[type=date] { flex: 1; min-width: 9.5rem; }
.recur-preview-title { font-size: .95rem; color: var(--muted); margin: 0 0 .5rem; }
.recur-upcoming { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.recur-upcoming li { padding: .35rem 0; display: flex; justify-content: space-between; align-items: center; }
.recur-upcoming li + li { border-top: 1px solid var(--border); }
.purch-progress { height: 6px; background: var(--grey-soft); border-radius: 3px; overflow: hidden; margin-top: .75rem; }
.purch-progress span { display: block; height: 100%; background: var(--green); }
.unbilled-total { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: .2rem; }
.bulk-grid th, .bulk-grid td { padding: .3rem .3rem; vertical-align: middle; }
.bulk-grid input, .bulk-grid select { width: 100%; min-width: 0; padding: .32rem .45rem; }
.bulk-grid td:nth-child(2) { min-width: 9.5rem; }
.bulk-grid td:nth-child(3), .bulk-grid td:nth-child(4) { min-width: 11rem; }
.bulk-grid td:nth-child(5) { min-width: 9rem; }
.bulk-grid td:nth-child(6) { min-width: 12rem; }
.bulk-grid td:nth-child(8) { min-width: 6.5rem; }
.bulk-grid .bulk-ref { min-width: 5.5rem; }

/* ---- sales & portal */
.icon.flip { transform: scaleX(-1); }
.copy-field { font-family: var(--mono); font-size: .8rem; }
.email-attach { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .7rem .8rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.email-file { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; }
.placeholder-list { grid-template-columns: 110px 1fr; }
.placeholder-list dt { color: var(--text); }
details.tpl-card > summary { cursor: pointer; }
details.tpl-card > summary .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
details.tpl-card:not([open]) > summary { border-bottom: 0; }
.statement-table td.neg, .ageing-table td.neg { color: var(--red); }
.center-text { text-align: center; }
.statement-print .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); border-top: 4px solid var(--accent); }
.portal-top-inner { max-width: 980px; margin: 0 auto; padding: 1rem 1rem .6rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.portal-brand { display: flex; align-items: center; gap: .8rem; color: var(--text); text-decoration: none !important; }
.portal-brand img { max-height: 48px; max-width: 180px; }
.portal-who { text-align: right; }
.portal-nav { max-width: 980px; margin: 0 auto; padding: 0 1rem; border-bottom: 0; margin-bottom: 0; }
.portal-main { flex: 1; width: 100%; }
.portal-main h1 { margin-bottom: .75rem; }
.portal-foot { max-width: 980px; margin: 0 auto; padding: 1rem 1rem 2rem; text-align: center; }
.portal-respond { border-left: 4px solid var(--accent); }
@media (max-width: 860px) {
    .portal-who { text-align: left; }
    .statement .grid-4, .portal-main .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
    .portal-top, .portal-foot { display: none; }
}

/* ---- payroll */
.pay-grid th { white-space: normal; min-width: 80px; font-size: .7rem; }
.pay-grid th .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pay-grid td { vertical-align: middle; }
.pay-grid .grid-input { min-width: 70px; max-width: 96px; }
.pay-grid tr.changed td[data-out] { color: var(--muted); font-style: italic; }
details.paye-panel > summary { cursor: pointer; list-style: none; }
details.paye-panel > summary::-webkit-details-marker { display: none; }
details.paye-panel:not([open]) > summary { border-bottom: 0; }
.paye-panel .table td:first-child { font-weight: 600; white-space: nowrap; width: 3.5rem; }
.leave-cal { table-layout: fixed; }
.leave-cal td { height: 84px; vertical-align: top; font-size: .78rem; padding: .3rem; }
.leave-cal td.off { background: var(--surface-2); color: var(--muted); }
.leave-cal .day { font-weight: 600; }
.leave-cal .ev { display: block; margin-top: .15rem; padding: .05rem .3rem; border-radius: 4px; background: var(--blue-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leave-cal .ev.pending { background: var(--amber-soft); }
.leave-cal .ev.hol { background: var(--green-soft); }
.layout-register { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 1rem; align-items: start; }
.register-actions .btn, .register-actions form { width: 100%; }
.register-actions input[type=file] { font-size: .75rem; max-width: 100%; }
.pay-grid input[readonly] { background: var(--surface-2); color: var(--muted); }
.pay-grid .from-leave, .from-leave-key { background: var(--blue-soft); }
.pay-grid tr.saving td[data-out] { opacity: .5; }
@media (max-width: 860px) { .layout-register { grid-template-columns: 1fr; } }
.payday-tiles .tile { display: block; border-radius: var(--radius); padding: .8rem 1rem; color: #fff; text-decoration: none !important; }
.payday-tiles .tile .stat-value { color: #fff; }
.tile-dark { background: #085041; }
.tile-teal { background: #0f6e56; }
.tile-red { background: #b3202f; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.status-dot.on { background: var(--green); }

/* ---- quick-create pop-up (dialog) and link-style buttons */
.btn-link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
dialog.modal { border: 0; background: var(--surface); color: var(--text); border-radius: var(--radius-lg); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: var(--overlay); }

/* ---- tester checklist (/testing) */
.qa-summary { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.qa-progress { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qa-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--grey-soft); }
.qa-bar span { height: 100%; }
.qa-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qa-counts b { color: var(--text); }
.qa-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.qa-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qa-tools input[type=search] { flex: 1 1 220px; min-width: 0; }
.qa-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.qa-rail { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 24px); overflow: auto; }
.qa-rail a { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 13.5px; }
.qa-rail a:hover { background: var(--grey-soft); }
.qa-rail .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.qa-rail .mini { grid-column: 1 / -1; height: 3px; border-radius: 99px; background: var(--border); overflow: hidden; display: flex; }
.qa-rail .mini span { height: 100%; }
.qa-rail .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 10px 2px; }
.qa-mod { margin-bottom: 28px; scroll-margin-top: 12px; }
.qa-mod h2 { font-size: 18px; margin: 0 0 4px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.qa-mod h2 small { font: 600 12px var(--mono); color: var(--accent); }
.qa-mod .intro { color: var(--muted); margin: 0 0 10px; max-width: 80ch; }
.qa-expected { max-width: 520px; margin-bottom: 12px; }
.qa-expected td:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qa-row { display: grid; grid-template-columns: 70px minmax(0, 1.25fr) minmax(0, 1fr) 240px; gap: 4px 16px; padding: 12px 14px; border-top: 1px solid var(--border); border-left: 4px solid transparent; }
.qa-row:first-child { border-top: 0; }
.qa-row[data-status=pass] { border-left-color: var(--green); }
.qa-row[data-status=fail] { border-left-color: var(--red); }
.qa-row[data-status=blocked] { border-left-color: var(--amber); }
.qa-row[data-status=na] { border-left-color: var(--faint); }
.qa-row .id { font: 600 13px var(--mono); padding-top: 2px; }
.qa-row ol { margin: 0; padding-left: 18px; }
.qa-row ol.single { list-style: none; padding-left: 0; }
.qa-row .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.qa-row .steps .lbl { display: none; }
.qa-act { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qa-seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.qa-seg button { border: 0; border-left: 1px solid var(--border); background: var(--surface); padding: 6px 0; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; }
.qa-seg button:first-child { border-left: 0; }
.qa-seg button[data-s=pass][aria-pressed=true] { background: var(--green-soft); color: var(--green); }
.qa-seg button[data-s=fail][aria-pressed=true] { background: var(--red-soft); color: var(--red); }
.qa-seg button[data-s=blocked][aria-pressed=true] { background: var(--amber-soft); color: var(--amber); }
.qa-seg button[data-s=na][aria-pressed=true] { background: var(--grey-soft); color: var(--text); }
.qa-note { width: 100%; min-height: 34px; resize: vertical; font-size: 13px; }
.qa-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.qa-hide { display: none !important; }
.qa-defects { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.qa-defect { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.qa-defect:first-child { border-top: 0; }
.qa-defect .num { font: 600 13px var(--mono); }
.qa-defect p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-defect .side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.qa-defect.closed { opacity: .6; }
@media (max-width: 1100px) {
    .qa-row { grid-template-columns: 60px minmax(0, 1fr); }
    .qa-row .exp, .qa-row .qa-act { grid-column: 2; }
    .qa-row .steps .lbl { display: block; }
    .qa-defects { grid-template-columns: 1fr; }
    .qa-defects > form { order: -1; }
}
@media (max-width: 760px) {
    .qa-layout { grid-template-columns: 1fr; }
    .qa-rail { display: none; }
    .qa-row { grid-template-columns: 1fr; }
    .qa-row .exp, .qa-row .qa-act { grid-column: 1; }
}

/* ---- Settings › Appearance: company colour palettes */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 12px; }
.palette-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.palette-card:hover { border-color: var(--border-strong); }
.palette-card:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.palette-card input { position: absolute; opacity: 0; pointer-events: none; }
.palette-card input:focus-visible + .palette-preview { outline: 2px solid var(--accent); outline-offset: 2px; }
.palette-preview { display: flex; height: 74px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); margin-bottom: 6px; }
.pp-rail { width: 30px; display: flex; flex-direction: column; align-items: center; gap: 7px; padding-top: 9px; }
.pp-rail i { width: 12px; height: 4px; border-radius: 2px; display: block; }
.pp-body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; }
.pp-line { height: 6px; width: 70%; border-radius: 3px; }
.pp-btn { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.palette-name { font-weight: 600; }

/* ---- Settings sections: grouped and wrapping, so every section stays visible */
.settings-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
/* each group is its own box; the group name is a tinted label, not another link */
.settings-nav-group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.settings-nav-label { align-self: stretch; display: flex; align-items: center; padding: 0 10px; margin-right: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-deep); background: var(--accent-soft); border-radius: 8px; }
.settings-nav-link { padding: 5px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.settings-nav-link:hover { background: var(--surface-3); color: var(--text); }
.settings-nav-link.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.settings-nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-nav-select { display: none; margin-bottom: 16px; }
@media (max-width: 760px) {
    .settings-nav { display: none; }
    .settings-nav-select { display: block; }
}

/* ---- Fisko two-tone icons: class="d" is the soft filled shape behind the line */
.icon .d { fill: var(--icon-duo, currentColor); fill-opacity: var(--icon-duo-opacity, .18); stroke: none; }
.rail-btn.active .icon, .rail-btn:hover .icon { --icon-duo: var(--rail-accent); --icon-duo-opacity: .9; }
.btn-primary .icon { --icon-duo-opacity: .28; }
@media print { .icon .d { fill-opacity: .12; } }

/* ---- Contact persons (customer / vendor form and page) and recipient picker ---- */
.persons { display: grid; gap: .85rem; }
.person-row { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: .85rem .95rem; }
.person-grid { display: grid; grid-template-columns: 90px repeat(3, minmax(0, 1fr)); gap: .65rem .8rem; }
.person-grid .field { margin: 0; }
.person-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; margin-top: .75rem; padding-top: .65rem; border-top: 1px dashed var(--border); }
.person-foot .btn { margin-left: auto; }
@media (max-width: 860px) { .person-grid { grid-template-columns: 1fr 1fr; } .person-grid .person-sal { grid-column: 1 / -1; } }
@media (max-width: 520px) { .person-grid { grid-template-columns: 1fr; } .person-foot .btn { margin-left: 0; } }
.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.people li:last-child { border-bottom: 0; }
.people-name { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.people-links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .25rem; }
.people-links a { display: inline-flex; align-items: center; gap: .3rem; }
.recipients { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: .65rem .85rem; margin-bottom: 1rem; }
.recipients-title { font-weight: 600; font-size: .86rem; margin-bottom: .35rem; display: flex; align-items: center; gap: .4rem; }
.recipient-row { display: flex; align-items: center; gap: 1rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.recipient-row:first-of-type { border-top: 0; }
.recipient-who { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.recipient-row .check { align-items: center; }
.recipient-row .check input { margin-top: 0; }
.email-files { display: grid; gap: .3rem; }
.email-file-row { align-items: center; }

/* ---- Attachments panel and picker ---- */
.attach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.attach-item { display: flex; align-items: center; gap: .75rem; }
.attach-thumb { flex: 0 0 auto; width: 52px; height: 52px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-pdf { font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--coral); }
.attach-ext { font-size: .68rem; font-weight: 700; letter-spacing: .03em; }
.attach-meta { flex: 1; min-width: 0; }
.attach-name { display: block; overflow-wrap: anywhere; font-weight: 500; }
.attach-flag { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 999px; font-size: .74rem; padding: .1rem .55rem; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; }
.attach-flag.on { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.attach-list-ro { margin-bottom: .75rem; }
.attach-zone { display: grid; gap: .6rem; }
.attach-drop { border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); padding: 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem 1.25rem; text-align: center; transition: border-color .12s, background .12s; }
.attach-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.attach-drop-text { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.attach-camera-btn { display: none; }
@media (pointer: coarse) { .attach-camera-btn { display: inline-flex; } }
.attach-zone:not(.attach-js) .attach-drop { display: none; }
.attach-zone.attach-js .attach-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attach-zone:not(.attach-js) [data-attach-camera-input] { display: none; }
.attach-pending { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.attach-pending-item { display: flex; align-items: center; gap: .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .5rem; background: var(--surface); }
.attach-pending-item .attach-thumb { width: 36px; height: 36px; }
.attach-pending-item .attach-name { flex: 1; font-weight: 400; }
.attach-msg { color: var(--red); font-size: .84rem; }
.attach-msg:empty { display: none; }

/* ---- Payroll Audit Report: FijiPayroll "DRAFT Pay Transactions" layout (screen and A4 landscape print) */
.audit-tx { position: relative; padding: 18px 20px; background: #fff; color: #111; font-family: Arial, "Helvetica Neue", sans-serif; font-size: 12px; overflow: hidden; }
.audit-tx-card { padding: 0; overflow: hidden; }
.audit-tx-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.audit-tx-label { font-weight: 700; margin-right: 10px; }
.audit-tx-title { font-weight: 700; font-size: 14px; margin-top: 4px; }
.audit-tx-period { font-size: 11px; white-space: nowrap; }
.audit-tx-scroll { overflow-x: auto; }
.audit-tx-table { width: 100%; border-collapse: collapse; position: relative; z-index: 1; }
.audit-tx-table thead th { background: #ececec; border-top: 1px solid #444; border-bottom: 1px solid #444; font-size: 10.5px; font-weight: 700; text-align: left; padding: 8px 6px; vertical-align: middle; line-height: 1.25; }
.audit-tx-table thead th:first-child { border-left: 1px solid #444; }
.audit-tx-table thead th:last-child { border-right: 1px solid #444; }
.audit-tx-table th.num, .audit-tx-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 64px; padding-left: 14px; }
.audit-tx-table th, .audit-tx-table td { white-space: nowrap; }
.audit-tx-table th:nth-child(1), .audit-tx-table td:nth-child(1) { width: 70px; }
.audit-tx-table th:nth-child(2), .audit-tx-table td:nth-child(2) { min-width: 180px; padding-right: 24px; }
.audit-tx-table .fill { width: 100%; }
.audit-tx-table tbody tr:first-child td { padding-top: 14px; }
.audit-tx-table tbody td { padding: 4px 6px; }
.audit-tx-table tr.audit-tx-total td { border-top: 1px solid #444; border-bottom: 1px solid #444; font-weight: 700; padding-top: 8px; padding-bottom: 8px; }
.audit-tx-watermark { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%) rotate(-45deg); font-size: 150px; font-weight: 700; color: rgba(0, 0, 0, .07); letter-spacing: .05em; pointer-events: none; z-index: 0; white-space: nowrap; }
.audit-tx-foot { display: none; }
@media print {
    .audit-tx { padding: 0; }
    .audit-tx-scroll { overflow: visible; }
    .audit-tx-watermark { position: fixed; top: 50%; }
    .audit-tx-table thead { display: table-header-group; }
    .audit-tx-table tr { break-inside: avoid; }
}

/* ---- Comments & history card (views/partials/comments.php) ---- */
.cmt-filter { display: flex; gap: .25rem; flex-wrap: wrap; }
.cmt-tab { background: none; border: 1px solid transparent; border-radius: 999px; padding: .2rem .7rem; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; }
.cmt-tab:hover { color: var(--text); }
.cmt-tab.active { color: var(--accent-deep); border-color: var(--border-strong); font-weight: 600; }
.cmt-form textarea { width: 100%; min-height: 4.2rem; resize: vertical; margin-bottom: .4rem; }
.cmt-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.cmt-item { display: flex; gap: .7rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.cmt-item[hidden] { display: none; }
.cmt-avatar, .cmt-icon { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; background: var(--border); color: var(--text); }
.cmt-icon { background: var(--border); color: var(--muted); }
.cmt-tone-green { background: #dcf3e4; color: #1f7a45; }
.cmt-tone-red { background: #fbe0e0; color: #b3261e; }
.cmt-tone-amber { background: #fdefd0; color: #9a6400; }
.cmt-tone-blue { background: #dde9fb; color: #2352a6; }
.cmt-main { min-width: 0; flex: 1; }
.cmt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.cmt-del { margin-left: auto; }
.cmt-body, .cmt-note { margin-top: .15rem; overflow-wrap: anywhere; }
.cmt-note { color: var(--muted); font-size: .9rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cmt-tone-green { background: #1c3a2a; color: #7fd6a2; } :root:not([data-theme="light"]) .cmt-tone-red { background: #4a2220; color: #f2a5a0; } :root:not([data-theme="light"]) .cmt-tone-amber { background: #4a3a1a; color: #f0c675; } :root:not([data-theme="light"]) .cmt-tone-blue { background: #1f3256; color: #a9c5f5; } }
:root[data-theme="dark"] .cmt-tone-green { background: #1c3a2a; color: #7fd6a2; } [data-theme="dark"] .cmt-tone-red { background: #4a2220; color: #f2a5a0; } [data-theme="dark"] .cmt-tone-amber { background: #4a3a1a; color: #f0c675; } [data-theme="dark"] .cmt-tone-blue { background: #1f3256; color: #a9c5f5; }
