/* Next Gen PayOn client portal. Same "Field Record" tokens, fonts and light/dark themes as the website (site.css). */

@font-face { font-family: "General Sans"; src: url("../fonts/general-sans-400.82dccf33188f.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("../fonts/general-sans-500.5b10ff4d624f.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("../fonts/general-sans-600.f74baa005bd5.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin.b636a65da4f0.woff2") format("woff2"); font-weight: 400 500; 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: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-ext.bd4781a31b42.woff2") format("woff2"); font-weight: 400 500; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --bg: #F2F4F3; --surface: #FFFFFF; --surface-2: #E8ECEA; --ink: #0F1E1C; --muted: #55655F;
  --line: #D8DEDB; --line-strong: #C3CCC8;
  --accent: #0B6B57; --accent-hover: #095A49; --accent-ink: #FFFFFF; --accent-soft: #E3EFEB; --accent-text: #0B6B57;
  --pending: #B7791F; --pending-text: #8A5A12; --pending-soft: #FBF1DF;
  --danger: #B42318; --danger-soft: #FDECEA;
  --shadow: 0 1px 2px rgb(15 30 28 / .06), 0 8px 24px -8px rgb(15 30 28 / .14);
  --shadow-lg: 0 2px 4px rgb(15 30 28 / .05), 0 24px 48px -16px rgb(15 30 28 / .22);
  --font-sans: "General Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-panel: 14px; --r-control: 10px; --r-pill: 999px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --gutter: 16px; --topbar-h: 60px; --side-w: 236px;
}
@media (min-width: 768px) { :root { --gutter: 28px; --topbar-h: 64px; } }
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0C1513; --surface: #13201D; --surface-2: #1A2925; --ink: #E9EFED; --muted: #93A39E;
    --line: #22312D; --line-strong: #2F433E;
    --accent: #3FBF9A; --accent-hover: #5CCDAB; --accent-ink: #0C1513; --accent-soft: #173A31; --accent-text: #5CCDAB;
    --pending: #D9A04A; --pending-text: #E3B266; --pending-soft: #2B2414;
    --danger: #F97066; --danger-soft: #3A1714;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -8px rgb(0 0 0 / .5);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 24px 48px -16px rgb(0 0 0 / .6);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100dvh; background: var(--bg); color: var(--ink); font: 400 .9375rem/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; caret-color: var(--accent); }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-control); }
.skip-link:focus { top: 12px; }
[x-cloak], [hidden] { display: none !important; }
.stack > * + * { margin-top: var(--stack, 16px); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; gap: 16px; }
.grid-3 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.span-all { grid-column: 1 / -1; }

/* ---------- Brand + top bar ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { display: block; height: 22px; aspect-ratio: 640 / 118; background: currentColor;
  -webkit-mask: url("../img/logo-mark.a97c6b016fd9.png") center / contain no-repeat; mask: url("../img/logo-mark.a97c6b016fd9.png") center / contain no-repeat; }
.brand-name { font-weight: 600; font-size: .9375rem; letter-spacing: -0.01em; white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--line-strong); line-height: 1.2; }
@media (max-width: 420px) { .brand-name { display: none; } }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-row { height: 100%; display: flex; align-items: center; gap: 16px; padding-inline: var(--gutter); }
.topbar-org { display: none; align-items: center; gap: 8px; padding-left: 16px; border-left: 1px solid var(--line); font-weight: 500; min-width: 0; }
.topbar-org span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }
@media (min-width: 640px) { .topbar-org { display: inline-flex; } }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-link { display: none; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--r-control); color: var(--muted); text-decoration: none; font-weight: 500; font-size: .875rem; }
.topbar-link:hover { color: var(--ink); background: var(--surface-2); }
@media (min-width: 900px) { .topbar-link { display: inline-flex; } }

/* menus (user, org switcher) */
.menu { position: relative; }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); cursor: pointer; }
.menu-btn .icon { width: 16px; height: 16px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: .75rem; }
.menu-name { font-weight: 500; font-size: .875rem; max-width: 16ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .menu-name { display: none; } }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  transform-origin: top right; transition: opacity 160ms ease, transform 180ms var(--ease-out); }
.menu-panel[data-open="false"] { opacity: 0; transform: scale(.97) translateY(-4px); pointer-events: none; visibility: hidden; }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head strong { display: block; font-size: .875rem; }
.menu-head small { display: block; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .875rem; cursor: pointer; text-align: left; }
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Shell: side navigation + main ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100dvh - var(--topbar-h)); }
.main { padding: 24px var(--gutter) 64px; min-width: 0; max-width: 1280px; width: 100%; }
.main-narrow { max-width: 820px; }
.sidenav { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: var(--topbar-h); z-index: 30; }
.sidenav-title { display: none; }
.sidenav ul { list-style: none; padding: 8px var(--gutter); display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sidenav ul::-webkit-scrollbar { display: none; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-control); text-decoration: none; color: var(--muted); font-weight: 500; font-size: .875rem; white-space: nowrap; }
.sidenav a .icon { width: 18px; height: 18px; }
.sidenav a:hover { color: var(--ink); background: var(--surface-2); }
.sidenav a[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
.sidenav .badge { margin-left: auto; }
@media (min-width: 1024px) {
  .shell.has-side { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .sidenav { border-bottom: 0; border-right: 1px solid var(--line); height: calc(100dvh - var(--topbar-h)); overflow-y: auto; }
  .sidenav-title { display: block; padding: 22px 24px 6px; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .sidenav ul { flex-direction: column; padding: 4px 12px 24px; overflow: visible; }
  .main { padding: 32px 40px 80px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .8125rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.h2 { font-size: 1.25rem; }
.h3 { font-size: 1.0625rem; letter-spacing: -0.01em; }
.section-title { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel-pad { padding: 20px; }
@media (min-width: 768px) { .panel-pad { padding: 24px; } }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 1rem; }
.panel-body { padding: 20px; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); border-radius: 0 0 var(--r-panel) var(--r-panel); }
.tile-icon { width: 44px; height: 44px; flex: none; border-radius: var(--r-control); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.tile-icon .icon { width: 22px; height: 22px; }
.tile-icon.sm { width: 36px; height: 36px; } .tile-icon.sm .icon { width: 18px; height: 18px; }

/* key-value lists (settings view, details) */
.kv { display: grid; border-top: 1px solid var(--line); }
.kv > div { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border-radius: var(--r-control);
  font-weight: 500; font-size: .875rem; line-height: 1.2; white-space: nowrap; text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.98); }
.btn .icon { width: 18px; height: 18px; }
.btn-lg { min-height: 50px; padding: 13px 22px; font-size: 1rem; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .8125rem; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-loading .label { opacity: .6; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--ink); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 18px; }
@media (min-width: 720px) { .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid .span-all { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .field > .label, .field legend { font-weight: 500; font-size: .875rem; }
.field .req { color: var(--muted); font-weight: 400; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-control);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease; font-size: 1rem; }
@media (min-width: 900px) { .input, .select, .textarea { font-size: .9375rem; } }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); background: var(--surface); }
.input[disabled], .select[disabled], .textarea[disabled] { opacity: .6; cursor: not-allowed; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-control) 0 0 var(--r-control); background: var(--surface-2); color: var(--muted); font-family: var(--font-mono); font-size: .875rem; }
.input-group .input { border-radius: 0 var(--r-control) var(--r-control) 0; }
.input-group .input.has-after { border-radius: var(--r-control) 0 0 var(--r-control); }
.input-group .after { border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--r-control) var(--r-control) 0; background: var(--surface); padding: 0 12px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.input-group .after .icon { width: 18px; height: 18px; }
.help { font-size: .8125rem; color: var(--muted); }
.errorlist, .field-error { list-style: none; padding: 0; font-size: .8125rem; color: var(--danger); display: flex; gap: 6px; align-items: center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
fieldset { border: 0; padding: 0; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9375rem; }
.check input, .checks input[type="checkbox"], .switch input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border-radius: 5px; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; transition: background-color 150ms ease, border-color 150ms ease; cursor: pointer; }
.check input::after, .checks input[type="checkbox"]::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(.6); opacity: 0; transition: transform 160ms var(--ease-out), opacity 120ms ease; }
.check input:checked, .checks input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after, .checks input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); opacity: 1; }
.checks ul, ul.checks { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--bg); cursor: pointer; font-size: .875rem; }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* switch (boolean settings) */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--line-strong); position: relative; display: block; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform 200ms var(--ease-out); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }

