/* Bayt ERP. One stylesheet, tokens first. Calm, paper-and-ink; each module carries its own accent. */
/* IBM Plex Sans (OFL): calm at small sizes, tabular figures by default, an Arabic sister for later. */
@font-face { font-family: 'IBM Plex Sans'; src: url('/fonts/ibm-plex-sans-latin-wght-normal.woff2') format('woff2-variations'), url('/fonts/ibm-plex-sans-latin-wght-normal.woff2') format('woff2'); font-weight: 100 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/fonts/ibm-plex-sans-latin-ext-wght-normal.woff2') format('woff2-variations'), url('/fonts/ibm-plex-sans-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 100 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --font: 'IBM Plex Sans', ui-sans-serif, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  /* neutrals: warm paper, ink with a little harbour blue in it */
  --canvas: oklch(0.968 0.006 235);
  --surface: oklch(0.995 0.002 235);
  --surface-2: oklch(0.952 0.007 235);
  --sunken: oklch(0.928 0.008 235);
  --line: oklch(0.885 0.009 235);
  --line-strong: oklch(0.79 0.012 235);
  --ink: oklch(0.25 0.020 250);
  --ink-2: oklch(0.40 0.018 250);
  --muted: oklch(0.47 0.016 250);
  --primary: oklch(0.42 0.085 235);
  --primary-hover: oklch(0.36 0.085 235);
  --on-primary: oklch(0.985 0.005 235);
  --focus: oklch(0.55 0.15 245);
  --selection: oklch(0.88 0.06 235);
  --good: oklch(0.45 0.11 150); --good-soft: oklch(0.94 0.04 150);
  --warn: oklch(0.48 0.11 65);  --warn-soft: oklch(0.95 0.05 80);
  --bad: oklch(0.48 0.16 27);   --bad-soft: oklch(0.95 0.035 27);
  --info-soft: oklch(0.95 0.025 235);
  --shadow: 0 1px 2px oklch(0.3 0.02 250 / 0.06), 0 6px 18px -6px oklch(0.3 0.02 250 / 0.14);
  --shadow-pop: 0 2px 6px oklch(0.3 0.02 250 / 0.08), 0 18px 40px -12px oklch(0.3 0.02 250 / 0.28);
  --r: 10px; --r-sm: 7px; --r-lg: 14px;
  --tap: 44px;
  /* module accents: strong (marks, rules), ink (text), soft (fills) */
  --accounting: oklch(0.52 0.11 155); --accounting-ink: oklch(0.42 0.10 155); --accounting-soft: oklch(0.94 0.035 155);
  --projects: oklch(0.52 0.12 250);   --projects-ink: oklch(0.43 0.12 250);   --projects-soft: oklch(0.94 0.03 250);
  --timesheets: oklch(0.62 0.13 70);  --timesheets-ink: oklch(0.46 0.10 65);  --timesheets-soft: oklch(0.95 0.045 80);
  --tenders: oklch(0.56 0.14 38);     --tenders-ink: oklch(0.46 0.13 38);     --tenders-soft: oklch(0.95 0.03 40);
  --hr: oklch(0.54 0.12 350);         --hr-ink: oklch(0.45 0.12 350);         --hr-soft: oklch(0.95 0.025 350);
  --contacts: oklch(0.55 0.09 195);   --contacts-ink: oklch(0.44 0.08 195);   --contacts-soft: oklch(0.94 0.03 195);
  --reports: oklch(0.52 0.12 290);    --reports-ink: oklch(0.44 0.12 290);    --reports-soft: oklch(0.95 0.025 290);
  --settings: oklch(0.48 0.02 250);   --settings-ink: oklch(0.40 0.02 250);   --settings-soft: oklch(0.935 0.008 250);
  --personal: oklch(0.62 0.01 85);    --personal-ink: oklch(0.47 0.012 85);   --personal-soft: oklch(0.94 0.006 85);
  --payroll: oklch(0.52 0.10 128);    --payroll-ink: oklch(0.42 0.09 128);    --payroll-soft: oklch(0.94 0.035 128);
  --me: oklch(0.52 0.10 215);         --me-ink: oklch(0.43 0.09 215);         --me-soft: oklch(0.94 0.03 215);
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* dark: deep harbour night, not inverted paper */
:root[data-theme="dark"] {
  --canvas: oklch(0.185 0.014 250); --surface: oklch(0.225 0.015 250); --surface-2: oklch(0.255 0.016 250); --sunken: oklch(0.165 0.013 250);
  --line: oklch(0.32 0.016 250); --line-strong: oklch(0.40 0.018 250);
  --ink: oklch(0.945 0.008 85); --ink-2: oklch(0.84 0.010 85); --muted: oklch(0.75 0.012 85);
  --primary: oklch(0.74 0.10 230); --primary-hover: oklch(0.80 0.09 230); --on-primary: oklch(0.18 0.02 250);
  --focus: oklch(0.78 0.13 230); --selection: oklch(0.40 0.07 235);
  --good: oklch(0.78 0.13 150); --good-soft: oklch(0.30 0.05 150);
  --warn: oklch(0.82 0.12 80);  --warn-soft: oklch(0.32 0.05 75);
  --bad: oklch(0.76 0.13 25);   --bad-soft: oklch(0.31 0.06 25);
  --info-soft: oklch(0.29 0.04 240);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 20px -8px oklch(0 0 0 / 0.5);
  --shadow-pop: 0 2px 6px oklch(0 0 0 / 0.35), 0 20px 44px -12px oklch(0 0 0 / 0.6);
  --accounting: oklch(0.72 0.12 155); --accounting-ink: oklch(0.80 0.11 155); --accounting-soft: oklch(0.30 0.045 155);
  --projects: oklch(0.72 0.11 250);   --projects-ink: oklch(0.81 0.09 250);   --projects-soft: oklch(0.30 0.05 250);
  --timesheets: oklch(0.78 0.12 75);  --timesheets-ink: oklch(0.84 0.11 80);  --timesheets-soft: oklch(0.31 0.045 70);
  --tenders: oklch(0.72 0.13 40);     --tenders-ink: oklch(0.81 0.10 40);     --tenders-soft: oklch(0.31 0.05 38);
  --hr: oklch(0.72 0.12 350);         --hr-ink: oklch(0.82 0.09 350);         --hr-soft: oklch(0.31 0.05 350);
  --contacts: oklch(0.74 0.09 195);   --contacts-ink: oklch(0.82 0.08 195);   --contacts-soft: oklch(0.30 0.04 195);
  --reports: oklch(0.72 0.12 290);    --reports-ink: oklch(0.82 0.09 290);    --reports-soft: oklch(0.31 0.05 290);
  --settings: oklch(0.72 0.02 250);   --settings-ink: oklch(0.82 0.015 250);  --settings-soft: oklch(0.30 0.015 250);
  --personal: oklch(0.62 0.01 85);    --personal-ink: oklch(0.74 0.01 85);    --personal-soft: oklch(0.27 0.01 250);
  --payroll: oklch(0.74 0.11 128);    --payroll-ink: oklch(0.82 0.10 128);    --payroll-soft: oklch(0.30 0.045 128);
  --me: oklch(0.74 0.09 215);         --me-ink: oklch(0.82 0.08 215);         --me-soft: oklch(0.30 0.04 215);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: oklch(0.185 0.014 250); --surface: oklch(0.225 0.015 250); --surface-2: oklch(0.255 0.016 250); --sunken: oklch(0.165 0.013 250);
    --line: oklch(0.32 0.016 250); --line-strong: oklch(0.40 0.018 250);
    --ink: oklch(0.945 0.008 85); --ink-2: oklch(0.84 0.010 85); --muted: oklch(0.75 0.012 85);
    --primary: oklch(0.74 0.10 230); --primary-hover: oklch(0.80 0.09 230); --on-primary: oklch(0.18 0.02 250);
    --focus: oklch(0.78 0.13 230); --selection: oklch(0.40 0.07 235);
    --good: oklch(0.78 0.13 150); --good-soft: oklch(0.30 0.05 150);
    --warn: oklch(0.82 0.12 80);  --warn-soft: oklch(0.32 0.05 75);
    --bad: oklch(0.76 0.13 25);   --bad-soft: oklch(0.31 0.06 25);
    --info-soft: oklch(0.29 0.04 240);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 20px -8px oklch(0 0 0 / 0.5);
    --shadow-pop: 0 2px 6px oklch(0 0 0 / 0.35), 0 20px 44px -12px oklch(0 0 0 / 0.6);
    --accounting: oklch(0.72 0.12 155); --accounting-ink: oklch(0.80 0.11 155); --accounting-soft: oklch(0.30 0.045 155);
    --projects: oklch(0.72 0.11 250);   --projects-ink: oklch(0.81 0.09 250);   --projects-soft: oklch(0.30 0.05 250);
    --timesheets: oklch(0.78 0.12 75);  --timesheets-ink: oklch(0.84 0.11 80);  --timesheets-soft: oklch(0.31 0.045 70);
    --tenders: oklch(0.72 0.13 40);     --tenders-ink: oklch(0.81 0.10 40);     --tenders-soft: oklch(0.31 0.05 38);
    --hr: oklch(0.72 0.12 350);         --hr-ink: oklch(0.82 0.09 350);         --hr-soft: oklch(0.31 0.05 350);
    --contacts: oklch(0.74 0.09 195);   --contacts-ink: oklch(0.82 0.08 195);   --contacts-soft: oklch(0.30 0.04 195);
    --reports: oklch(0.72 0.12 290);    --reports-ink: oklch(0.82 0.09 290);    --reports-soft: oklch(0.31 0.05 290);
    --settings: oklch(0.72 0.02 250);   --settings-ink: oklch(0.82 0.015 250);  --settings-soft: oklch(0.30 0.015 250);
    --personal: oklch(0.62 0.01 85);    --personal-ink: oklch(0.74 0.01 85);    --personal-soft: oklch(0.27 0.01 250);
    --payroll: oklch(0.74 0.11 128);    --payroll-ink: oklch(0.82 0.10 128);    --payroll-soft: oklch(0.30 0.045 128);
    --me: oklch(0.74 0.09 215);         --me-ink: oklch(0.82 0.08 215);         --me-soft: oklch(0.30 0.04 215);
  }
}

/* the current module's accent, set on <body data-module> */
[data-accent] { --acc: var(--settings); --acc-ink: var(--settings-ink); --acc-soft: var(--settings-soft); }
[data-accent="accounting"] { --acc: var(--accounting); --acc-ink: var(--accounting-ink); --acc-soft: var(--accounting-soft); }
[data-accent="projects"] { --acc: var(--projects); --acc-ink: var(--projects-ink); --acc-soft: var(--projects-soft); }
[data-accent="timesheets"] { --acc: var(--timesheets); --acc-ink: var(--timesheets-ink); --acc-soft: var(--timesheets-soft); }
[data-accent="tenders"] { --acc: var(--tenders); --acc-ink: var(--tenders-ink); --acc-soft: var(--tenders-soft); }
[data-accent="hr"] { --acc: var(--hr); --acc-ink: var(--hr-ink); --acc-soft: var(--hr-soft); }
[data-accent="contacts"] { --acc: var(--contacts); --acc-ink: var(--contacts-ink); --acc-soft: var(--contacts-soft); }
[data-accent="reports"] { --acc: var(--reports); --acc-ink: var(--reports-ink); --acc-soft: var(--reports-soft); }
[data-accent="settings"] { --acc: var(--settings); --acc-ink: var(--settings-ink); --acc-soft: var(--settings-soft); }
[data-accent="personal"] { --acc: var(--personal); --acc-ink: var(--personal-ink); --acc-soft: var(--personal-soft); }
[data-accent="payroll"] { --acc: var(--payroll); --acc-ink: var(--payroll-ink); --acc-soft: var(--payroll-soft); }
[data-accent="me"] { --acc: var(--me); --acc-ink: var(--me-ink); --acc-soft: var(--me-soft); }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 0.9375rem/1.4667 var(--font); font-feature-settings: 'liga' 1; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
::selection { background: var(--selection); color: var(--ink); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; line-height: 2.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; line-height: 1.625rem; }
h3, h2.h3 { font-size: 0.9375rem; line-height: 1.375rem; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input[type="date"]::-webkit-calendar-picker-indicator:focus-visible { outline: 2px solid var(--focus); }
.num, td.num, th.num { font-variant-numeric: lining-nums tabular-nums; text-align: right; white-space: nowrap; }
.tnum { font-variant-numeric: lining-nums tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: no-preference) { :root { --ease: cubic-bezier(0.16, 1, 0.3, 1); } }

/* ------------------------------------------------------------------ controls */
button, .btn { font: inherit; font-weight: 500; font-size: 0.9375rem; min-height: var(--tap); padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap;
  transition: background-color 160ms var(--ease, ease), border-color 160ms var(--ease, ease), color 160ms var(--ease, ease); }
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
button.danger { color: var(--bad); border-color: color-mix(in oklch, var(--bad) 45%, var(--line)); }
button.danger:hover { background: var(--bad-soft); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: transparent; }
button:disabled, button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button.icon { padding: 0; width: var(--tap); }

label.f { display: grid; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
label.f .hint { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  min-height: var(--tap); padding: 8px 12px; width: 100%; min-width: 0; caret-color: var(--primary); accent-color: var(--primary); }
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; }
label.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 0.9375rem; font-weight: 500; color: var(--ink); cursor: pointer; }
input.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.field-error { color: var(--bad); font-size: 0.8125rem; font-weight: 500; }