/* ---------- Status pills, badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill .icon { width: 14px; height: 14px; }
.pill.ok { background: var(--accent-soft); color: var(--accent-text); }
.pill.warn { background: var(--pending-soft); color: var(--pending-text); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.soon { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .6875rem; font-weight: 600; }

/* ---------- Alerts, messages ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--line); }
.alert > .icon { width: 20px; height: 20px; margin-top: 1px; }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert.info > .icon { color: var(--accent-text); }
.alert.warn { background: var(--pending-soft); border-color: color-mix(in srgb, var(--pending) 45%, transparent); }
.alert.warn > .icon { color: var(--pending-text); }
.alert.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.error > .icon { color: var(--danger); }
.alert strong { display: block; }
.alert ul { margin-top: 4px; padding-left: 18px; }
.messages { display: grid; gap: 10px; margin-bottom: 20px; }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-weight: 500; font-size: .75rem; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.table .who strong { display: block; font-weight: 500; }
.table .who small { display: block; color: var(--muted); font-size: .75rem; }
.table .is-missing strong { color: var(--muted); font-weight: 400; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.row-muted td { color: var(--muted); }
@media (max-width: 760px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-family: var(--font-sans); font-size: .75rem; text-align: left; }
  .table.stack td.who, .table.stack td.full { display: block; text-align: left; }
  .table.stack td.who::before, .table.stack td.full::before { content: none; }
  .table.stack tfoot { display: block; }
  .table.stack tfoot tr { display: block; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: .875rem; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }

/* filters bar */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 160px; flex: 1 1 160px; }
.filters .search { flex: 2 1 240px; }

/* ---------- Stats (ledger) ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 4px; min-width: 0; }
.stat dt, .stat .label { font-size: .75rem; color: var(--muted); }
.stat dd, .stat .value { margin: 0; font-family: var(--font-mono); font-size: 1.25rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.key .value, .stat.key dd { color: var(--accent-text); }

/* ---------- Checklist + progress ---------- */
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 8px; transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 700ms var(--ease-out); }
.checklist-group + .checklist-group { margin-top: 22px; }
.checklist { list-style: none; padding: 0; display: grid; gap: 8px; }
.check-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.check-item .state { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: var(--accent-ink); }
.check-item .state .icon { width: 14px; height: 14px; }
.check-item.done .state { background: var(--accent); border-color: var(--accent); }
.check-item.done strong { color: var(--muted); }
.check-item strong { display: block; font-weight: 500; }
.check-item small { display: block; color: var(--muted); font-size: .8125rem; }
@media (max-width: 560px) { .check-item { grid-template-columns: 28px 1fr; } .check-item .btn { grid-column: 2; justify-self: start; } }

/* ---------- Services hub ---------- */
.hub { display: grid; gap: 16px; }
@media (min-width: 960px) { .hub { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.service { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); text-decoration: none; color: var(--ink); overflow: hidden;
  transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 200ms ease; }
a.service:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.service-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.service h2 { font-size: 1.25rem; }
.service p { color: var(--muted); }
.service-art { height: 132px; border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); border: 1px solid var(--line); position: relative; overflow: hidden; }
.service-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 500; color: var(--accent-text); }
.service.is-soon { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.service.is-soon .service-art, .service.is-soon .tile-icon, .service.is-soon h2, .service.is-soon p { filter: grayscale(1); opacity: .6; }
/* illustrations */
.art-pay { padding: 14px; display: grid; gap: 7px; }
.art-pay .r { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: .75rem; }
.art-pay .r b { font-family: var(--font-mono); font-weight: 500; }
.art-pay .tick { color: var(--accent); width: 14px; height: 14px; }
.art-stamp { position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; border: 2px solid var(--accent); border-radius: 8px; color: var(--accent-text); font-size: .625rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; transform: rotate(-7deg); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.art-kyc { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 16px; align-items: center; }
.art-kyc .doc { height: 84px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.art-kyc .scan { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); top: 10%; }
.art-kyc .lines span { display: block; height: 8px; border-radius: 4px; background: var(--line); margin: 8px 0; }
.art-tele { display: flex; align-items: center; justify-content: center; gap: 4px; height: 100%; }
.art-tele span { width: 5px; border-radius: 3px; background: var(--accent); height: 20%; }
@media (prefers-reduced-motion: no-preference) {
  .art-pay .r { animation: art-in 3.6s var(--ease-out) infinite; }
  .art-pay .r:nth-child(2) { animation-delay: .15s; } .art-pay .r:nth-child(3) { animation-delay: .3s; }
  .art-stamp { animation: art-stamp 3.6s var(--ease-out) infinite; }
  .art-kyc .scan { animation: art-scan 2.8s var(--ease-in-out) infinite alternate; }
  .art-tele span { animation: art-wave 1.2s ease-in-out infinite alternate; }
  .art-tele span:nth-child(2n) { animation-delay: .2s; } .art-tele span:nth-child(3n) { animation-delay: .4s; } .art-tele span:nth-child(5n) { animation-delay: .6s; }
}
@keyframes art-in { 0% { opacity: 0; transform: translateY(6px); } 12%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes art-stamp { 0%, 40% { opacity: 0; transform: rotate(-7deg) scale(1.4); } 50%, 88% { opacity: 1; transform: rotate(-7deg) scale(1); } 100% { opacity: 0; transform: rotate(-7deg) scale(1); } }
@keyframes art-scan { to { top: 88%; } }
@keyframes art-wave { to { height: 80%; } }

/* ---------- Stamp (same family as the website mockups) ---------- */
.stamp { display: inline-grid; justify-items: center; padding: 6px 14px 5px; border: 2px solid var(--accent); border-radius: 10px; color: var(--accent-text);
  background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600; font-size: .8125rem; line-height: 1.2; white-space: nowrap; transform: rotate(-5deg); }
.stamp small { font-size: .5625rem; letter-spacing: .14em; font-weight: 500; opacity: .85; }
@media (prefers-reduced-motion: no-preference) { .stamp.lands { animation: stamp-in 340ms cubic-bezier(.16, 1, .3, 1) both; } }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-5deg) scale(1.4); } }