/* ------------------------------------------------------------------ shell */
.banner { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; padding: 8px 16px; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid color-mix(in oklch, var(--warn) 40%, var(--line)); font-size: 0.9375rem; }
.banner b { font-weight: 600; }
.banner button { min-height: 36px; }
header.top { position: sticky; top: 0; z-index: 20; background: color-mix(in oklch, var(--surface) 92%, var(--canvas)); border-bottom: 1px solid var(--line); }
.banner + header.top { top: 0; position: relative; }
.top-row { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 16px; max-width: 1480px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; min-height: var(--tap); padding-right: 6px; border-radius: var(--r-sm); }
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--acc-ink); font-weight: 600; text-decoration: none; min-height: var(--tap); padding: 0 8px; border-radius: var(--r-sm); }
.crumb:hover { color: var(--acc-ink); background: var(--acc-soft); }
.crumb svg.i { color: var(--acc); }
.sep { color: var(--muted); }
.top-row .spacer { flex: 1; }
.switcher-btn { max-width: 300px; justify-content: flex-start; gap: 10px; padding: 0 12px; }
.switcher-btn .co { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.switcher-btn .plus { font-size: 0.8125rem; font-weight: 600; color: var(--primary); background: var(--info-soft); border-radius: 20px; padding: 1px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--ink); font-weight: 600; font-size: 0.8125rem; border: 1px solid var(--line); }
.user-btn { padding: 0 6px; width: auto; }

.tabs-wrap { position: relative; max-width: 1480px; margin: 0 auto; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 0 12px; scroll-behavior: smooth; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 0.9375rem; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--acc); }
.tabs-more { position: absolute; top: 0; bottom: 0; width: 44px; display: none; align-items: center; justify-content: center; border: 0; border-radius: 0; padding: 0; min-height: 0; color: var(--ink-2); }
.tabs-more.left { left: 0; background: linear-gradient(90deg, color-mix(in oklch, var(--surface) 92%, var(--canvas)) 55%, transparent); justify-content: flex-start; padding-left: 6px; }
.tabs-more.right { right: 0; background: linear-gradient(270deg, color-mix(in oklch, var(--surface) 92%, var(--canvas)) 55%, transparent); justify-content: flex-end; padding-right: 6px; }
.tabs-more:hover { background-color: transparent; color: var(--ink); }
.tabs-wrap.can-left .tabs-more.left, .tabs-wrap.can-right .tabs-more.right { display: flex; }
/* 0.8.1 (U11): tabs that do not fit sit under More; the current tab always stays in the row. */
.tabs a[hidden], .tabs-overflow[hidden] { display: none; }
.tabs-overflow { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); padding: 0 10px; margin-left: auto; border: 0; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 0.9375rem; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs-overflow:hover, .tabs-overflow[aria-expanded="true"] { color: var(--ink); background: var(--surface-2); }
.tabs-overflow svg { width: 16px; height: 16px; transform: rotate(-90deg); }
.tabs-wrap.overflowing .tabs-more { display: none !important; }
.tabs-menu { max-height: 70vh; overflow-y: auto; }

main { max-width: 1480px; margin: 0 auto; padding: 28px 24px 72px; min-height: calc(100vh - 120px); }
.page { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-bottom: 4px; }
.pagehead .t { display: grid; gap: 6px; min-width: 0; }
.pagehead .sub { color: var(--muted); max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* panels: the one container. Never nested. */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; min-width: 0; }
.panel.flush { padding: 0 0 4px; overflow: hidden; }
.panel > .ph { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel.flush > .ph { padding: 16px 20px 0; margin-bottom: 10px; }
.panel .ph h2 { font-size: 1.125rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* facts: label/value pairs */
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 24px; margin: 0; }
dl.facts div { display: grid; gap: 2px; min-width: 0; }
dl.facts dt { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th { text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.total td { font-weight: 600; border-top: 1px solid var(--line-strong); background: var(--surface-2); }
tr.sub td { font-weight: 600; }
tr.group td { font-weight: 600; padding-top: 18px; color: var(--ink); border-bottom-color: var(--line); }
td.indent { padding-left: 32px; }
td .muted { font-size: 0.8125rem; }
a.fig { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-strong); padding: 6px 2px; margin: -6px -2px; border-radius: 3px; }
a.fig:hover { color: var(--primary); border-bottom-color: var(--primary); background: var(--info-soft); }
td a.rowlink { color: var(--ink); font-weight: 600; text-decoration: none; }
td a.rowlink:hover { color: var(--primary); text-decoration: underline; }
.neg { color: var(--bad); }
.scroll-hint { position: sticky; left: 0; display: none; padding: 6px 14px; font-size: 0.8125rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface-2); align-items: center; gap: 6px; }
.table-wrap.overflows + .scroll-hint, .table-wrap.overflows .scroll-hint { display: flex; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--primary); }
.pill.plain::before { display: none; }

/* notes and empty states */
.note { background: var(--info-soft); border-radius: var(--r); padding: 12px 16px; color: var(--ink); font-size: 0.9375rem; }
.note.warn { background: var(--warn-soft); }
.note.bad { background: var(--bad-soft); }
.empty { display: grid; gap: 8px; justify-items: start; padding: 28px 24px; color: var(--ink-2); max-width: 62ch; }
.empty b { color: var(--ink); font-size: 1.125rem; }

/* ------------------------------------------------------------------ home launcher */
  transition: border-color 180ms var(--ease, ease), box-shadow 180ms var(--ease, ease), transform 180ms var(--ease, ease); }
@media (prefers-reduced-motion: no-preference) { .tile:hover { transform: translateY(-1px); } }

/* ------------------------------------------------------------------ dialogs, menus, toasts */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: oklch(0.2 0.02 250 / 0.42); }
dialog .dh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog .db { padding: 20px; display: grid; gap: 16px; overflow: auto; }
dialog .df { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.menu { position: fixed; z-index: 50; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; display: grid; }
.menu button, .menu a { justify-content: flex-start; border: 0; background: transparent; width: 100%; font-weight: 500; color: var(--ink); text-decoration: none; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm); display: flex; align-items: center; gap: 10px; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .mh { padding: 8px 12px 6px; font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu [aria-checked="true"]::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.co-list { display: grid; gap: 4px; }
.co-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 6px 10px; border-radius: var(--r-sm); border: 1px solid transparent; }
.co-row.current { border-color: var(--line-strong); background: var(--surface-2); }
.co-row .nm { font-weight: 600; }
.co-row .lg { font-size: 0.8125rem; color: var(--muted); }
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--canvas); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-pop); font-size: 0.9375rem; font-weight: 500; }
.toast.bad { background: var(--bad); color: var(--surface); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise 220ms var(--ease); } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* search */
.search-results { display: grid; gap: 2px; }
.search-results a { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; min-height: var(--tap); padding: 6px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--surface-2); }
.search-results .k { font-size: 0.8125rem; color: var(--muted); }
.search-results .mk { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc-ink); }
.search-results .mk svg.i { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ sign-in */

/* ------------------------------------------------------------------ module pieces */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.kpi { padding: 16px 18px; display: grid; gap: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.kpi .l { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 1.25rem; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; }
.kpi .v .tnum { font-variant-numeric: lining-nums tabular-nums; }
.kpi .v a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.kpi .v a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.kpi.lead .v { color: var(--acc-ink); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filters label.f { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .check { min-height: var(--tap); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; background: var(--sunken); border-radius: 20px; padding: 3px 10px; color: var(--ink-2); }
.chip b { font-weight: 600; color: var(--ink); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.9375rem; }
.crumbs a, .crumbs span { padding: 6px 8px; border-radius: var(--r-sm); min-height: 36px; display: inline-flex; align-items: center; }
.crumbs a:hover { background: var(--surface-2); }
.crumbs .sep { padding: 0; }

/* pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(196px, 1fr); gap: 12px; padding-bottom: 6px; }
.row-actions { display: flex; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.lane { background: var(--surface-2); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 10px; align-content: start; min-height: 220px; border: 1px solid var(--line); }
.lane-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 6px; border-bottom: 2px solid var(--line-strong); }
.lane-h.won { border-bottom-color: var(--good); }
.lane-h.lost { border-bottom-color: var(--line); }
.lane-h b { font-size: 0.9375rem; }
.lane-h .num { font-size: 0.8125rem; color: var(--muted); }
.deal { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--ink); text-decoration: none; }
.deal:hover { border-color: color-mix(in oklch, var(--acc) 55%, var(--line)); color: var(--ink); }
.deal .nm { font-weight: 600; line-height: 1.3; }
.deal .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8125rem; color: var(--muted); }
.deal .val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); font-size: 0.8125rem; }

/* progress bar (stage completion) */
.bar { height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 6px; }

/* timesheet grid */
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .wk { font-weight: 600; min-width: 190px; text-align: center; }
table.grid input { min-height: 40px; padding: 6px 8px; text-align: right; font-variant-numeric: lining-nums tabular-nums; width: 64px; }
table.grid td, table.grid th { padding: 8px 6px; }
table.grid td:first-child, table.grid th:first-child { padding-left: 14px; }
table.grid select { min-width: 200px; }
table.grid .we { color: var(--muted); }
.grid-total td { font-weight: 600; }

/* access matrix */
table.matrix th.mod { text-align: center; }
table.matrix th.mod span { display: inline-flex; align-items: center; gap: 6px; }
table.matrix td.cell { text-align: center; padding: 6px; }
table.matrix td.cell button { width: 100%; min-width: 108px; flex-direction: column; gap: 0; line-height: 1.2; padding: 6px 8px; font-size: 0.8125rem; }
table.matrix td.cell button .lv { font-weight: 600; }
table.matrix td.cell button .sc { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
table.matrix td.cell button.none { color: var(--muted); background: transparent; border-style: dashed; }
table.matrix td.cell button.lv-admin { background: var(--info-soft); }
table.matrix td.who { min-width: 180px; }
table.matrix th:first-child, table.matrix td.who { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); }

/* pivot */
.pivot-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
table.pivot td.num a.fig { display: inline-block; }
table.pivot th.num { text-align: right; }

/* attachment preview */
.preview { border: 1px solid var(--line); border-radius: var(--r); background: var(--sunken); min-height: 360px; display: grid; place-items: center; overflow: hidden; }
.preview iframe, .preview img { width: 100%; height: 520px; border: 0; object-fit: contain; background: var(--surface); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .pivot-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .switcher-btn { max-width: 200px; }
  .top-row .hide-md { display: none; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 64px; }
  h1 { font-size: 1.5rem; }
  .top-row { padding: 0 8px 0 12px; gap: 4px; height: 56px; }
  .brand .wordmark { display: none; }
  .crumb .lbl { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .switcher-btn { max-width: 150px; padding: 0 10px; }
  .switcher-btn svg.i { display: none; }
  .row2, .row3, .row4 { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; border-radius: var(--r); }
  .panel.flush > .ph { padding: 14px 16px 0; }
  .pivot-controls { grid-template-columns: minmax(0, 1fr); }
  .filters label.f { max-width: none; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions > * { flex: 1 1 auto; }
  .pagehead .actions > .pill { flex: none; }
  /* list tables become stacked rows */
  table.stack-sm thead { display: none; }
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  table.stack-sm tr:last-child { border-bottom: 0; }
  table.stack-sm td { border: 0; padding: 2px 0; text-align: left; display: flex; justify-content: space-between; gap: 12px; }
  table.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; font-weight: 500; flex: none; }
  table.stack-sm td.lead { display: block; font-size: 1rem; padding-bottom: 4px; }
  table.stack-sm td.lead::before { display: none; }
  table.stack-sm td:empty, table.stack-sm td.hide-sm { display: none; }
  table.stack-sm td:has(> input, > select, > textarea) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 4px 0; }
  table.stack-sm td:has(> .row-actions) .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  table.stack-sm tr.total td { background: transparent; border: 0; }
  table.stack-sm tr.total { background: var(--surface-2); }
  dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .toasts { left: 16px; right: 16px; }
  .board { grid-auto-columns: minmax(78vw, 1fr); }
}
@media print { header.top, .tabs-wrap, .actions, .banner { display: none !important; } main { padding: 0; } .panel { border: 0; } }

/* ---- 0.2.0 additions */
.co-short { display: none; }
.scope-note { font-size: 0.8125rem; color: var(--ink-2); background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 12px; max-width: 80ch; }
.crumbs { margin: -6px 0 2px -8px; font-size: 0.8125rem; color: var(--muted); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.top-row button.icon { flex: none; }
details > summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; }
.chip button.icon { min-height: 44px !important; width: 44px !important; margin: -10px -12px -10px -6px; }
td.act { vertical-align: middle; }
.kpi.lead .v { color: var(--ink); }
.kpi.lead .l { color: var(--acc-ink); font-weight: 600; }
.restricted { color: var(--muted); font-style: normal; font-size: 0.8125rem; }
.doc-pane summary { font-weight: 600; }
.deal-wrap { display: grid; gap: 6px; }
.deal-move { min-height: 44px; font-size: 0.8125rem; padding: 4px 32px 4px 10px; }
@media (max-width: 640px) {
  .co-long { display: none; } .co-short { display: inline; }
  .switcher-btn .plus { display: none; }
  /* timesheet: one card per row, days as a strip under the project */
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tfoot { display: block; }
  table.grid tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 4px; padding: 12px; border-bottom: 1px solid var(--line); }
  table.grid td { display: block; border: 0; padding: 0 !important; }
  table.grid td.what, table.grid td.stage, table.grid td.rt, table.grid td.rm { grid-column: 1 / -1; }
  table.grid td.day::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); text-align: center; margin-bottom: 2px; }
  table.grid td.day input { width: 100%; min-height: 44px; padding: 6px 2px; text-align: center; }
  table.grid td.day { text-align: center; }
  table.grid td.rt { text-align: right; font-weight: 600; }
  table.grid td.rt::before { content: 'Week total '; font-weight: 400; color: var(--muted); }
  table.grid td.rm { justify-self: end; }
  table.grid select { min-width: 0; width: 100%; }
  table.grid tfoot tr { background: var(--surface-2); }
  table.grid tfoot td:first-child { grid-column: 1 / -1; }
}
.hide-lg { display: none; }
@media (max-width: 640px) { .hide-lg { display: inline; } .hide-sm { display: none !important; } }

/* ---- 0.2.1 */
/* invoice and bill lines: two rows per line so no field is squeezed */
table.lines thead { display: none; }
table.lines, table.lines tbody { display: block; }
table.lines tr { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.2fr) minmax(0, 0.8fr) auto; grid-template-areas: "desc amt vat rm" "acct unit proj stage"; gap: 10px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
table.lines td { display: grid; gap: 4px; padding: 0; border: 0; min-width: 0; }
table.lines td::before { content: attr(data-label); font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
table.lines td.l-rm::before { content: ''; }
table.lines td.l-rm { align-self: end; }
.l-desc { grid-area: desc; } .l-amt { grid-area: amt; } .l-vat { grid-area: vat; } .l-rm { grid-area: rm; }
.l-acct { grid-area: acct; } .l-unit { grid-area: unit; } .l-proj { grid-area: proj; } .l-stage { grid-area: stage; }
table.lines tr { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "desc desc amt vat rm" "acct unit proj stage stage"; }
/* codes never break mid-token */
td.nowrap, td.code, .nowrap { white-space: nowrap; }
/* filters wide enough for their options */
.filters label.f { min-width: 180px; max-width: 300px; }
.pivot-controls { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.who-btn { min-height: 44px; padding: 0 8px; margin-top: 4px; white-space: nowrap; font-size: 0.8125rem; gap: 6px; }
td.who { min-width: 200px; }
td.acct-name { cursor: default; }
@media (max-width: 640px) {
  table.lines tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "desc desc" "amt vat" "acct acct" "unit unit" "proj stage" "rm rm"; }
  table.lines td.l-rm { justify-self: end; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters label.f { min-width: 0; max-width: none; }
  .filters > label.check, .filters > button { grid-column: 1 / -1; }
  /* statements: account names on one line, tap to see the whole name */
  table.stmt td.acct-name { max-width: none; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
  table.stmt td.acct-name.open { white-space: normal; }
  table.stmt td.num { min-width: 92px; }
}

/* ---- 0.3.0: people, leave, payroll, approvals */
button.linkish { min-height: 0; padding: 4px 0; border: 0; background: none; color: var(--ink); font-weight: 600; text-align: left; white-space: normal; justify-content: flex-start; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; }
button.linkish:hover { background: none; color: var(--primary); text-decoration-color: var(--primary); }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-top: -6px; }
.subtabs a { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 12px; color: var(--ink-2); text-decoration: none; font-weight: 500; border-radius: var(--r-sm) var(--r-sm) 0 0; position: relative; }
.subtabs a:hover { background: var(--surface-2); color: var(--ink); }
.subtabs a[aria-current="page"] { color: var(--ink); }
.subtabs a[aria-current="page"]::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--acc); }
.staff-head { display: flex; gap: 16px; align-items: flex-end; }
.staff-head .pagehead { flex: 1; min-width: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.125rem; background: var(--acc-soft); color: var(--acc-ink); border-color: transparent; flex: none; margin-bottom: 6px; }
.who-cell { display: inline-flex; align-items: center; gap: 10px; }
.who-cell .avatar { width: 30px; height: 30px; font-size: 0.75rem; }
ul.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
ul.notes li { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
ul.notes li:last-child { border-bottom: 0; padding-bottom: 0; }
.big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big .v { font-size: 2.25rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--acc-ink); }
.big .l { color: var(--muted); font-weight: 500; }
.blist { display: grid; gap: 0; border-top: 1px solid var(--line); }
.blist .bl { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.blist .bl.sum { font-weight: 600; }
.leave-calc .calc { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; font-size: 0.9375rem; }
fieldset.choice { border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 14px; margin: 0; display: grid; gap: 4px; }
fieldset.choice legend { font-weight: 600; padding: 0 6px; }
label.opt { align-items: flex-start; padding: 6px 0; }
label.opt input { margin-top: 3px; }
label.opt > span { display: grid; gap: 2px; }
fieldset.days { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
fieldset.days legend { font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; padding: 0; }
/* home inbox */
/* leave calendar */
table.cal { border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; width: auto; min-width: 100%; }
table.cal th, table.cal td { padding: 0; border-bottom: 1px solid var(--line); text-align: center; }
table.cal th.day { width: 30px; min-width: 30px; padding: 6px 0; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
table.cal th.day span { display: block; }
table.cal th.day .dn { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
table.cal th.today { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
table.cal .rest { background: var(--surface-2); }
table.cal .hol { background: var(--warn-soft); }
table.cal th.who { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 170px; max-width: 220px; box-shadow: 1px 0 0 var(--line); }
table.cal th.who .nm { display: block; font-weight: 600; color: var(--ink); font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.cal th.who .small { font-size: 0.75rem; font-weight: 400; }
table.cal td.day { height: 44px; padding: 3px 1px; }
.blk { display: inline-grid; place-items: center; width: 100%; min-width: 22px; height: 100%; min-height: 26px; padding: 0; border-radius: 5px; border: 1px solid; font-size: 0.75rem; font-weight: 600; line-height: 1; }
button.blk { min-height: 38px; cursor: pointer; }
button.blk:hover { filter: brightness(0.96); }
.t-annual { background: var(--projects-soft); color: var(--projects-ink); border-color: color-mix(in oklch, var(--projects) 55%, transparent); }
.t-sick { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in oklch, var(--bad) 50%, transparent); }
.t-maternity, .t-parental { background: var(--hr-soft); color: var(--hr-ink); border-color: color-mix(in oklch, var(--hr) 50%, transparent); }
.t-bereavement { background: var(--settings-soft); color: var(--settings-ink); border-color: color-mix(in oklch, var(--settings) 50%, transparent); }
.t-study { background: var(--reports-soft); color: var(--reports-ink); border-color: color-mix(in oklch, var(--reports) 50%, transparent); }
.t-hajj { background: var(--accounting-soft); color: var(--accounting-ink); border-color: color-mix(in oklch, var(--accounting) 50%, transparent); }
.t-unpaid { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklch, var(--warn) 55%, transparent); }
.t-other { background: var(--contacts-soft); color: var(--contacts-ink); border-color: color-mix(in oklch, var(--contacts) 50%, transparent); }
.blk.pend { background-image: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in oklch, currentColor 16%, transparent) 4px 6px); border-style: dashed; }
.blk.half { background-image: linear-gradient(135deg, transparent 50%, var(--surface) 50%); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.8125rem; color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .blk { width: 24px; min-width: 24px; height: 22px; min-height: 22px; }
.legend .sw { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); }
.legend .sw.hol { background: var(--warn-soft); } .legend .sw.rest { background: var(--surface-2); }
/* timesheets */
th.dayh { line-height: 1.25; }
th.dayh .tag { font-size: 0.75rem; font-weight: 600; color: var(--warn); }
th.dayh.rest { color: var(--muted); }
table.grid tr.auto td { background: var(--surface-2); color: var(--ink-2); }
table.grid.mini td, table.grid.mini th { padding: 6px; font-size: 0.8125rem; }
.week-sum { font-size: 0.9375rem; color: var(--ink-2); }
.diff { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.diff.under { color: var(--bad); } .diff.over { color: var(--good); }
table.appr td.sel { width: 44px; vertical-align: middle; text-align: center; }
table.appr td.sel input { width: 22px; height: 22px; }
table.appr td.note-cell { max-width: 220px; font-size: 0.8125rem; color: var(--ink-2); }
table.appr tr.group td, table.run tr.group td { background: var(--sunken); font-size: 0.8125rem; padding-top: 10px; padding-bottom: 10px; }
tr.detail > td { background: var(--surface-2); padding: 12px 14px 16px; }
/* payroll */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stepper li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 20px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.8125rem; }
.stepper .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 0.75rem; }
.stepper li.done { color: var(--ink-2); } .stepper li.done .n { background: var(--acc-soft); color: var(--acc-ink); }
.stepper li.cur { background: var(--acc-soft); color: var(--acc-ink); } .stepper li.cur .n { background: var(--acc); color: var(--surface); }
.payslip { display: grid; gap: 18px; max-width: 880px; }
.slip-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.slip-head .right { text-align: right; }
table.slip td { padding: 6px 0; border-bottom: 1px solid var(--line); }
table.slip td.num { padding-left: 12px; }
table.slip tr.total td { background: transparent; border-top: 1px solid var(--ink); }
.net { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; background: var(--acc-soft); border-radius: var(--r); font-weight: 600; font-size: 1.125rem; }
@media (max-width: 640px) {
  .staff-head { gap: 12px; }
  .avatar.lg { width: 44px; height: 44px; font-size: 0.9375rem; }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .subtabs a { flex: none; }
  .big .v { font-size: 1.875rem; }
  table.cal th.who { min-width: 118px; max-width: 128px; padding: 6px 8px; }
  table.appr tr.group, table.appr tr.total { display: block; }
  table.appr td.sel:empty { display: none; }
  table.appr td.sel { width: auto; text-align: left; }
  tr.detail > td { display: block; }
  .slip-head { flex-direction: column; } .slip-head .right { text-align: left; }
}
@media print {
  .subtabs, .stepper, .inbox, .crumbs, .scroll-hint { display: none !important; }
  body { background: #fff; color: #000; }
  .payslip { max-width: none; }
  .net { background: none; border: 1px solid #000; }
}
table.appr td.who { white-space: nowrap; min-width: 150px; }
table.appr th { white-space: nowrap; }
table.appr td.act .row-actions { flex-wrap: nowrap; }
button.icon.open svg.i { transform: rotate(180deg); }
@media (max-width: 640px) {
  table.appr tr.group td, table.run tr.group td { display: block; text-align: left; background: var(--sunken); }
  table.appr tr.group td::before, table.appr td.sel::before, table.appr td.act::before { display: none; }
  table.appr td.act .row-actions { flex-wrap: wrap; justify-content: flex-start; }
  table.appr td.sel input { margin: 2px 0 6px; }
}
@media (max-width: 640px) { .filters > label.f:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  table.stack-sm tfoot { display: block; }
  table.stack-sm tfoot tr { display: block; padding: 10px 16px; }
  table.stack-sm tfoot td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 2px 0; }
  table.stack-sm tfoot td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
  table.stack-sm tfoot td.lead::before { display: none; }
  table.stack-sm tfoot td:empty { display: none; }
}
details > summary { gap: 8px; color: var(--primary); font-weight: 500; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); flex: none; }
details[open] > summary::before { transform: rotate(45deg); }
@media (max-width: 640px) {
  button.linkish { min-height: 44px; display: inline-flex; align-items: center; }
  table.cal th.day, table.cal td.day { min-width: 46px; width: 46px; }
  table.cal button.blk { min-width: 44px; min-height: 44px; }
}
@media (max-width: 640px) { dl.facts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 138px), 1fr)); gap: 12px 16px; } }
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--ink-2); border-style: dashed; cursor: not-allowed; }