/* ---------- Steps (run workflow) ---------- */
.steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8125rem; font-weight: 500; }
.steps li { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.steps li .dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.steps li.done { color: var(--ink); } .steps li.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.current { color: var(--ink); } .steps li.current .dot { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.steps .dot .icon { width: 12px; height: 12px; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 20px; display: grid; justify-items: center; gap: 10px; }
.empty .tile-icon { width: 52px; height: 52px; }
.empty p { color: var(--muted); max-width: 46ch; }

/* ---------- Dialog ---------- */
dialog.modal { margin: auto; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgb(12 21 19 / .5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }

/* ---------- Auth pages (login, reset, invite) ---------- */
.auth { min-height: 100dvh; display: grid; }
@media (min-width: 1000px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.auth-side { display: none; position: relative; overflow: hidden; background: var(--accent); color: var(--accent-ink); padding: 48px; }
@media (min-width: 1000px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-side::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(color-mix(in srgb, var(--accent-ink) 9%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--accent-ink) 9%, transparent) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: linear-gradient(160deg, transparent 20%, #000); mask-image: linear-gradient(160deg, transparent 20%, #000); }
.auth-side > * { position: relative; }
.auth-side .brand { color: var(--accent-ink); }
.auth-side .brand-name { border-left-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.auth-side h2 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); line-height: 1.08; letter-spacing: -0.03em; max-width: 16ch; }
.auth-side p { margin-top: 14px; max-width: 44ch; color: color-mix(in srgb, var(--accent-ink) 84%, var(--accent)); }
.auth-points { list-style: none; padding: 0; display: grid; gap: 10px; margin-top: 28px; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .icon { width: 18px; height: 18px; }
.auth-main { display: flex; flex-direction: column; padding: 20px var(--gutter) 40px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (min-width: 1000px) { .auth-top .brand { visibility: hidden; } }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding-block: 40px; }
.auth-card h1 { font-size: clamp(1.625rem, 1.3rem + 1vw, 2rem); }
.auth-card .lead { color: var(--muted); margin-top: 8px; }
.auth-card form { margin-top: 26px; display: grid; gap: 16px; }
.auth-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.code-input { font-family: var(--font-mono); font-size: 1.5rem !important; letter-spacing: .4em; text-align: center; }
.qr { width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.secret { font-family: var(--font-mono); font-size: .875rem; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; overflow-wrap: anywhere; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: var(--font-mono); }
.codes li { list-style: none; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; text-align: center; }

/* ---------- Audit / timeline ---------- */
.timeline { list-style: none; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.timeline time { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }
.changes { margin-top: 6px; display: grid; gap: 2px; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.changes del { color: var(--danger); text-decoration: line-through; }
.changes ins { color: var(--accent-text); text-decoration: none; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Payroll run table ---------- */
.run-table td.num, .run-table th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.run-table .net { font-weight: 600; }
.run-table tr.is-skipped td { opacity: .55; }
.edited { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--pending); margin-left: 6px; vertical-align: middle; }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; padding: 14px var(--gutter); margin: 24px calc(-1 * var(--gutter)) -64px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }

/* ---------- Footer ---------- */
.app-foot { padding: 24px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.app-foot a { color: var(--muted); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fade-up 420ms var(--ease-out) both; }
  .htmx-added { animation: fade-up 300ms var(--ease-out) both; }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.htmx-request .spinner, .htmx-request.spinner { display: inline-block; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }

/* ---------- Print (payslip preview, register) ---------- */
@media print { .topbar, .sidenav, .app-foot, .no-print { display: none !important; } body { background: #fff; } }
.error-title { margin-top: 32px; }
.setup-steps { padding-left: 20px; }
.setup-steps > li + li { margin-top: 22px; }
.setup-qr { margin: 14px 0; }
.setup-form { margin-top: 12px; max-width: 320px; }
.invites-title { margin-top: 20px; }
.notify-panel, .audit-panel { margin-top: 16px; }
.review-form { display: grid; gap: 8px; min-width: 240px; }
.pager { margin-top: 16px; }
.grid-setup { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .grid-setup { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.group-title { margin-top: 18px; }
.status-line { margin: 8px 0 12px; }
.recent-runs { margin-top: 16px; }
.logo-row { margin-bottom: 18px; }
.org-logo { max-height: 48px; max-width: 180px; border-radius: 6px; background: #fff; padding: 4px; border: 1px solid var(--line); }
.structure-panel { margin-top: 16px; }
.components .input, .components .select { min-width: 110px; }
.doc-list { padding: 16px; }
.upload-form { margin-top: 12px; }
.help-panel .btn { justify-content: flex-start; }
.settings-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.setting-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); transition: border-color 160ms ease, transform 200ms var(--ease-out); }
.setting-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.setting-card strong { display: block; font-weight: 600; }
.setting-card small { display: block; color: var(--muted); font-size: .8125rem; }
.setting-card > .icon { color: var(--muted); }
.setting-card.is-soon { opacity: .7; }
.settings-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1200px) { .settings-layout { grid-template-columns: 220px minmax(0, 1fr); } }
.settings-nav ul { list-style: none; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.settings-nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .8125rem; font-weight: 500; white-space: nowrap; }
.settings-nav a:hover { color: var(--ink); background: var(--surface-2); }
.settings-nav a[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
@media (min-width: 1200px) { .settings-nav ul { flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 24px); } .settings-nav a { white-space: normal; } }
.help.block { display: block; font-weight: 400; margin-top: 2px; }
.format-list { margin-top: 10px; padding-left: 22px; display: grid; gap: 2px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .field { flex: 1 1 160px; }
.person-form { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1200px) { .person-form { grid-template-columns: minmax(0, 1fr) 340px; } .preview-panel { position: sticky; top: calc(var(--topbar-h) + 24px); } }
.preview-kv > div { grid-template-columns: 1fr auto; padding: 8px 0; }
.preview-kv .total dt, .preview-kv .total dd { font-weight: 600; color: var(--ink); }
.preview-kv .key dd { color: var(--accent-text); }
.missing-hint { display: flex !important; align-items: center; gap: 4px; color: var(--pending-text) !important; }
.missing-hint .icon { width: 14px; height: 14px; }
.person-grid { margin-top: 16px; }
.import-results { margin-top: 16px; }
.row-error td { background: color-mix(in srgb, var(--danger-soft) 60%, transparent); }
.row-errors { list-style: none; padding: 0; display: grid; gap: 2px; color: var(--danger); font-size: .8125rem; }
.row-errors li { display: flex; gap: 6px; align-items: flex-start; }
.row-errors .icon { width: 14px; height: 14px; margin-top: 3px; }
.month-pick .input { width: auto; }
.run-steps { margin-top: 12px; }
.blockers { margin-bottom: 16px; }
.run-stats { margin: 0 0 16px; }
.run-stats dd small { font-family: var(--font-sans); }
.row-actions { white-space: nowrap; }
.row-actions > * { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.run-after { margin-top: 16px; }
.file-list { list-style: none; padding: 8px; display: grid; gap: 2px; }
.file-list a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; }
.file-list a:hover { background: var(--surface-2); }
.file-list .icon { color: var(--accent-text); }
.notes-title { margin-top: 18px; }
.page-head .stamp { align-self: center; }
.tab-head { margin-bottom: 12px; }
.schedule-panel { margin-top: 16px; }
.input-sm { min-height: 34px; padding: 6px 10px; font-size: .8125rem; max-width: 160px; }
.no-workflow { margin-bottom: 16px; }
.workflow-chips { margin-bottom: 14px; }
.workflow-chips a { text-decoration: none; }
.delete-wf { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
/* single-column layouts on smaller screens: never let wide content stretch the column past the viewport */
@media (max-width: 1199px) { .settings-layout, .person-form { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1099px) { .grid-setup { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 959px) { .hub { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) { .grid-2, .grid-3, .settings-grid { grid-template-columns: minmax(0, 1fr); } }