/* ------------------------------------------------------------------ pivot grid (0.4.0) */
table.pv td, table.pv th { white-space: nowrap; }
table.pv th:first-child, table.pv td.pv-label { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); }
table.pv tfoot td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-2); box-shadow: 1px 0 0 var(--line); }
td.pv-label { padding-left: calc(8px + var(--d, 0) * 22px); min-width: 220px; vertical-align: middle; }
td.pv-label .pv-text { vertical-align: middle; margin-left: 4px; }
td.pv-label > button.exp, td.pv-label > .exp-gap { vertical-align: middle; }
table.pv tr.lvl0 td { font-weight: 600; }
table.pv tr.lvl1 td, table.pv tr.lvl2 td, table.pv tr.lvl3 td { background: var(--surface-2); }
table.pv tr.lvl1 td.pv-label, table.pv tr.lvl2 td.pv-label, table.pv tr.lvl3 td.pv-label { background: var(--surface-2); }
table.pv tr.lvl2 td, table.pv tr.lvl3 td { color: var(--ink-2); }
button.exp { min-height: 32px; min-width: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); flex: none; border-radius: var(--r-sm); }
button.exp:hover { background: var(--sunken); color: var(--ink); border-color: transparent; }
button.exp svg.i { width: 18px; height: 18px; }
button.exp.rec { color: var(--primary); }
.exp-gap { display: inline-block; width: 32px; flex: none; }
button.fig { min-height: 32px; padding: 2px 4px; margin: -2px -4px; border: 0; border-bottom: 1px dotted var(--line-strong); border-radius: 3px; background: transparent; font-weight: inherit; color: inherit; font-size: inherit; }
button.fig:hover { color: var(--primary); border-bottom-color: var(--primary); background: var(--info-soft); }
th button.sorter { min-height: 32px; padding: 0 4px; margin: 0 -4px; border: 0; background: transparent; color: var(--muted); font-size: 0.8125rem; font-weight: 600; gap: 4px; }
th button.sorter:hover { color: var(--ink); background: var(--surface-2); }
th button.sorter svg.i { width: 14px; height: 14px; opacity: 0.7; }
th.num button.sorter { margin-left: auto; }
th[aria-sort] button.sorter { color: var(--ink); }
.pv-help { padding: 10px 20px 14px; margin: 0; }
details.pv-details { padding: 0; }
details.pv-details > summary { padding: 12px 20px; flex-wrap: wrap; gap: 4px 10px; }
.pv-setup-body { padding: 0 20px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.pv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
fieldset.pv-values { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 12px; margin: 0; }
fieldset.pv-values legend { font-size: 0.8125rem; font-weight: 600; color: var(--muted); padding: 0 4px; }
.pv-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* side panel with source records */
.sidepanel-wrap { position: fixed; inset: 0; z-index: 60; }
.sp-backdrop { position: absolute; inset: 0; background: oklch(0.2 0.02 250 / 0.36); }
aside.sidepanel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 92vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); display: grid; grid-template-rows: auto 1fr auto; }
@media (prefers-reduced-motion: no-preference) { aside.sidepanel { animation: slidein 200ms var(--ease, ease-out); } }
@keyframes slidein { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sp-head h2 { margin: 2px 0 0; font-size: 1.125rem; }
.sp-head p { margin: 0; }
.sp-body { overflow: auto; padding: 12px 0; }
.sp-body > p { padding: 0 20px; }
.sp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pv-records > p { padding: 12px 20px 0; }

/* templates */
.tpl-group { display: grid; gap: 10px; margin-bottom: 24px; }
.tpl-group h2 { margin: 0; }
.tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
a.tpl { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); text-decoration: none; min-height: 88px; }
a.tpl:hover { border-color: var(--acc, var(--primary)); background: var(--surface-2); }
a.tpl .pill { justify-self: start; margin-top: 4px; }

/* cost code tree */
.cc-code { display: inline-block; padding-left: calc(var(--d, 0) * 18px); }

@media (max-width: 1100px) { .pv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .pv-grid { grid-template-columns: minmax(0, 1fr); }
  td.pv-label { min-width: 170px; max-width: 62vw; white-space: normal; padding-left: calc(4px + var(--d, 0) * 14px); }
  table.stmt td.pv-label { max-width: none; padding: 4px 6px 4px 0; white-space: normal; overflow-wrap: anywhere; }
  table.stmt td.pv-label.open { white-space: normal; }
  aside.sidepanel { width: 100vw; border-left: 0; }
  .sp-head, .sp-foot { padding-left: 16px; padding-right: 16px; }
  details.pv-details > summary { padding: 14px 16px; }
  .pv-setup-body { padding: 14px 16px 16px; }
  .pv-help { padding: 10px 16px 14px; }
}

/* tenders: steps, sections, plan, comparison, proposal (0.4.0) */
ol.flow { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 4px; padding: 0; font-size: 0.8125rem; color: var(--muted); }
ol.flow li { display: inline-flex; align-items: center; gap: 8px; }
ol.flow .dot { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); font-size: 0.75rem; font-weight: 600; background: var(--surface); }
ol.flow .dot svg.i { width: 14px; height: 14px; }
ol.flow li.done { color: var(--ink-2); }
ol.flow li.done .dot { background: var(--good-soft); border-color: var(--good); color: var(--good); }
ol.flow li.now { color: var(--ink); font-weight: 600; }
ol.flow li.now .dot { background: var(--acc, var(--primary)); border-color: var(--acc, var(--primary)); color: var(--on-primary); }
.inline.between { justify-content: space-between; }
.inline.decision { flex-wrap: wrap; }
ul.tight { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 2px; }
.lane-h.pending { border-bottom-color: var(--warn); }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.plan-side { position: sticky; top: 12px; }
table.summary td { padding: 8px; }
table.summary td.num { white-space: nowrap; }
table.summary tr.sub td { border-top: 1px solid var(--line-strong); }
details.quick { padding: 0; }
details.quick > summary { padding: 12px 20px; flex-wrap: wrap; gap: 4px 10px; }
details.quick > form { padding: 0 20px 18px; }
table.plan-ed input { min-width: 0; }
table.plan-ed td.pl-name { min-width: 220px; white-space: nowrap; }
table.plan-ed td.pl-name input { width: calc(100% - 24px); display: inline-block; }
table.plan-ed tr.pl-1 td.pl-name input { width: 100%; }
table.plan-ed tr.pl-2 td.pl-name { padding-left: 30px; }
.pl-sub { color: var(--muted); }
table.plan-ed td input[name=fee] { width: 130px; text-align: right; }
table.plan-ed input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.sub-stage { padding-left: 18px; position: relative; color: var(--ink-2); }
.sub-stage::before { content: '↳'; position: absolute; left: 0; color: var(--muted); }
table.budget tr.group td { background: var(--surface-2); font-size: 0.8125rem; }
table.compare th[scope=row] { color: var(--muted); font-weight: 600; width: 150px; white-space: nowrap; vertical-align: top; }
table.compare td, table.compare thead th { min-width: 200px; }
table.compare tr.wrap td { white-space: pre-line; font-size: 0.8125rem; }
table.compare td.sel, table.compare th.sel { background: var(--good-soft); }
table.compare td.cheap b { color: var(--good); }
table.compare td .pill { margin-left: 6px; }
form.rate-ed { gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }

.proposal-page .no-print { margin-bottom: 12px; }
article.proposal { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 40px 48px; max-width: 860px; margin: 0 auto; display: grid; gap: 22px; }
article.proposal h1 { margin: 0; font-size: 1.75rem; }
article.proposal h2 { font-size: 1.125rem; margin: 0 0 8px; }
article.proposal section p { margin: 0 0 10px; max-width: 58ch; }
header.lh { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line-strong); }
.lh-name { font-size: 1.125rem; }
.lh-meta { text-align: right; font-size: 0.8125rem; color: var(--ink-2); }
table.prop-fees tr.sub-row td { font-size: 0.9375rem; }
footer.lh-foot { border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); }
@media print {
  .no-print { display: none !important; }
  article.proposal { border: 0; padding: 0; max-width: none; }
  header.lh { border-bottom-color: #555; }
}
@media (max-width: 1100px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } .plan-side { position: static; } }
@media (max-width: 640px) {
  article.proposal { padding: 20px 16px; }
  header.lh { flex-direction: column; }
  .lh-meta { text-align: left; }
  table.plan-ed td.pl-name { min-width: 0; white-space: normal; }
  table.plan-ed tr.pl-2 td.pl-name { padding-left: 12px; }
  table.plan-ed td input[name=fee] { width: 100%; }
  ol.flow { gap: 6px 14px; font-size: 0.8125rem; }
  table.compare th[scope=row] { width: 92px; white-space: normal; }
  table.compare td, table.compare thead th { min-width: 160px; }
}
table.plan-ed td input[type=date] { width: 150px; }
table.plan-ed td.pl-name { min-width: 280px; }
article.proposal { min-width: 0; }
@media (max-width: 640px) { table.prop-fees th, table.prop-fees td { padding: 8px; font-size: 0.8125rem; } table.prop-fees td:nth-child(2) { min-width: 0; } }
.bl-list { border-top: 1px solid var(--line); }
details.bl-group { border-bottom: 1px solid var(--line); }
details.bl-group > summary { padding: 10px 20px; gap: 10px; color: var(--ink); font-weight: 600; }
details.bl-group > summary .bl-name { flex: 1; }
details.bl-group > summary .bl-tot { font-weight: 600; color: var(--ink-2); }
details.bl-group[open] > summary { background: var(--surface-2); }
.bl-foot { display: flex; justify-content: space-between; padding: 12px 20px; background: var(--surface-2); font-weight: 600; }
@media (max-width: 640px) { details.bl-group > summary, .bl-foot { padding-left: 16px; padding-right: 16px; } }
table.plan-ed td input[type=date] { width: 140px; }
table.plan-ed td input[name=fee] { width: 120px; }
table.plan-ed td.pl-name { min-width: 230px; }
table.plan-ed td, table.plan-ed th { padding-left: 8px; padding-right: 8px; }
@media (max-width: 640px) {
  button.exp { min-height: 44px; min-width: 44px; }
  button.fig { min-height: 44px; min-width: 44px; }
  th button.sorter { min-height: 44px; }
  table.pv td, table.pv th { padding-top: 2px; padding-bottom: 2px; }
}
@media (max-width: 640px) { table.stmt tbody td { padding-top: 4px; padding-bottom: 4px; vertical-align: middle; } }
details:not([open]) > :not(summary) { display: none; }

.subs-intro { max-width: 60ch; }

/* ---- 0.4.1 */
/* sticky column headers on long tables (approvals, pay runs) */
.table-wrap:has(> table.sticky) { max-height: min(75vh, 900px); overflow: auto; }
table.sticky thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
td.st .pill + .pill { margin-left: 6px; }
label.check.inline { display: inline-flex; min-height: 32px; gap: 8px; font-weight: 600; }
.name-btn { all: unset; cursor: pointer; font-weight: 600; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; border-radius: 4px; }
.name-btn:hover { text-decoration-thickness: 2px; }
.name-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.working { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.working li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.working li:last-child { border-bottom: 0; }
.working li.sum { font-weight: 600; }
.working li span:last-child { font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.resolve-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 640px) {
  table.grid td.day::before { font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: clip; letter-spacing: -0.01em; }
  .table-wrap:has(> table.sticky) { max-height: none; }
  /* approvals: a compact card per person-week */
  table.appr tr.card-row, table.appr tr.total { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 16px; padding: 10px 14px; position: relative; }
  table.appr tr.card-row { padding-left: 52px; }
  table.appr td.sel { position: absolute; left: 10px; top: 6px; width: 44px; display: grid; place-items: center; }
  table.appr td.sel::before { display: none; }
  table.appr td.sel input { width: 22px; height: 22px; min-height: 44px; }
  table.appr td.who, table.appr td.act, table.appr tr.total td:nth-child(2) { grid-column: 1 / -1; }
  table.appr td.opt, table.appr tr.total td.sel { display: none; }
  table.appr td.st { justify-content: flex-start; flex-wrap: wrap; }
  table.appr td.act .row-actions { gap: 6px; }
}
.t-other_leave { background: var(--contacts-soft); color: var(--contacts-ink); border-color: color-mix(in oklch, var(--contacts) 50%, transparent); }
.t-leave { background: var(--sunken); color: var(--ink-2); border-color: color-mix(in oklch, var(--ink-2) 35%, transparent); }
@media (max-width: 640px) {
  table.cal th.who { min-width: 104px; max-width: 120px; padding: 6px 8px; }
  table.cal th.who .nm { font-size: 0.8125rem; }
  table.cal th.who .small { display: none; }
}
@media (max-width: 640px) {
  .subtabs { scrollbar-width: thin; }
  .subtabs.more-right { mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
  .subtabs.more-left.more-right { mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); }
  .subtabs.more-left:not(.more-right) { mask-image: linear-gradient(90deg, transparent, #000 32px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); }
}
.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 640px) { .name-btn { display: inline-flex; align-items: center; min-height: 44px; } }
@media (max-width: 640px) {
  table.appr td.st::before { display: none; }
  table.appr td.st { justify-content: flex-end; }
  table.appr td.act a.btn { display: none; }
  table.appr td.act .row-actions { flex-wrap: nowrap; }
  table.appr td.act .row-actions button { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 640px) { table.appr tr.card-row td.act { margin-left: -38px; } table.appr td.act .row-actions { gap: 6px; } }
table.sticky tfoot td { position: sticky; bottom: 0; z-index: 1; background: var(--surface-2); box-shadow: inset 0 1px 0 var(--line); }
@media (max-width: 640px) { table.sticky tfoot td { position: static; } }
@media (max-width: 640px) { table.run tbody td.zero { display: none; } }
@media (min-width: 641px) { .resolve-actions { flex-wrap: nowrap; } }

/* ------------------------------------------------------------------ 0.4.2 */
/* profit strip: fee, cost, profit and margin stay in view on the plan */
.profit-strip { position: sticky; top: calc(var(--hdr, 0px) + 8px); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 28px; padding: 10px 16px;
  background: var(--surface); border: 0; border-radius: var(--r); box-shadow: 0 0 0 1px var(--line), 0 2px 6px oklch(0.3 0.02 250 / 0.08); font-variant-numeric: lining-nums tabular-nums; }
.profit-strip > span { display: inline-flex; align-items: baseline; gap: 8px; }
.profit-strip .l { font-size: 0.8125rem; color: var(--muted); }
.profit-strip b { font-size: 1.125rem; }
@media (max-width: 640px) { .profit-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 8px 12px; } .profit-strip b { font-size: 0.9375rem; } }
/* segmented switch */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 9px; }
.seg button { min-height: 36px; border: 0; background: transparent; border-radius: 7px; padding: 0 14px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 250 / 0.12); }
@media (max-width: 640px) { .seg button { min-height: 44px; } }
/* cost tree: one table, indented rows, subtotals on every group, aligned columns */
.ct { display: grid; gap: 8px; }
.ct-tools { display: flex; gap: 4px; justify-content: flex-end; }
.ct-tools button { min-height: 36px; font-size: 0.8125rem; }
.ct-wrap { border: 1px solid var(--line); border-radius: var(--r); }
table.ct-table { width: 100%; border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; }
table.ct-table th { position: sticky; top: 0; background: var(--surface-2); font-size: 0.8125rem; color: var(--ink-2); text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; z-index: 1; }
table.ct-table th.num, table.ct-table td.num { text-align: right; white-space: nowrap; }
table.ct-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.ct-table tr.ct-grp td { font-weight: 600; }
table.ct-table tr.ct-d0 td { background: var(--surface-2); }
table.ct-table tr.ct-d0.ct-grp td { border-top: 1px solid var(--line-strong); }
table.ct-table tr.ct-d1.ct-grp td { background: color-mix(in oklch, var(--surface-2) 45%, var(--surface)); }
table.ct-table tr.ct-leaf td { font-weight: 400; color: var(--ink); }
table.ct-table tr.ct-leaf td.num { color: var(--ink-2); }
table.ct-table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--line-strong); border-bottom: 0; }
.ct-name { min-width: 260px; }
.ct-lab { display: inline-flex; align-items: center; gap: 6px; }
.ct-tog { display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 0; background: transparent; border-radius: 6px; color: var(--ink-2); flex: none; }
.ct-tog:hover { background: var(--sunken); }
.ct-tog svg.i { transition: transform 0.15s; }
.ct-tog[aria-expanded="false"] svg.i { transform: rotate(-90deg); }
.ct-tog-sp { display: inline-block; width: 28px; flex: none; }
.ct-kind { display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ct-sub { font-weight: 400; }
td.act .row-actions { justify-content: flex-end; }
.neg { color: var(--bad); }
p.bridge { margin: 0; padding: 10px 12px; background: var(--info-soft); border-radius: var(--r-sm); font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 640px) {
  .ct-name { min-width: 200px; position: sticky; left: 0; background: inherit; z-index: 1; }
  table.ct-table tr td.ct-name { background: var(--surface); }
  table.ct-table tr.ct-d0 td.ct-name { background: var(--surface-2); }
  .ct-tog { width: 44px; height: 44px; min-height: 44px; }
  .ct-tog-sp { width: 44px; }
  .ct-tools button { min-height: 44px; }
}
/* quotes: side by side on wide screens, cards on a phone */
.q-cards { display: none; gap: 10px; }
.q-card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; }
.q-card.sel { border-color: var(--good); background: color-mix(in oklch, var(--good-soft) 50%, var(--surface)); }
@media (max-width: 640px) { .q-compare { display: none; } .q-cards { display: grid; } }
/* approval history */
details.history { padding: 0; }
details.history > summary { padding: 10px 16px; gap: 8px; }
ol.hist { margin: 0; padding: 0 16px 14px 34px; display: grid; gap: 10px; }
ol.hist ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 6px; }
blockquote { margin: 6px 0 0; padding: 6px 12px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-sm); font-style: italic; }
/* home tile badge */
a.tile-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 4px 10px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); font-size: 0.8125rem; font-weight: 600; text-decoration: none; min-height: 32px; }
a.tile-badge b { font-size: 0.9375rem; }
@media (max-width: 640px) { a.tile-badge { min-height: 44px; } }
.lh-preview { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.lh-preview img { max-width: 200px; max-height: 80px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; }
@media (max-width: 640px) { .lh-preview { grid-template-columns: 1fr; } }
label.btn input.visually-hidden { position: absolute; }
/* bill lines: cost code, award and override get their own places */
table.lines tr { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; grid-template-areas: "desc desc desc amt vat rm" "code acct unit proj stage stage" "extra extra extra extra extra extra"; }
.l-code { grid-area: code; } .l-extra { grid-area: extra; }
table.lines td.l-extra { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: end; }
table.lines td.l-extra::before { display: none; }
table.lines td.l-extra label.f { min-width: 260px; max-width: 520px; display: grid; gap: 4px; }
table.lines td.l-extra:not(:has(> :not([hidden]))) { display: none; }
@media (max-width: 640px) { table.lines tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "desc desc" "amt vat" "code code" "acct acct" "unit unit" "proj stage" "extra extra" "rm rm"; } table.lines td.l-extra label.f { min-width: 0; } }
.follow-note { margin: -4px 0 0; }

/* ---- the client proposal: always light paper, A4 when printed */
.proposal-page .no-print { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
article.proposal { --p-ink: #1f2430; --p-ink2: #4a5162; --p-muted: #6b7182; --p-line: #d9dce3; --p-rule: #1f2430; --p-accent: #a14a2a; --p-soft: #f5f2ee;
  color-scheme: light; background: #fff; color: var(--p-ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 56px 64px; max-width: 880px; margin: 0 auto; display: block;
  font-size: 15px; line-height: 1.55; font-variant-numeric: lining-nums tabular-nums; }
article.proposal h1, article.proposal h2, article.proposal b, article.proposal dd { color: var(--p-ink); }
article.proposal p { margin: 0 0 10px; max-width: 56ch; }
article.proposal p.bullet { padding-left: 18px; position: relative; } article.proposal p.bullet::before { content: ''; position: absolute; left: 4px; top: 0.7em; width: 5px; height: 5px; border-radius: 50%; background: var(--p-accent); }
article.proposal section { margin: 0 0 30px; }
article.proposal h2 { display: flex; align-items: baseline; gap: 12px; font-size: 1.125rem; font-weight: 600; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--p-line); }
article.proposal h2 .n { font-size: 0.8125rem; font-weight: 600; color: var(--p-accent); letter-spacing: 0.04em; min-width: 18px; }
article.proposal .small { color: var(--p-muted); font-size: 0.8125rem; }
section.cover { display: grid; gap: 36px; min-height: 900px; align-content: start; }
header.lh { display: flex; gap: 22px; align-items: center; padding-bottom: 22px; border-bottom: 2px solid var(--p-rule); justify-content: flex-start; }
.lh-logo { max-height: 64px; max-width: 220px; object-fit: contain; }
.lh-mono { display: grid; place-items: center; width: 60px; height: 60px; border: 2px solid var(--p-rule); color: var(--p-rule); font-weight: 600; font-size: 1.375rem; letter-spacing: 0.04em; flex: none; }
.lh-firm { display: grid; gap: 2px; }
.lh-name { font-size: 1.25rem; letter-spacing: 0.01em; }
.lh-line { font-size: 0.8125rem; color: var(--p-ink2); }
.cover-title { padding-top: 70px; }
.cover-title .kicker { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.8125rem; font-weight: 600; color: var(--p-accent); margin: 0 0 14px; }
.cover-title h1 { font-size: 2.6rem; line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 16px; max-width: 18ch; }
.cover-for { font-size: 1.125rem; color: var(--p-ink2); }
dl.cover-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 40px; margin: 0; padding: 22px 0; border-top: 1px solid var(--p-line); border-bottom: 1px solid var(--p-line); }
dl.cover-meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--p-muted); font-weight: 600; }
dl.cover-meta dd { margin: 3px 0 0; font-weight: 500; }
p.cover-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--p-soft); padding: 16px 20px; border-top: 1px solid var(--p-line); border-bottom: 1px solid var(--p-line); max-width: none; }
p.cover-total span { color: var(--p-ink2); } p.cover-total b { font-size: 1.375rem; }
section.letter address.to { font-style: normal; margin: 0 0 18px; color: var(--p-ink2); line-height: 1.5; }
section.letter .sig-name { margin-top: 34px; line-height: 1.45; }
table.prop-fees { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
table.prop-fees col.c-stage { width: 56%; } table.prop-fees col.c-prog { width: 26%; } table.prop-fees col.c-fee { width: 18%; }
table.prop-fees th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--p-muted); padding: 8px 10px; border-bottom: 2px solid var(--p-rule); background: transparent; }
table.prop-fees td { padding: 9px 10px; border-bottom: 1px solid var(--p-line); color: var(--p-ink); vertical-align: top; }
table.prop-fees th.num, table.prop-fees td.num { text-align: right; white-space: nowrap; }
table.prop-fees tr.st td { padding-top: 12px; }
table.prop-fees tr.sub-row td { font-size: 0.9375rem; color: var(--p-ink2); padding-top: 5px; padding-bottom: 5px; border-bottom-style: dotted; }
table.prop-fees tr.sub-row td:first-child { padding-left: 28px; }
table.prop-fees tfoot td { border-top: 2px solid var(--p-rule); border-bottom: 0; font-weight: 600; padding-top: 12px; font-size: 1.125rem; }
table.prop-fees .sub-stage::before { content: none; }
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 18px; }
.sign-h { font-weight: 600; margin-bottom: 30px; }
.sign-line { border-bottom: 1px solid var(--p-ink); height: 34px; margin-bottom: 4px; }
.sign-line.short { width: 60%; }
footer.lh-foot { border-top: 1px solid var(--p-line); padding-top: 12px; color: var(--p-muted); }
@media (max-width: 640px) {
  article.proposal { padding: 24px 18px; font-size: 14px; }
  section.cover { min-height: 0; gap: 22px; }
  header.lh { flex-direction: row; align-items: flex-start; }
  .cover-title { padding-top: 10px; } .cover-title h1 { font-size: 1.75rem; }
  dl.cover-meta { grid-template-columns: 1fr; }
  .sign-grid { grid-template-columns: 1fr; gap: 24px; }
  table.prop-fees col.c-prog { width: 0; } table.prop-fees th:nth-child(2), table.prop-fees td:nth-child(2) { display: none; }
}
@media print {
  html, body { background: #fff !important; color: #1f2430 !important; color-scheme: light !important; }
  .proposal-page { padding: 0 !important; }
  article.proposal { border: 0; box-shadow: none; border-radius: 0; padding: 0; max-width: none; font-size: 10.5pt; }
  section.cover { min-height: 0; height: 247mm; break-after: page; display: flex; flex-direction: column; gap: 0; }
  section.cover .cover-title { padding-top: 48mm; flex: 1; }
  section.cover dl.cover-meta { margin-bottom: 10mm; }
  section.letter { break-after: page; }
  .keep, .accept, tbody.stage-block, table.prop-fees tfoot { break-inside: avoid; page-break-inside: avoid; }
  article.proposal h2 { break-after: avoid; page-break-after: avoid; }
  table.prop-fees thead { display: table-header-group; }
  footer.lh-foot { display: none; }
  a[href]::after { content: none !important; }
}
@media (max-width: 640px) {
  .ct-name { min-width: 150px; }
  table.ct-table td, table.ct-table th { padding: 8px 8px; }
  table.ct-table tr.ct-leaf td.ct-name { font-size: 0.8125rem; }
  table.ct-table td.act .row-actions { gap: 0; flex-wrap: nowrap; }
  /* stage editor: name on its own line, then fee and dates side by side */
  table.plan-ed tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; padding: 12px 16px; }
  table.plan-ed tbody td { padding: 0; }
  table.plan-ed tbody td.pl-name { grid-column: 1 / -1; }
  table.plan-ed tbody td.act { grid-column: 1 / -1; justify-self: end; }
  table.plan-ed tbody td input[type=date] { width: 100%; }
  table.plan-ed tr.pl-2 { padding-left: 32px !important; background: var(--surface-2); }
}
/* the proposal is paper: the app's dark theme never reaches it */
article.proposal { --ink: #1f2430; --ink-2: #4a5162; --muted: #6b7182; --line: #d9dce3; --line-strong: #b9bdc7; --surface: #fff; --surface-2: #f6f6f8; --sunken: #eceef2; --canvas: #fff; }
article.proposal table.prop-fees tfoot tr.total td, article.proposal table.prop-fees tr td { background: #fff; color: var(--p-ink); }
article.proposal table.prop-fees tr.sub-row td { color: var(--p-ink2); }
@media print { article.proposal table.prop-fees tfoot { display: table-row-group; } }
table.prop-fees col.c-stage { width: 50%; } table.prop-fees col.c-prog { width: 32%; }
table.prop-fees td:nth-child(2) { white-space: nowrap; font-size: 0.9em; }
@media (max-width: 640px) { table.prop-fees td:nth-child(2) { white-space: normal; } }
article.proposal p.cover-total { max-width: none; }
ol.hist { list-style: none; padding-left: 16px; }
details.history p.hist-note { padding: 0 16px 14px; margin: 0; }
/* 0.4.3: on a phone each tree row is a card: the label, then every figure in a two-column grid */
@media (max-width: 640px) {
  .ct-wrap { border: 0; overflow: visible; }
  table.ct-table, table.ct-table tbody, table.ct-table tfoot { display: block; }
  table.ct-table thead { display: none; }
  table.ct-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 14px; padding: 10px 12px 10px calc(10px + var(--depth, 0) * 14px); border-bottom: 1px solid var(--line); }
  table.ct-table tr[hidden] { display: none; }
  table.ct-table td { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 0 !important; border: 0; background: none !important; min-width: 0; }
  table.ct-table td.ct-name { grid-column: 1 / -1; position: static; min-width: 0; padding: 0 0 4px !important; font-size: 0.9375rem; }
  table.ct-table td.num::before { content: attr(data-label); color: var(--muted); font-size: 0.75rem; font-weight: 500; }
  table.ct-table td.blank { display: none; }
  table.ct-table td.act { grid-column: 1 / -1; justify-content: flex-end; }
  table.ct-table td.act:empty { display: none; }
  table.ct-table tr.ct-d0.ct-grp { background: var(--surface-2); }
  table.ct-table tr.ct-d1.ct-grp { background: color-mix(in oklch, var(--surface-2) 45%, var(--surface)); }
  table.ct-table tfoot tr { background: var(--surface-2); border-top: 2px solid var(--line-strong); }
  table.ct-table tfoot td:first-child { grid-column: 1 / -1; }
  .ct-lab { align-items: flex-start; }
  .ct-tog { width: 44px; height: 44px; min-height: 44px; margin: -10px 0 -10px -8px; }
  .ct-tog-sp { width: 0; }
  table.ct-table td.act .row-actions button { min-width: 44px; }
}
@media (max-width: 640px) { table.ct-table tr.ct-row td, table.ct-table tr.ct-d0.ct-grp td { border: 0; } table.ct-table tr.ct-grp td.num { font-weight: 600; } }


/* ================================================================== 0.5.0: home, inbox, search, sign-in, type */
/* Type scale: 28/36 page and greeting titles, 18/26 section titles, 15/22 body, 13/18 meta, 12/16 chips.
   Weights 400, 500 and 600 only. */
:root { --fs-meta: 0.8125rem; --lh-meta: 1.125rem; --fs-chip: 0.75rem; --lh-chip: 1rem; --r-xl: 16px; }
p, li, td, dd { line-height: 1.375rem; }
.small, .muted.small, td .muted { font-size: var(--fs-meta); line-height: var(--lh-meta); }
.pagehead .sub { font-size: 0.9375rem; line-height: 1.375rem; }
.panel .ph h2 { font-size: 1.125rem; line-height: 1.625rem; }
@media (min-width: 641px) { input, select, textarea { font-size: 0.9375rem; } }
.btn.icon { padding: 0; width: var(--tap); }
.top-row a.btn.icon[aria-current="page"] { background: var(--surface-2); }
button.sm, .btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-meta); }
.btn.primary-soft, button.primary-soft { background: var(--info-soft); border-color: transparent; color: var(--primary); }
.btn.primary-soft:hover { background: color-mix(in oklch, var(--info-soft) 70%, var(--primary) 12%); color: var(--primary); border-color: transparent; }
@media (max-width: 640px) { button.sm, .btn.sm { min-height: 44px; padding: 0 14px; } }
kbd { font: 500 var(--fs-chip)/var(--lh-chip) var(--font); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); }
.quiet { color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); padding: 6px 0; }
.count-l { font-size: var(--fs-meta); color: var(--muted); }

/* cards and section heads, the home's one container */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; min-width: 0; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 36px; margin-bottom: 8px; }
.sec-h h2 { font-size: 1.125rem; line-height: 1.625rem; }
.sec-note { font-size: var(--fs-meta); color: var(--muted); margin: -4px 0 10px; }
.sec-f { display: flex; justify-content: flex-start; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); }
.sec-f a { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-weight: 500; text-decoration: none; }
.sec-f a svg.i { width: 16px; height: 16px; }

/* home layout: 1240 wide, left column and a right rail */
.page.home { max-width: 1240px; margin: 0 auto; gap: 24px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(300px, 3fr); gap: 24px; align-items: start; }
.home-main, .home-rail { display: grid; gap: 24px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1023px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-rail { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* greeting band: the image on the right, the surface behind the text on the left */
.greet { position: relative; overflow: hidden; border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface); min-height: 168px; display: flex; align-items: center; }
.greet-art { position: absolute; inset: 0 0 0 auto; width: 62%; }
.greet-art img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; display: block; }
.greet-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--surface) 0%, color-mix(in oklch, var(--surface) 78%, transparent) 22%, color-mix(in oklch, var(--surface) 20%, transparent) 55%, transparent 80%); }
.greet-text { position: relative; display: grid; gap: 6px; padding: 24px 28px; width: min(620px, 64%); }
.greet h1 { font-size: 1.75rem; line-height: 2.25rem; }
.greet-sub { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.375rem; }
.greet-sub a { font-weight: 500; }
.greet-search { justify-content: flex-start; width: min(460px, 100%); margin-top: 10px; gap: 10px; padding: 0 10px 0 14px; color: var(--muted); font-weight: 400; background: var(--surface); border-color: var(--line-strong); box-shadow: 0 1px 2px oklch(0.3 0.02 250 / 0.06); }
.greet-search:hover { color: var(--ink-2); background: var(--surface); }
.greet-search .ph { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.greet-search svg.i { width: 18px; height: 18px; }
.greet-img.dark, .gate-img.dark { display: none; }
:root[data-theme="dark"] .greet-img.light, :root[data-theme="dark"] .gate-img.light { display: none; }
:root[data-theme="dark"] .greet-img.dark, :root[data-theme="dark"] .gate-img.dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .greet-img.light, :root:not([data-theme="light"]) .gate-img.light { display: none; }
  :root:not([data-theme="light"]) .greet-img.dark, :root:not([data-theme="light"]) .gate-img.dark { display: block; }
}

/* apps: icon and name, even tiles */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.app { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 112px; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: border-color 160ms ease, background-color 160ms ease; }
.app:hover { border-color: color-mix(in oklch, var(--acc) 55%, var(--line)); background: color-mix(in oklch, var(--acc-soft) 25%, var(--surface)); }
.app-link { display: grid; justify-items: center; align-content: center; gap: 10px; padding: 16px 8px 14px; color: var(--ink); text-decoration: none; border-radius: var(--r-lg); text-align: center; }
.app-link:hover { color: var(--ink); }
.app .mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc-ink); }
.app .mark svg.i { width: 24px; height: 24px; stroke-width: 1.7; }
.app .lbl { font-weight: 500; font-size: 0.9375rem; line-height: 1.375rem; }
.app .mark { position: relative; }
.app .pin-mark { position: absolute; top: -7px; right: -9px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.app .pin-mark svg.i { width: 12px; height: 12px; }
.app button.pin { margin: 0 8px 8px; min-height: 36px; font-size: var(--fs-meta); gap: 6px; }
.app button.pin svg.i { width: 15px; height: 15px; }
.app button.pin[aria-pressed="true"] { background: var(--info-soft); color: var(--primary); border-color: transparent; }
.app.planned { border-style: dashed; background: transparent; }
.app.planned:hover { border-color: var(--line); background: transparent; }
.app.planned .mark { background: var(--surface-2); color: var(--muted); }
.app.planned .lbl { color: var(--ink-2); }
.app.planned .tag { position: absolute; top: 8px; right: 8px; font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.app-more { display: none; }

/* needs you */
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 250 / 0.12); }
.seg button .count { margin-left: 6px; font-size: var(--fs-chip); line-height: var(--lh-chip); font-weight: 500; color: var(--muted); padding: 1px 7px; border-radius: 10px; background: var(--surface-2); }
.seg button[aria-selected="true"] .count { color: var(--ink-2); }
.seg.mini button { min-height: 32px; padding: 0 10px; font-size: var(--fs-meta); }
.nlist { list-style: none; margin: 0; padding: 0; }
.nrow { display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding: 12px 0; }
.nrow + .nrow { border-top: 1px solid var(--line); }
.nrow .nt { color: var(--ink); }
.nrow.unread .nt { font-weight: 500; }
.nrow.done .nt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.nrow .nm { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); margin-top: 2px; }
.nrow .nm.warn { color: var(--bad); font-weight: 500; }
.nrow .na { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cat { --c: var(--settings-ink); --cs: var(--settings-soft); justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-chip); line-height: var(--lh-chip); font-weight: 500; color: var(--c); background: var(--cs); padding: 4px 9px 4px 7px; border-radius: 999px; white-space: nowrap; }
.cat svg.i { width: 14px; height: 14px; }
.cat[data-cat="approve"] { --c: var(--projects-ink); --cs: var(--projects-soft); }
.cat[data-cat="review"] { --c: var(--reports-ink); --cs: var(--reports-soft); }
.cat[data-cat="submit"] { --c: var(--timesheets-ink); --cs: var(--timesheets-soft); }
.cat[data-cat="deadline"] { --c: var(--tenders-ink); --cs: var(--tenders-soft); }
.cat[data-cat="documents"] { --c: var(--hr-ink); --cs: var(--hr-soft); }
.cat[data-cat="hr"] { --c: var(--payroll-ink); --cs: var(--payroll-soft); }

/* newsfeed */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chipbtn { min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: var(--fs-meta); border-color: var(--line); gap: 6px; }
.chipbtn svg.i { width: 14px; height: 14px; }
.chipbtn[aria-pressed="true"] { background: var(--info-soft); border-color: color-mix(in oklch, var(--primary) 35%, var(--line)); color: var(--primary); }
.flist { list-style: none; margin: 0; padding: 0; }
.fitem { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 14px 0; }
.fitem + .fitem { border-top: 1px solid var(--line); }
.fmark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc-ink); }
.fmark svg.i { width: 20px; height: 20px; }
.fitem h3 a { color: var(--ink); text-decoration: none; }
.fitem h3 a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.fbody { color: var(--ink-2); white-space: pre-line; margin-top: 2px; max-width: 70ch; }
.fmeta { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); margin-top: 4px; }
.factions { display: flex; gap: 4px; margin: 6px 0 0 -12px; }

/* calendar card */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 4px; }
.cal-title { font-weight: 500; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; }
.cw { text-align: center; font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); padding: 4px 0; }
.cd { position: relative; display: grid; justify-items: center; align-content: start; gap: 1px; height: 40px; padding-top: 4px; }
.cd .dn { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: var(--fs-meta); }
.cd.wk .dn { color: var(--muted); }
.cd.hol { background: color-mix(in oklch, var(--good-soft) 75%, var(--surface)); }
.cd.today .dn { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.dots { display: flex; gap: 3px; height: 6px; }
.dots i, .cal-key i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
i.dl { background: var(--primary); }
i.dl.late { background: var(--bad); }
i.out { background: var(--hr); }
i.holk { width: 14px !important; height: 8px !important; border-radius: 2px !important; background: color-mix(in oklch, var(--good-soft) 75%, var(--surface)); border: 1px solid var(--line); }
.cal-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); margin-top: 8px; }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.week-strip { display: none; list-style: none; margin: 0; padding: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.week-strip li { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; }
.week-strip li.hol { background: color-mix(in oklch, var(--good-soft) 75%, var(--surface)); }
.week-strip .sd { font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); }
.week-strip .sn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 500; }
.week-strip li.today .sn { background: var(--primary); color: var(--on-primary); }
.upcoming { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.upcoming h3 { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.upcoming ul { list-style: none; margin: 0; padding: 0; display: grid; }
.upcoming li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 0; }
.ud { display: grid; justify-items: center; font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); border-radius: 10px; background: var(--surface-2); padding: 4px 0; }
.ud b { font-size: 1.125rem; line-height: 1.375rem; font-weight: 600; color: var(--ink); }
.up-holiday .ud { background: color-mix(in oklch, var(--good-soft) 75%, var(--surface)); }
.ut { display: grid; min-width: 0; }
.ut a { color: var(--ink); text-decoration: none; }
.ut a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.us { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* people cards */
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.plist li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: center; padding: 4px 0; }
.plist .avatar { width: 36px; height: 36px; }
.avatar.soft { background: var(--hr-soft); color: var(--hr-ink); border-color: transparent; }
.avatar.soft svg.i { width: 18px; height: 18px; }
.pn { display: grid; min-width: 0; }
.ps { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }

/* inbox page */
.page.inbox-page { max-width: 1040px; margin: 0 auto; }
.filters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.filters .chips { margin: 0; }
.toggles { display: flex; flex-wrap: wrap; gap: 0 16px; }
label.check.sm { font-size: var(--fs-meta); min-height: 36px; }

/* search palette */
dialog.palette { width: min(640px, calc(100vw - 32px)); align-self: start; margin-top: 12vh; }
dialog.palette .db { gap: 8px; padding: 12px; }
dialog.palette input[type="search"] { font-size: 1rem; min-height: 48px; }
.pal-list { display: grid; max-height: min(56vh, 480px); overflow: auto; padding: 2px; }
.pal-g { font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); font-weight: 500; padding: 10px 10px 4px; }
.pal-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.pal-item.active { background: var(--surface-2); }
.pal-item .mk { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc-ink); }
.pal-item .mk svg.i { width: 18px; height: 18px; }
.pal-item .pl { display: grid; min-width: 0; }
.pal-item .ps { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item .pk { font-size: var(--fs-chip); color: var(--muted); }
.pal-hint { font-size: var(--fs-chip); line-height: var(--lh-chip); color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 4px 6px 0; }

/* sign-in: a calm image behind a solid card */
.gate { position: relative; min-height: 100vh; display: grid; align-items: center; background: var(--canvas); overflow: hidden; }
.gate-art { position: absolute; inset: 0; }
.gate-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 60%; }
.gate-side { position: relative; padding: 40px 16px; padding-left: max(16px, 9vw); }
.gate-card { width: min(420px, 100%); display: grid; gap: 24px; background: var(--surface); border-radius: var(--r-xl); padding: 32px; box-shadow: var(--shadow-pop); }
.gate-brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.125rem; }
.gate-brand svg { width: 36px; height: 36px; }
.gate-form { display: grid; gap: 16px; }
.gate-form h1 { font-size: 1.75rem; line-height: 2.25rem; }
.gate .lede { color: var(--ink-2); margin-top: -8px; }
@media (max-width: 640px) {
  .gate { align-items: start; }
  .gate-art { bottom: auto; height: 260px; }
  .gate-art img { object-position: 88% 45%; }
  .gate-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--canvas) 100%); }
  .gate-side { padding: 160px 16px 32px; }
  .gate-card { padding: 24px 20px; }
}

/* phones: one column, cropped band, 4 apps across, a 7-day strip instead of the month */
@media (max-width: 640px) {
  .page.home { gap: 16px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .home-main, .home-rail { display: contents; }
  .apps { order: 1; } .needs { order: 2; } .cal-card { order: 3; } .feed { order: 4; } .people-card { order: 5; }
  .greet { min-height: 120px; align-items: flex-start; }
  .greet-art { width: 46%; }
  .greet-art img { object-position: 92% 50%; }
  .greet-art::after { background: linear-gradient(90deg, var(--surface) 0%, color-mix(in oklch, var(--surface) 80%, transparent) 22%, color-mix(in oklch, var(--surface) 15%, transparent) 65%, transparent 100%); }
  .greet-text { width: 100%; padding: 18px 16px 16px; }
  .greet h1 { font-size: 1.5rem; line-height: 2rem; max-width: 64%; }
  .greet-sub { max-width: 64%; }
  .greet-sub .dotsep { display: none; }
  .greet-sub span:first-child { display: block; }
  .greet-search { width: 100%; }
  .greet-search kbd { display: none; }
  .app-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 4px; }
  .app { min-height: 0; border-color: transparent; background: transparent; }
  .app:hover { background: transparent; border-color: transparent; }
  .app-link { padding: 4px 0 6px; gap: 6px; min-height: 44px; }
  .app .mark { width: 48px; height: 48px; border-radius: 14px; }
  .app .lbl { font-size: var(--fs-chip); line-height: var(--lh-chip); }
  .app .pin-mark { top: -6px; right: -8px; }
  .app button.pin { margin: 0; padding: 0 6px; }
  .app button.pin span { display: none; }
  .app.planned { border-color: transparent; }
  .app.planned .tag { position: static; justify-self: center; margin-top: -4px; padding: 0 4px; }
  .app.planned .mark { width: 48px; height: 48px; border-radius: 14px; }
  .app-grid:not(.all) > .app:nth-child(n+9) { display: none; }
  .app-more { display: flex; width: 100%; margin-top: 8px; }
  .card { padding: 14px 16px; }
  .nrow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chip" "body" "act"; gap: 6px; }
  .nrow .na { justify-content: flex-start; }
  .nrow .cat { grid-area: chip; }
  .nrow .nb { grid-area: body; }
  .nrow .na { grid-area: act; }
  .needs .nlist .nrow:nth-child(n+4) { display: none; }
  .seg.tabsbar { display: flex; width: 100%; }
  .seg.tabsbar button { flex: 1 1 0; padding: 0 4px; min-width: 0; font-size: var(--fs-meta); }
  .seg.tabsbar .count { margin-left: 4px; }
  .cal-month { display: none; }
  .week-strip { display: grid; }
  .seg.mini button { min-height: 44px; }
  .chipbtn { min-height: 44px; }
  .sec-f a { min-height: 44px; }
  .factions { margin-left: -14px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr); }
}
.switcher-btn { min-width: var(--tap); }
@media (max-width: 640px) { .chipbtn, .seg.mini button { min-width: var(--tap); } }

/* 0.5.1 */
body[data-page="home"] .top-row { max-width: 1272px; }
body[data-page="inbox"] .top-row { max-width: 1072px; }
button.icon.sm { width: 36px; padding: 0; }
button.snooze svg.i { width: 18px; height: 18px; }
button.snooze[aria-pressed="true"] { background: var(--info-soft); color: var(--primary); }
.nkids { margin-top: 6px; font-size: var(--fs-meta); line-height: var(--lh-meta); }
.nkids summary { cursor: pointer; color: var(--primary); min-height: 32px; display: inline-flex; align-items: center; }
.nkids ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); display: grid; gap: 2px; }
.nkids li.warn { color: var(--bad); }
.whatsnew { margin-top: 4px; }
.whatsnew summary { cursor: pointer; color: var(--primary); font-weight: 500; min-height: 32px; display: inline-flex; align-items: center; }
.whatsnew ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); display: grid; gap: 6px; max-width: 70ch; }
dl.facts.tight { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 20px; }
dl.facts.tight .warn dd { color: var(--bad); }
.others h3 { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); font-weight: 500; margin: 4px 0; }
.others ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
@media (max-width: 640px) { button.icon.sm { width: 44px; } .nkids summary, .whatsnew summary { min-height: 44px; } }
@media (max-width: 640px) {
  table.stmt td.pv-label { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; }
  table.stmt td.pv-label .pv-text { margin-left: 0; }
}

/* 0.6.0: module icons (a light tile each, so no tint box behind them) */
img.modicon { display: block; border-radius: 22%; }
.app .mark { width: 64px; height: 64px; border-radius: 0; background: none; }
.app .mark img.modicon { width: 64px; height: 64px; }
.app.planned .mark { background: none; }
.app.planned .mark img.modicon { opacity: 0.6; filter: grayscale(0.4); }
.crumb img.modicon { width: 24px; height: 24px; border-radius: 6px; }
.pal-item .mk.img { background: none; }
.pal-item .mk.img img.modicon { width: 32px; height: 32px; border-radius: 8px; }
:root[data-theme="dark"] img.modicon { filter: brightness(0.9); }
:root[data-theme="dark"] .app.planned .mark img.modicon { filter: brightness(0.9) grayscale(0.4); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.modicon { filter: brightness(0.9); }
  :root:not([data-theme="light"]) .app.planned .mark img.modicon { filter: brightness(0.9) grayscale(0.4); }
}
@media (max-width: 640px) { .app .mark, .app .mark img.modicon, .app.planned .mark { width: 56px; height: 56px; } }
table.stmt tr.head td { font-weight: 500; color: var(--ink-2); padding-top: 10px; }
table.stmt tr.in-group td.pv-label { padding-left: 24px; }
table.stmt tr.gsub td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.indent-1 { padding-left: 18px; display: inline-block; }
span.b { font-weight: 600; }
.actions .spacer { flex: 1; }

/* grouped tables (research rule 9): a header row per group, members indented, a bold subtotal with a
   single rule, a grand total in bold with a double rule on a light background */
table tr.grp td { font-weight: 600; color: var(--ink); padding-top: 16px; border-bottom: 1px solid var(--line); }
table tr.in-group td.lead { padding-left: 30px; }
table tr.subtotal td { font-weight: 600; border-top: 1px solid var(--line-strong); }
table tr.grand td { font-weight: 600; border-top: 3px double var(--ink-2); background: var(--surface-2); }
table.alloc { table-layout: auto; }
table.alloc td.lead { min-width: 0; }
p.recon { font-weight: 500; font-variant-numeric: tabular-nums; }
p.recon.bad { color: var(--bad); }
details.pool summary { cursor: pointer; font-weight: 500; min-height: 36px; display: flex; align-items: center; }
@media (max-width: 640px) {
  table.stack-sm tr.grp { display: block; border: 0; }
  table.stack-sm tr.grp td { display: block; padding: 14px 4px 4px; border: 0; }
  table.stack-sm tr.in-group td.lead { padding-left: 4px; }
  table.stack-sm tr.subtotal, table.stack-sm tr.grand { background: var(--surface-2); }
}

/* tooltips: hover and keyboard focus */
.tipwrap { position: relative; display: inline-flex; vertical-align: middle; margin-left: 2px; }
button.tip { min-height: 28px; width: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); border-radius: 50%; }
button.tip:hover { background: var(--surface-2); color: var(--ink); }
button.tip svg.i { width: 16px; height: 16px; }
.tiptext { display: none; position: absolute; z-index: 40; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 280px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--ink); color: var(--canvas); font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: 400; text-align: left; white-space: normal; box-shadow: var(--shadow-pop); }
.tipwrap:hover .tiptext, button.tip:focus-visible + .tiptext, button.tip:focus + .tiptext { display: block; }
th .tiptext { left: auto; right: 0; transform: none; }
@media (max-width: 640px) { button.tip { min-height: 44px; width: 44px; } .tiptext { left: auto; right: -8px; transform: none; max-width: 240px; } }

/* pay run */
dl.facts.strip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 18px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
dl.facts.strip dt { display: flex; align-items: center; gap: 2px; min-height: 28px; }
p.payrule { max-width: 90ch; }
table.run.grouped { font-size: var(--fs-meta); }
table.run.grouped th, table.run.grouped td { padding: 8px 10px; }
table.run.grouped td.lead { min-width: 190px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.run.grouped tr.subtotal td.lead, table.run.grouped tr.grand td.lead { background: inherit; }
table.run.grouped tr.grand td.lead { background: var(--surface-2); }
table.run.grouped .hrs { min-width: 150px; }
table.run.grouped .hrs .tipwrap { margin-left: 0; }
table.run.grouped .hrs button.tip { min-height: 20px; width: 20px; }
table.run.grouped .hrs button.tip svg.i { width: 13px; height: 13px; }
.working-t, table.days { width: 100%; font-size: var(--fs-meta); }
.working-t tr.sum td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.working-t tr.muted td { color: var(--muted); }
h3.sp-sec { margin: 18px 0 8px; }
h3.sp-sec:first-child { margin-top: 0; }
section.wk { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.wk-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); }
.wk-h h3 { font-size: var(--fs-meta); }
.wk-h a { margin-left: auto; }
table.days td, table.days th { padding: 6px 10px; vertical-align: top; }
table.days tr.off td { color: var(--muted); background: color-mix(in oklch, var(--surface-2) 50%, var(--surface)); }
table.days tr.unacc td { background: var(--warn-soft); }
@media (max-width: 640px) {
  table.run.grouped td.lead { position: static; min-width: 0; }
  table.run.grouped .hrs button.tip { min-height: 44px; width: 44px; }
}
.sp-body > h3.sp-sec { padding: 0 20px; }
.sp-body > section.wk { margin: 12px 20px; }
.sp-body > table.working-t th:first-child, .sp-body > table.working-t td:first-child, .sp-body > table.days.period td:first-child { padding-left: 20px; }
.hpart { white-space: nowrap; }
table.coa { table-layout: fixed; }
table.coa th:nth-child(1) { width: 90px; }
table.coa th:nth-child(3) { width: 22%; }
table.coa th:nth-child(4) { width: 160px; }
table.coa th:nth-child(5) { width: 140px; }
table.coa th:nth-child(6) { width: 80px; }
@media (max-width: 640px) { table.coa { table-layout: auto; } }
.pagehead nav.crumbs span[aria-current] { color: var(--ink-2); }
@media (max-width: 640px) {
  .pagehead nav.crumbs > a:not(:last-of-type), .pagehead nav.crumbs > .sep:not(:nth-last-child(2)) { display: none; }
}
@media (max-width: 640px) { .hpart { white-space: normal; } dl.facts.strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.home-grid > .feed { grid-column: 1 / -1; }
.feed .flist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); column-gap: 32px; }
.feed .fitem + .fitem { border-top: 0; }
.feed .fitem { border-bottom: 1px solid var(--line); }
.feed .sec-f { border-top: 0; }

/* ---- 0.7.0: intercompany and budgets */
.tabsbar-row { margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabsbar-row::-webkit-scrollbar { display: none; }
.tabsbar-row .seg button { white-space: nowrap; }
.fu { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; font-size: var(--fs-chip, 0.75rem); font-weight: 700; letter-spacing: 0.02em; }
.fu.good { background: var(--good-soft); color: var(--good); }
.fu.bad { background: var(--bad-soft); color: var(--bad); }
.fu-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
th.fucell, td.fucell { width: 34px; text-align: center; padding-left: 4px; padding-right: 4px; }
table.bva td, table.bva th { padding: 9px 10px; }
table.bva td.lbl { min-width: 200px; }
table.bva tr.band th { color: var(--ink-2); text-align: center; border-bottom: 0; padding-bottom: 0; }
table.bva tr.needs td { background: color-mix(in oklch, var(--warn-soft) 55%, transparent); }
table.bva .bva-note { color: var(--ink-2); margin-top: 4px; max-width: 34ch; }
table.bva td.act { white-space: nowrap; }
table.bgrid { font-size: 0.875rem; }
table.bgrid th, table.bgrid td { padding: 6px 4px; }
table.bgrid th:first-child, table.bgrid td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); padding-left: 14px; min-width: 210px; }
table.bgrid tr.total td:first-child, table.bgrid tr.group td:first-child { background: var(--surface-2); }
table.bgrid td.lbl { white-space: nowrap; }
table.bgrid td.tot { font-weight: 600; }
table.bgrid input.cell { width: 84px; min-height: 36px; padding: 4px 6px; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
table.bgrid button.phase { min-height: 28px; width: 28px; margin-left: 4px; vertical-align: middle; }
.profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.profile[hidden], label.f[hidden] { display: none; }
.pill.ml { margin-left: 8px; }
.billpick { max-height: 260px; overflow: auto; padding: 8px 0; }
ol.history { display: grid; gap: 6px; }
@media (max-width: 640px) {
  table.bva td.lbl { min-width: 0; }
  table.stack-sm td.fucell { width: auto; text-align: left; }
  table.bgrid td:first-child, table.bgrid th:first-child { min-width: 150px; }
}
table.bva td.act { padding-top: 4px; padding-bottom: 4px; vertical-align: middle; }
table.bva td.act button { min-height: 32px; }
@media (max-width: 640px) { table.bva td.act button { min-height: 44px; } }
.fu-inline { display: none; }
@media (max-width: 640px) { .fu-inline { display: inline; } table.bva tr td { padding-top: 1px; padding-bottom: 1px; } }
@media (max-width: 640px) {
  table.stack-sm tr.group td { justify-content: flex-start; }
  table.stack-sm tr.group td::before { display: none; }
  table.bva tr.needs { background: color-mix(in oklch, var(--warn-soft) 55%, transparent); }
  table.bva tr.needs td { background: transparent; }
}
footer.appfoot { max-width: 1480px; margin: 0 auto; padding: 8px 24px 24px; }
ul.cols { columns: 3 220px; }
@media (max-width: 640px) { table.bgrid input.cell { min-height: 44px; } table.bgrid button.phase { min-height: 44px; width: 44px; } }
@media (max-width: 640px) { table.bgrid td:first-child, table.bgrid th:first-child { min-width: 0; width: 136px; max-width: 136px; padding-left: 10px; } table.bgrid td.lbl { white-space: normal; } table.bgrid button.phase { margin-left: 0; } }
/* 0.7.1: panels carry a breadcrumb and where they were opened from; a wider panel keeps amounts in view */
aside.sidepanel { width: min(980px, 94vw); }
.sp-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-meta, 0.8125rem); color: var(--muted); }
.sp-crumbs li + li::before { content: '>'; margin-right: 4px; color: var(--muted); }
.sp-from { margin: 4px 0 0; }
table.sp-table td.nowrap, table.sp-table th { white-space: nowrap; }
table.sp-table td.desc { min-width: 180px; }

/* 0.7.1: the pay run fits at 1366 without sideways scroll */
table.run.grouped { font-size: 0.8125rem; }
table.run.grouped th, table.run.grouped td { padding: 7px 6px; }
table.run.grouped th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.run.grouped td.num { white-space: nowrap; }
table.run.grouped td.lead { min-width: 0; width: 132px; }
table.run.grouped .hrs { min-width: 0; width: 118px; display: grid; gap: 3px; justify-items: start; }
.hrs-n { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.hbar { display: block; width: 100%; max-width: 110px; height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--acc, var(--primary)); }
.pay-reason { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r); background: var(--info-soft); }
p.formula { margin: -4px 0 0; }
@media (max-width: 640px) {
  table.run.grouped td.lead { width: auto; }
  table.run.grouped .hrs { width: auto; justify-items: end; }
  table.run.grouped td { overflow-wrap: anywhere; }
}
.sp-body > .pay-reason { margin: 12px 20px; }
@media (max-width: 640px) { .sp-body > .pay-reason { margin: 12px 16px; } }
.sp-same { margin: 12px 20px 0; color: var(--ink-2); }

/* 0.7.1: "Planned" sits under the icon, in the flow */
.app.planned .tag, .app.planned .app-link .tag { position: static; justify-self: center; align-self: center; margin: 0; }
@media (max-width: 640px) { table.stack-sm tr.grand td { border-top: 0; } table.stack-sm tr.grand { border-top: 3px double var(--ink-2); } }
.sp-head > button { flex: none; min-width: 44px; min-height: 44px; }

/* 0.7.2: the budget grid fits at 1366 with Year and Last year; a phone shows one month at a time */
table.bgrid { font-size: 0.8125rem; }
table.bgrid th, table.bgrid td { padding: 5px 3px; }
table.bgrid input.cell { width: 68px; padding: 3px 4px; min-height: 32px; font-size: 0.8125rem; }
table.bgrid th:first-child, table.bgrid td:first-child { min-width: 170px; max-width: 220px; white-space: normal; }
table.bgrid td.lbl { white-space: normal; }
.show-sm { display: none; }
@media (max-width: 640px) {
  .show-sm { display: grid; }
  label.f.mpick { max-width: 200px; margin-bottom: 8px; }
  table.bgrid[data-m="0"] .mc:not(.m0) { display: none; }
  table.bgrid[data-m="1"] .mc:not(.m1) { display: none; }
  table.bgrid[data-m="2"] .mc:not(.m2) { display: none; }
  table.bgrid[data-m="3"] .mc:not(.m3) { display: none; }
  table.bgrid[data-m="4"] .mc:not(.m4) { display: none; }
  table.bgrid[data-m="5"] .mc:not(.m5) { display: none; }
  table.bgrid[data-m="6"] .mc:not(.m6) { display: none; }
  table.bgrid[data-m="7"] .mc:not(.m7) { display: none; }
  table.bgrid[data-m="8"] .mc:not(.m8) { display: none; }
  table.bgrid[data-m="9"] .mc:not(.m9) { display: none; }
  table.bgrid[data-m="10"] .mc:not(.m10) { display: none; }
  table.bgrid[data-m="11"] .mc:not(.m11) { display: none; }
  table.bgrid th:first-child, table.bgrid td:first-child { width: auto; max-width: none; }
  table.bgrid input.cell { width: 96px; min-height: 44px; }
}
.sec-hint { display: block; margin-top: 4px; }
.panel.flush .stack > div > h3.small { padding: 4px 20px 0; margin: 0; }
label.f.show-sm { display: none; }
@media (max-width: 640px) { label.f.show-sm { display: grid; } }
/* A phone: one month, the year and the account; last year and row phasing stay on larger screens */
@media (max-width: 640px) { table.bgrid .ly, table.bgrid button.phase { display: none; } table.bgrid tr > td:last-child:empty, table.bgrid tr > th:last-child:empty { display: none; } table.bgrid input.cell { width: 104px; } }
/* 0.7.3: "Planned" sits under the label without moving it, so the Personal label lines up with the others */
@media (min-width: 641px) {
  .app.planned .app-link { padding: 38px 8px 36px; }
  .app.planned .app-link .tag, .app.planned .tag { position: absolute; top: auto; right: auto; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; white-space: nowrap; }
}

/* fix-x: final settlement statement (printable) */
.sig-block { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 32px; }
.sig-block .sigline { border-bottom: 1px solid var(--line-strong); height: 40px; margin: 0; }
@media (max-width: 640px) { .sig-block { grid-template-columns: 1fr; } }
@media print {
  .settlement .pagehead .actions, .settlement .crumbs { display: none; }
  .settlement .panel { break-inside: avoid; }
}
/* fix-y: billing schedule rows, aged balances, subconsultant payables, intercompany targets on a line */
.sched-list { display: grid; gap: 12px; }
.sched-row { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 10px; background: var(--surface); }
.sched-row [hidden] { display: none; }
.sched-rm { display: flex; align-items: end; justify-content: flex-end; }
.ic-target { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: end; width: 100%; }
.ic-target > p { flex-basis: 100%; margin: 0; }
table.lines td.l-extra .ic-target label.f { min-width: 220px; }
@media (max-width: 640px) { table.lines td.l-extra .ic-target label.f { min-width: 0; width: 100%; } }
@media (min-width: 641px) { table.aged td.lead { white-space: nowrap; } }
table.aged td.lead { overflow-wrap: anywhere; }
table.aged tr.sub-row td:first-child { padding-left: 40px; }
.payable + .payable { border-top: 1px solid var(--line); padding-top: 16px; }
.payable .kpis { margin: 0; }
/* fix-z: people lifecycle screens */
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; max-height: 280px; overflow: auto; padding: 4px 0; }
.pick-list label.check { min-height: 44px; }
fieldset.people-pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; margin: 0; min-width: 0; }
fieldset.people-pick legend { padding: 0 6px; font-weight: 500; }
.aud details { border-top: 1px solid var(--line); padding: 6px 0; }
.aud summary { cursor: pointer; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.rv-sec h3 { font-size: 0.9375rem; margin: 8px 0 4px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
td .late { color: var(--bad); font-weight: 500; }
form.form h3 { font-size: 0.9375rem; margin: 10px 0 0; }
/* 0.8.1: the tax invoice, tax credit note and payment application (U4): the proposal's paper */
article.taxdoc { display: grid; gap: 22px; }
article.taxdoc header.lh { padding-bottom: 16px; }
.doc-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.doc-title h1 { font-size: 1.75rem; font-weight: 600; margin: 0; letter-spacing: 0.01em; }
.doc-parties { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.doc-parties .kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 600; color: var(--p-accent); margin: 0 0 6px; }
dl.doc-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.doc-meta > div { display: contents; }
dl.doc-meta dt { color: var(--p-muted); font-size: 0.8125rem; }
dl.doc-meta dd { margin: 0; font-weight: 500; }
.tax-scroll { overflow-x: auto; max-width: 100%; }
table.tax-lines th.num, table.tax-lines td.num { white-space: nowrap; }
article.taxdoc table.prop-fees tfoot td { font-size: 1rem; padding-top: 8px; border-top: 1px solid var(--p-line); font-weight: 500; }
article.taxdoc table.prop-fees tfoot tr:first-child td { border-top: 2px solid var(--p-rule); }
article.taxdoc table.prop-fees tfoot tr.grand td { font-size: 1.125rem; border-top: 2px solid var(--p-rule); }
.doc-figs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
article.taxdoc .doc-figs h2 { border-bottom: 0; padding: 0; margin: 0 0 4px; }
@media (max-width: 640px) {
  .doc-parties, .doc-figs { grid-template-columns: 1fr; gap: 18px; }
  .doc-title h1 { font-size: 1.375rem; }
  table.tax-lines th:nth-child(2), table.tax-lines td:nth-child(2) { display: table-cell; }
  table.inv-lines th:nth-child(3), table.inv-lines td:nth-child(3) { display: none; }
  table.tax-lines td, table.tax-lines th { padding-left: 6px; padding-right: 6px; font-size: 0.8125rem; }
}
@media print { article.taxdoc { gap: 14px; font-size: 10pt; } .tax-scroll { overflow: visible; } }
/* 0.8.1: a variation's value adds up from its stage lines (U9); the billing editor's two forms */
div.f { display: grid; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
.var-value { margin: 4px 0 0; font-size: 1.125rem; color: var(--ink); }
.billing-editor > form + form { border-top: 1px solid var(--line); padding-top: 16px; }
article.taxdoc p.doc-total { margin: 0; }
@media (max-width: 640px) { table.inv-lines th:nth-child(5), table.inv-lines td:nth-child(5) { display: none; } article.taxdoc p.doc-total b { font-size: 1.125rem; } }
@media (max-width: 640px) {
  /* the proposal hides its programme column on phones; the tax documents keep every figure */
  article.taxdoc table.prop-fees th:nth-child(2), article.taxdoc table.prop-fees td:nth-child(2) { display: table-cell; }
  table.app-lines th:nth-child(3), table.app-lines td:nth-child(3) { display: none; }
  table.app-lines td, table.app-lines th { padding-left: 4px; padding-right: 4px; font-size: 0.75rem; }
  table.app-lines th, table.app-lines th.num { white-space: normal; letter-spacing: 0; }
}
@media (max-width: 640px) { table.app-lines.has-cert th:nth-child(4), table.app-lines.has-cert td:nth-child(4) { display: none; } }
/* 0.8.1 (U15): a read-only fact inside a form row */
div.f.readonly { display: grid; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); min-width: 0; align-content: start; }
div.f.readonly .ro { margin: 0; font-size: 0.9375rem; font-weight: 400; color: var(--ink); min-height: 24px; }

/* 0.8.2: figure links (they open the records behind a figure) are a full tap target on a phone. */
@media (max-width: 640px) {
  a.fig, .kpi a, .kpis a { display: inline-flex; align-items: center; justify-content: flex-end; min-height: 44px; min-width: 44px; margin: 0; padding: 0 2px; }
  .kpi a, .kpis a { justify-content: flex-start; }
}
/* 0.8.2: an amount that is not a figure says so beside the field. */
.field-error.amount { display: block; }
p.bridge { margin-top: -4px; }
