/* =====================================================================
   Website look — the system uses the marketing site's visual language:
   white header and navigation with the Cirro logo, square flat surfaces,
   hairline borders, light-blue uppercase primary buttons, plain tables.
   Loaded last so it wins over app.css and polish.css.
   ===================================================================== */
:root {
  --radius: 0px;
  --radius-sm: 0px;
  --line: #E1EAF1;
  --line-soft: #EDF2F6;
  --ink: #333333;
  --shadow: none;
  --field-line: #CFDAE4;
}
body { color: var(--ink); }

/* ---------- Navigation: white, like the site header ---------- */
.sidebar { background: var(--surface); color: var(--head); border-right: 1px solid var(--line); }
.brand { padding: 20px 22px 16px; }
.brand-logo { display: block; width: auto; max-width: 100%; }
.brand-logo.brand-dark { display: none; }
html[data-theme="dark"] .brand-logo.brand-light { display: none; }
html[data-theme="dark"] .brand-logo.brand-dark { display: block; }
.nav { scrollbar-color: var(--line) transparent; }
.nav-label { color: var(--faint); font-size: 10.5px; letter-spacing: .12em; }
.nav a { border-radius: 0; color: var(--head); font-weight: 600; font-size: 13.5px; }
.nav a .ms { color: var(--faint-2); }
.nav a:hover { background: var(--canvas); color: var(--head); }
/* hovering a menu item zooms its icon and title a little (not the row), then settles back */
.nav a > .ms:first-child, .nav a > span:not(.ms):not(.badge-count), .nav-toggle > .ms:first-child, .nav-toggle > span:not(.ms):not(.badge-count) { display: inline-block; transform-origin: left center; transition: transform .16s ease, color .16s ease; }
.nav a:hover > .ms:first-child, .nav-toggle:hover > .ms:first-child { transform: scale(1.14); color: var(--link); }
.nav a:hover > span:not(.ms):not(.badge-count), .nav-toggle:hover > span:not(.ms):not(.badge-count) { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .nav a > .ms:first-child, .nav a > span, .nav-toggle > .ms:first-child, .nav-toggle > span { transition: none; } .nav a:hover > *, .nav-toggle:hover > * { transform: none; } }
.nav a.active { background: var(--sky-bg); color: var(--head); }
.nav a.active .ms { color: var(--link); }
.nav a.active::before { left: -10px; top: 0; bottom: 0; border-radius: 0; background: var(--sky); }
.nav a .badge-count { border-radius: 0; }
.nav a .lock { color: var(--faint-3); }
.sidebar-foot { border-top: 1px solid var(--line); color: var(--slate); }
.sidebar-foot button { color: var(--slate); }
.sidebar-foot button:hover { color: var(--head); }
.side-profile-text strong { color: var(--head); }
.side-profile:hover .side-profile-text strong { opacity: .6; }
.sidebar-foot * { border-color: var(--line); }

.topbar { background: var(--surface); backdrop-filter: none; border-bottom: 1px solid var(--line); box-shadow: 1px 5px 15px 1px rgba(0, 0, 0, .04); min-height: 64px; }
.search input { border-radius: 0; background: var(--surface); border-color: var(--field-line); }
.search-results, .search-results a { border-radius: 0; }

/* ---------- Page header ---------- */
.content { padding-top: 28px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
.page-head .sub { color: var(--slate); font-size: 14px; }

/* ---------- Surfaces ---------- */
.card, .kpi, .modal, .notice, .search-results, .report-sheet { border-radius: 0; box-shadow: none; }
.card { border-color: var(--line); }
.card-head { padding: 16px 20px 0; }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 0; }
.modal { box-shadow: 0 20px 60px rgba(var(--shadow-rgb), .25); }
.modal-foot { border-radius: 0; background: var(--surface); }
.modal-head h2 { font-weight: 700; }
.notice { border-radius: 0; }

/* KPI tiles: flat; the highlighted tile uses the site's dark-blue feature card */
.kpi { border-color: var(--line); padding: 16px 18px; }
.kpi .label { color: var(--slate); font-weight: 600; }
.kpi .value { font-weight: 700; letter-spacing: -.01em; }
.kpi.dark { background: var(--blue); border-color: var(--blue); }
.kpi.dark .delta { color: #BDE9F5; }
/* A KPI's descriptive sub-line is dropped; coloured changes (up/down, overdue) stay */
.kpi .delta:has(> .muted:only-child) { display: none; }

/* ---------- Buttons ---------- */
/* Weights follow the iOS scale: regular (400) to read, semibold (600) for emphasis and headings, bold (700) only for the
   page title and big numbers. Buttons are semibold in normal case, not bold capitals. */
.btn { border-radius: 0; font-size: 13.5px; font-weight: 600; text-transform: none; letter-spacing: 0; padding-left: 16px; padding-right: 16px; }
.btn .ms { font-size: 17px; }
.btn-primary { background: var(--sky); color: #fff; border-color: var(--sky); }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-accent, .btn-accent:hover { color: #fff; }
.btn-secondary { background: var(--surface); color: var(--head); border-color: var(--field-line); }
.btn-secondary:hover { border-color: var(--navy); color: var(--head); background: var(--surface); }
.btn-danger { border-radius: 0; }
.btn-ghost { text-transform: none; letter-spacing: 0; font-size: 13px; }
.btn-sm { font-size: 12.5px; padding-left: 12px; padding-right: 12px; }
.btn-icon { padding-left: 0; padding-right: 0; }

/* ---------- Forms ---------- */
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), .field select, .field textarea, select.input, input.input,
.search-inline input, .tbl-tools select, .tbl-tools select.input, .sales-view textarea[name="notes"], textarea.le-desc {
  border-radius: 0; border-color: var(--field-line);
}
.lines-editor input, .lines-editor select, .tbl input:not([type=checkbox]), .tbl select { border-radius: 0; }
.le-in, .le-disc-toggle, .le-offer-btn, .le-menu, .le-menu-item { border-radius: 0; }
.field label, .label { font-weight: 600; color: var(--head); display: inline-flex; align-items: center; gap: 4px; }
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 2px; color: var(--faint-2); cursor: pointer; vertical-align: middle; transition: background .12s, color .12s; }
.help-tip:hover, .help-tip.open { color: #fff; background: var(--blue); }
.help-tip:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; color: var(--link); }
/* The router focuses the page content on each load for screen readers; it is not a control, so no focus ring (it showed as a blue line under the page). */
#view:focus, #view:focus-visible { outline: none; }
.help-tip .ms { font-size: 15px; }
.seg, .seg button { border-radius: 0; }
.seg button.active { box-shadow: none; }

/* ---------- Tables: plain, like the site's pricing table ---------- */
.tbl th { background: var(--surface); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--slate); padding-top: 12px; padding-bottom: 12px; }
.tbl td { border-bottom-color: var(--line-soft); }
/* Every table row highlights on hover (group headings excepted); only its link opens it */
.tbl tbody tr:not(.group-row):hover td, .table-wrap .tbl tbody tr:not(.group-row):hover td:first-child { background: var(--hover); }

/* ---------- Tabs, pills, statuses ---------- */
.tabs .count { border-radius: 0; }
.pill { border-radius: 0; padding: 3px 8px; font-weight: 600; }
.pill::before { display: none; }

/* ---------- Captions: explanatory helper paragraphs are left out ---------- */
.card-body > p.small.muted:not(:only-child):not([data-conv-note]):not([data-rule-test]),
.modal-body > p.small.muted:not(:only-child):not([data-conv-note]):not([data-rule-test]),
.sales-side .card-body p.small.muted:not(:only-child) { display: none; }

/* Sidebar footer and the highlighted KPI on white / dark-blue grounds */
.integrity { color: var(--head); }
.kpi.dark .delta .pos, .kpi.dark .delta .neg, .kpi.dark .delta { color: #fff; }
.kpi.dark .delta .muted { color: rgba(255,255,255,.8); }
.kpi.dark .pill { background: rgba(255,255,255,.22); color: #fff; } /* a status badge on the filled card: white on the card's colour, whatever its own colour is */
.kpi .delta .muted { display: none; }

/* Remaining rounded tiles follow the square look; buttons inside table rows stay compact (normal case) */
.attn-item, .attn-item .ms, .rp-box, .mv-explain, .le-ib { border-radius: 0; }
.tbl .btn { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

/* Square everywhere: no rounded corners on any element (cards, controls, badges, avatars, switches, dots) */
*, *::before, *::after { border-radius: 0 !important; }

/* Printed documents: uploaded logo in the header; settings logo preview */
.pdoc-logo-img { display: block; max-width: 220px; max-height: 72px; width: auto; height: auto; object-fit: contain; object-position: left top; margin-bottom: 6px; }
.org-logo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.org-logo-box { display: grid; place-items: center; width: 180px; height: 72px; padding: 10px; border: 1px dashed var(--field-line); background: var(--surface); overflow: hidden; }
.org-logo-box img { max-width: 158px; max-height: 50px; object-fit: contain; }
.org-logo-box span { font-weight: 800; font-size: 16px; color: var(--head); text-align: center; overflow-wrap: anywhere; }
.org-logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.org-logo-actions label.btn { cursor: pointer; }
.org-logo-actions label.btn.disabled { opacity: .5; pointer-events: none; }

/* On-screen invoice / quote: the printed document inside the paper card, fluid to its column */
.doc-screen { padding: 28px 30px; }
.doc-screen .pdoc { font-size: 13px; }
.doc-screen .pdoc-foot { position: static; margin-top: 24px; }
.doc-screen .sales-paper-pay { margin-top: 20px; }
@media (max-width: 640px) {
  .doc-screen { padding: 16px; }
  .doc-screen .pdoc-head { flex-direction: column; gap: 12px; }
  .doc-screen .pdoc-doc { text-align: left; }
  .doc-screen .pdoc-kv { margin-left: 0; }
  .doc-screen .pdoc-parties { grid-auto-flow: row; }
  .doc-screen .ptbl { display: block; overflow-x: auto; }
}

/* Printed / on-screen invoices: a larger logo; payment instructions below the VAT summary */
.pdoc-logo-img { max-width: 300px; max-height: 96px; }
.pdoc-after { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.pdoc-after .ptbl-compact { width: 60%; min-width: 280px; }

/* Payment instructions in a box, like the From / Bill to boxes */
.pdoc-pay { border: 1px solid var(--phair); padding: 9px 11px; font-size: 9pt; line-height: 1.5; break-inside: avoid; }

/* Payment instructions: a compact box sized to its content, bank details one per line */
.pdoc-after { justify-items: start; }
.pdoc-pay { width: fit-content; max-width: 100%; }
.pdoc-paykv { border-collapse: collapse; font-size: 8.5pt; margin-top: 2px; }
.pdoc-paykv th { text-align: left; font-weight: 500; color: var(--pmuted); padding: 1px 14px 1px 0; white-space: nowrap; vertical-align: top; }
.pdoc-paykv td { color: var(--pink); font-weight: 600; padding: 1px 0; }
.pdoc-pay .pdoc-note { margin-top: 6px; }

/* Customer contacts: edit / remove icons beside each person */

/* Table footer: rows-per-page picker beside the "Showing" count */
.pager-info { display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pager-size select.input, .pager-size .dd-btn { width: auto; min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }

/* Approval card: same rhythm as Summary / Actions — status, details, full-width buttons, then history */
.appr-panel .appr-actions { margin: 16px 0 0; }
.appr-panel .notice { margin-top: 12px; }
.appr-panel .appr-log { margin-top: 16px; padding-top: 14px; }
.appr-log-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-bottom: 10px; }

/* Table toolbar filters: sized to their text, never wider than the toolbar */
.tbl-tools select.tbl-filter { width: auto; max-width: 100%; min-height: 34px; padding: 6px 28px 6px 10px; }

/* Pay run table: the employee column keeps room for name, role and the payslip link */
.mv-run td:first-child, .mv-run th:first-child { min-width: 170px; }

/* Report library bar: search, category and favourites on one row, like a table toolbar */
.rp-libbar .dd-btn { width: auto; min-width: 180px; max-width: 260px; height: 36px; }

/* Organisation settings: entity name gets the widest field */
.form-grid.org-entity { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 640px) { .form-grid.org-entity { grid-template-columns: 1fr; } }

/* Phones: KPI cards two per row so the figures stay in view */
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 17px; overflow-wrap: anywhere; }
}

/* ---------- Cloud mode: sign-in, organisation set-up, save status ---------- */
body.auth-mode { background: var(--canvas); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line); padding: 32px 28px; display: grid; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--head); }
.auth-brand .brand-logo { height: 30px; width: auto; }
.lang-btn { gap: 6px; padding: 0 10px; min-width: 40px; }
.lang-btn .ms { font-size: 18px; }
.lang-btn .lang-code { font-size: 12.5px; font-weight: 600; letter-spacing: .03em; }
@media (max-width: 1100px) { .lang-btn > .ms { display: none; } } /* narrower screens: the code alone, so the search keeps its room */
.lang-pop { min-width: 180px; }
.lang-pop > .btn { gap: 10px; }
.lang-pop > .btn small { margin-left: auto; color: var(--slate); font-size: 12px; }
.lang-pop > .btn .ms, .lang-pop .lang-tick { width: 18px; flex: none; font-size: 18px; color: var(--link); }
.auth-brand .demo-tag { margin-left: auto; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); padding: 3px 8px; border: 1px solid var(--line); }
.auth-card h1 { margin: 0; font-size: 24px; color: var(--head); }
.auth-lead { margin: 0; color: var(--slate); font-size: 14px; line-height: 1.5; }
.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--head); }
.auth-field .input { width: 100%; height: 46px; font-size: 15px; }
/* the entry screens: full-size buttons and, on a phone, a card that uses the width */
.auth-card .btn { min-height: 46px; font-size: 15px; }
@media (max-width: 520px) { .auth-page { padding: 20px 12px; place-items: start center; } .auth-card { padding: 24px 18px; } .auth-card h1 { font-size: 21px; } }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .auth-row { grid-template-columns: 1fr; } }
.auth-sep { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); border-top: 1px solid var(--line); padding-top: 14px; }
.auth-choice { border: 1px solid var(--line); padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
.auth-choice legend { font-size: 13px; font-weight: 600; color: var(--head); padding: 0 4px; }
.auth-choice label { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.auth-choice small { grid-column: 2; color: var(--slate); font-size: 12px; }
.auth-choice[hidden], .auth-field[hidden] { display: none; }
.auth-choice .auth-choice-note { grid-column: 1 / -1; }
.auth-btn { width: 100%; justify-content: center; height: 42px; }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--slate); border-top: 1px solid var(--line); padding-top: 14px; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; }

.dt-tbl .linkish { font-weight: inherit; } /* in a table it reads like any other link in the column */
.auth-msg { font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); background: var(--canvas); color: var(--ink); }
.auth-msg.bad { border-color: #F2C4C4; background: #FDF3F3; color: #9B1C1C; }
.auth-msg.good { border-color: #BFE3CE; background: #F1FAF4; color: #1E6B3A; }
.auth-out:empty { display: none; }
.auth-spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--blue); animation: auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-list { display: grid; gap: 8px; }
.auth-org { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--head); text-align: left; }
.auth-org:hover { border-color: var(--blue); background: var(--sky-bg); }
.auth-org span { font-size: 12px; color: var(--slate); }
/* the demo's user switcher and reset button don't apply to real accounts */
body.cloud .top-select:has(#role-switch), body.cloud #reset-demo { display: none !important; }
/* Header status badge: Idle · Unsaved · Saving… · Not saved */
.app-status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap; border: 1px solid transparent; background: var(--green-bg); color: var(--green-text); }
.app-status::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }
.app-status.unsaved { background: var(--amber-bg); color: var(--amber-text); }
.app-status.saving { background: var(--sky-bg); color: var(--link); }
.app-status.saving::before { animation: status-pulse 1s ease-in-out infinite; }
.app-status.error { background: var(--danger-bg); color: var(--danger-strong); }
@keyframes status-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .app-status.saving::before { animation: none; } }
@media (max-width: 700px) { .app-status { padding: 0 7px; } }

/* Coming soon: features not built yet */
.tag-soon { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--sky-bg); color: var(--head); border: 1px solid var(--sky); padding: 1px 6px; vertical-align: middle; margin-left: 6px; white-space: nowrap; }
.btn.is-soon, .btn.is-soon:hover { opacity: 1; cursor: not-allowed; background: var(--surface); color: var(--slate); border-color: var(--line, #dfe5ec); box-shadow: none; }
.btn.is-soon .tag-soon { margin-left: 8px; }
.rp-plan .tag-soon { font-size: 10px; }

/* Header switchers: no visible "Entity" / "Viewing as" labels (kept for screen readers) */
.top-select label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.top-select { justify-content: center; }

/* Choose currencies */
.mv-cur-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 52vh; overflow-y: auto; }
.mv-cur-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; }
.mv-cur-opt:hover { border-color: var(--sky); }
.mv-cur-opt:has(input:checked) { border-color: var(--blue); background: var(--hover); }
.mv-cur-opt:has(input:disabled) { cursor: default; }
.mv-cur-opt input { margin-top: 2px; flex: none; }
.mv-cur-opt small { display: block; font-size: 11.5px; margin-top: 2px; }
.mv-cur-opt[hidden] { display: none; }


/* Approval rule page: levels with conditions and approvers */
.appr-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.appr-steps li { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--ink, #1c2b3a); }
.appr-steps li > span:nth-child(2) { color: var(--slate); }
.appr-arrow { color: var(--slate); }
.appr-lv-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; }
.appr-lv-num.sm { width: 20px; height: 20px; font-size: 11px; }
.appr-lv-head { display: flex; align-items: center; gap: 10px; }
.appr-lv-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--head); }
.appr-then { display: flex; align-items: center; gap: 6px; margin: -6px 0 -6px 22px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); }
.appr-sec { margin-top: 16px; }
.appr-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.appr-sec-head .label { margin: 0; }
.appr-always { margin: 0 0 8px; }
.appr-cond { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--hover); margin-bottom: 8px; }
.appr-cond-field { flex: none; width: 112px; font-size: 13px; color: var(--head); }
.appr-cond-body { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.appr-cond-body > .small { padding-top: 0; }
.appr-cond-del { flex: none; }
.appr-cond select, .appr-cond .dd-btn, .appr-add, .appr-sec .dd-btn { width: auto !important; min-width: 0; max-width: 260px; }
.appr-amt { display: inline-flex; align-items: center; gap: 6px; }
.appr-amt .input { width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
.appr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.appr-chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 12px; border: 1px solid var(--blue); background: var(--hover); color: var(--head); font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.appr-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; background: transparent; color: var(--slate); cursor: pointer; padding: 0; }
.appr-chip-x:hover { color: var(--danger-strong); }
.appr-seg { display: inline-flex; border: 1px solid var(--field-line, #CFDAE4); background: var(--surface); }
.appr-seg button { height: 36px; border: 0; background: var(--surface); padding: 0 16px; font: inherit; font-size: 14px; font-weight: 600; color: var(--slate); cursor: pointer; white-space: nowrap; }
.appr-seg button:not(.on):hover { background: var(--canvas, #F5F7F9); color: var(--head); }
.appr-seg button + button { border-left: 1px solid var(--field-line, #CFDAE4); }
.appr-seg button.on { background: var(--navy); color: #fff; }
.appr-addlv { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.appr-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; max-height: 50vh; overflow-y: auto; }
.appr-pick-opt { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--field-line, #CFDAE4); background: var(--surface); font-size: 14px; color: var(--head); cursor: pointer; transition: border-color .12s, background .12s; }
.appr-pick-opt:hover { border-color: var(--hover-line); }
.appr-pick-opt span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.appr-pick-opt small { font-size: 12px; color: var(--slate); font-weight: 400; }
.appr-pick-opt:has(input:checked) { border-color: var(--blue); background: var(--hover); }
/* Tick boxes in pickers, in the app's style: square, blue when ticked, white tick */
.appr-pick-opt input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--hover-line); background: var(--surface) center / 12px 12px no-repeat; cursor: pointer; transition: background-color .12s, border-color .12s; }
.appr-pick-opt input[type=checkbox]:checked { background-color: var(--blue); border-color: var(--blue); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='square'/%3E%3C/svg%3E"); }
.appr-pick-opt input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--blue); }
.appr-pick-group { grid-column: 1 / -1; margin: 8px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
.appr-pick-group:first-child { margin-top: 0; }
.appr-pick-group[hidden] { display: none; }
.appr-pick-opt[hidden] { display: none; }
@media (max-width: 700px) {
  .appr-cond { flex-wrap: wrap; }
  .appr-cond-field { width: auto; padding-top: 0; }
  .appr-cond-body { flex-basis: 100%; order: 3; }
  .appr-cond-del { margin-left: auto; }
  .appr-steps li { flex-wrap: wrap; }
}

/* "+ Add …" button in a condition, styled like the "+ Add condition" / "+ Add approver" dropdowns */
.appr-addbtn { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border: 1px solid var(--field-line, #CFDAE4); background: var(--surface); color: var(--slate); font: inherit; font-size: 14px; line-height: 1.2; cursor: pointer; white-space: nowrap; transition: border-color .12s, box-shadow .12s; }
.appr-addbtn:hover { border-color: var(--hover-line); }
.appr-addbtn:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--ring); }
.appr-cond-body .appr-chips { display: contents; }

/* "Remove level": same box as the "+ Add" buttons, red on hover */
.appr-rmbtn { gap: 6px; }
.appr-rmbtn .ms { font-size: 18px; }
.appr-rmbtn:hover { border-color: var(--danger-strong); color: var(--danger-strong); background: var(--danger-bg); }
.appr-rmbtn:focus-visible { border-color: var(--danger-strong); box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }

/* Rule card: description, off note, options (always visible) */
.appr-desc { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--slate); }
.appr-offnote { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; padding: 10px 12px; background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-text); font-size: 13.5px; line-height: 1.45; }
.appr-steps.is-off { opacity: .55; }
.appr-opts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft, #E8EDF2); }
.appr-opts .label { display: block; margin-bottom: 8px; }
.appr-opt-help { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--slate); }
/* Levels of a rule that is off: kept, shown, not editable */
.appr-lv.is-off { background: var(--surface-2); }
.appr-lv.is-off .card-body { opacity: .6; }
.appr-lv.is-off .appr-chip { border-color: var(--field-line, #CFDAE4); background: var(--surface); }
/* Why you can't act on an approval, and rule set-up problems */
/* A note inside a card or panel is the same notice as under a page title; it only keeps clear of what is above it. */
.notice.note { margin-top: 12px; }
.notice.note:first-child { margin-top: 0; }
/* An Actions card with nothing to press: a faint icon, like a table with no rows */
.act-empty { display: grid; justify-items: center; gap: 6px; padding: 20px 12px 8px; color: var(--slate); font-size: 13px; text-align: center; }
.act-empty .ms { font-size: 44px; color: var(--line); }

/* Alerts at the top of every page (moved there after the page draws) */
.page-alerts { display: grid; gap: 10px; margin: 0 0 16px; }
.page-alerts .notice { margin: 0; }
.page-alerts.flash .notice.warn, .page-alerts.flash .notice.bad { animation: alert-flash 1s ease 2; }
@keyframes alert-flash { 50% { box-shadow: 0 0 0 3px rgba(242, 198, 67, .6); } }
@media (prefers-reduced-motion: reduce) { .page-alerts.flash .notice { animation: none; } }
.app-status.warning { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-line); }
.auth-org.is-paused { opacity: .6; cursor: default; }
.auth-org.is-paused span { color: #8A6100; }
/* Person page: rules they can approve */

/* ---------- My account: sign-in security ---------- */
.sec-help { font-size: 13px; color: var(--slate); line-height: 1.5; }
.sec-rule { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }
#acc-mfa .auth-qr, .auth-qr { display: block; width: 180px; height: 180px; margin: 12px 0; border: 1px solid var(--line-soft); background: var(--surface); }
.auth-secret { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; word-break: break-all; background: var(--line-soft); padding: 2px 6px; }
.field[hidden] { display: none; }

/* Security: an input with its Save button on one line */
/* Security › Sign-in rules: one row per rule, the explanation on the left and its control on the right */
.sec-rules { display: flex; flex-direction: column; }
.sec-rule { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.sec-rule:first-child { border-top: 0; padding-top: 0; }
.sec-rule:last-child { padding-bottom: 0; }
.sec-rule-text { flex: 1; min-width: 0; max-width: 620px; display: flex; flex-direction: column; gap: 4px; }
.sec-rule-text strong { color: var(--head); font-size: 14px; font-weight: 600; }
.sec-rule-text > span { font-size: 13px; color: var(--slate); line-height: 1.5; }
.sec-rule-text label { margin: 0; }
.sec-rule-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--head); }
.sec-rule-note .ms { color: var(--link); }
.sec-rule-ctl { flex: none; width: 340px; display: flex; justify-content: flex-end; }
.sec-rule-ctl select { width: 220px; }
.sec-rule-status { margin-top: 4px; }
.sec-lock-ctl { gap: 10px; }
.sec-mini { display: flex; flex-direction: column; gap: 4px; flex: 1; margin: 0; }
.sec-mini > span { font-size: 12.5px; font-weight: 600; color: var(--head); }
.sec-rule-ctl .sec-mini select { width: 100%; }
.sec-rule.is-stack { flex-direction: column; align-items: stretch; gap: 12px; }
.sec-domains .appr-chip { font-weight: 600; }
.sec-rule-ctl .switch { margin: 0; font-weight: 600; color: var(--head); }
@media (max-width: 1180px) {
  .sec-rule { flex-direction: column; align-items: stretch; gap: 10px; }
  .sec-rule-ctl { width: 100%; max-width: 480px; justify-content: flex-start; }
  .sec-rule-ctl select { width: 100%; }
}
.sec-card-note { display: flex; gap: 8px; align-items: flex-start; padding: 12px 20px; font-size: 13px; color: var(--head); background: var(--hover); border-bottom: 1px solid var(--line-soft); }
.sec-card-note .ms { color: var(--link); margin-top: 2px; }
.sec-blocks-card { display: flex; flex-direction: column; gap: 12px; }
/* Small square icon button (e.g. edit a bank account) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--field-line, #CFDAE4); background: var(--surface); color: var(--slate); cursor: pointer; }
.icon-btn:hover { border-color: var(--blue); color: var(--link); }
.icon-btn:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--ring); }

/* Banking: simple bank cards */
.mv-bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.mv-bank-card { display: flex; flex-direction: column; gap: 18px; padding: 20px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.mv-bank-card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.mv-bank-card, .mv-bank-card:hover, .mv-bank-card:hover * { text-decoration: none; } /* the whole tile is the link */
.mv-bank-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mv-bank-id { min-width: 0; display: grid; gap: 2px; }
.mv-bank-name { font-size: 15px; font-weight: 600; color: var(--head); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-bank-meta { font-size: 12.5px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-bank-cur { flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--slate); padding: 2px 8px; border: 1px solid var(--line); }
.mv-bank-bal { display: grid; gap: 4px; }
.mv-bank-bal .v { font-size: 24px; font-weight: 600; color: var(--head); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.mv-bank-bal .s { font-size: 12.5px; color: var(--slate); }
.mv-bank-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.mv-bank-foot > .ms { color: var(--slate); }
.mv-bank-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.mv-bank-status i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--amber-text, #B7791F); }
.mv-bank-status.is-ok i { background: var(--green-text); }
/* Banking › To reconcile table */
/* Banking › reconcile table */
#mv-recon-t td { vertical-align: middle; }
#mv-recon-t .mv-sugg-inline { gap: 6px; font-size: 13px; }
#mv-recon-t .mv-sugg-inline .title { color: var(--head); }
.mv-recon-done { display: flex; align-items: flex-start; gap: 8px; }
.mv-recon-done .pill { flex: none; }
.mv-recon-done > span { min-width: 0; padding-top: 2px; }
.mv-recon-j { color: var(--link); white-space: nowrap; }
/* Required field marker */
.field label .req { color: var(--red-text); margin-left: 3px; }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea, .field.is-invalid .dd-btn { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
/* "Required" sits on the label's line, right-aligned, so showing it never moves the form */
.field { position: relative; }
.field.is-invalid::after { content: 'Required'; position: absolute; top: 0; right: 0; font-size: 12px; font-weight: 600; line-height: 18px; color: var(--red-text); pointer-events: none; }
.field.is-invalid > label { padding-right: 64px; min-height: 18px; }
/* New industry: a text box in place of the dropdown */
.sv-ind-new { position: relative; }
.sv-ind-new input { width: 100%; padding-right: 36px; }
.sv-ind-back { position: absolute; top: 0; right: 0; height: 100%; width: 34px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--slate); cursor: pointer; }
.sv-ind-back:hover { color: var(--head); }
.sv-ind-typing select, .sv-ind-typing .dd-btn { display: none !important; }
/* Import customers / suppliers */
.sv-import { gap: 14px; }
.sv-import-paste summary { cursor: pointer; color: var(--link); }
.sv-import-paste textarea { margin-top: 8px; width: 100%; font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; }
.sv-import-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sv-import-tbl { max-height: 320px; overflow: auto; border: 1px solid var(--line-soft); }
.sv-import-tbl th { position: sticky; top: 0; z-index: 1; }
.sv-import-tbl tr.is-muted td { color: var(--slate); }
.sv-import-tbl td { font-size: 12.5px; vertical-align: top; }
.sv-import-addr { min-width: 180px; }
.sv-import, .sv-import > * { min-width: 0; max-width: 100%; }
.sv-import textarea { box-sizing: border-box; max-width: 100%; white-space: pre; overflow: auto; }
/* Export menu */
.sv-menu { position: absolute; z-index: 60; width: 160px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(var(--shadow-rgb), .12); padding: 4px 0; }
.sv-menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 14px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--head); }
.sv-menu button:hover, .sv-menu button:focus-visible { background: var(--canvas); outline: none; }
.sv-menu button .ms { color: var(--link); }

/* Cheques: the leaf (screen preview and print), print layout editor, setup list */
.chq-leaf { position: relative; background: var(--surface); color: #000; font-family: Arial, Helvetica, sans-serif; overflow: hidden; }
.chq-leaf.is-test { outline: 1px dashed #9aa6b2; }
.chq-grid { position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(26, 92, 150, .12) 1px, transparent 1px), linear-gradient(to bottom, rgba(26, 92, 150, .12) 1px, transparent 1px); pointer-events: none; }
.chq-cross { position: absolute; left: 2mm; top: 13mm; width: 38mm; height: 7mm; border-top: .35mm solid #000; border-bottom: .35mm solid #000; transform: rotate(-30deg); display: flex; align-items: center; justify-content: center; font-size: 7pt; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.chq-print { margin: 0; }
.chq-lay { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 18px; align-items: start; }
.chq-lay-form { display: grid; gap: 12px; }
.chq-lay-h { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); margin-bottom: 6px; }
.chq-lay-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chq-lay-f { display: grid; gap: 3px; font-size: 12px; color: var(--slate); width: 88px; }
.chq-lay-f .input { width: 100%; }
.chq-lay-preview { background: var(--canvas); border: 1px solid var(--line); padding: 14px; overflow: auto; }
.chq-lay-scale { zoom: .82; }
.chq-setup { display: grid; }
.chq-setup-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.chq-setup-row:last-child { border-bottom: 0; }
.chq-setup-row .title { font-weight: 600; color: var(--head); }
.chq-h3 { font-size: 13px; margin: 16px 0 6px; color: var(--head); }
.chq-hist { margin: 0 0 12px; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
@media (max-width: 760px) { .chq-lay { grid-template-columns: 1fr; } }
@media print { body.print-mode .chq-leaf.is-test { outline: 1px dashed #999; } }

/* Cash: account cards, count form */
.cash-cards { align-items: stretch; }
.cash-card.is-on { box-shadow: inset 0 3px 0 var(--sky); }
.cash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cash-name { font-size: 15px; color: var(--head); display: inline-flex; align-items: center; gap: 6px; }
.cash-bal { display: grid; gap: 2px; margin: 12px 0 14px; }
.cash-bal .v { font-size: 24px; font-weight: 700; color: var(--head); font-variant-numeric: tabular-nums; }
.cash-bal .v.neg { color: var(--red-text); }
.cash-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.cash-count { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.cash-den { display: grid; grid-template-columns: 64px 16px 110px minmax(0, 1fr); align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.cash-den > span { font-weight: 600; color: var(--head); text-align: right; }
.cash-den > span::after { content: ''; }
.cash-den .input { width: 100%; }
.cash-den output { font-size: 13px; color: var(--ink); text-align: right; }
@media (max-width: 640px) { .cash-count { grid-template-columns: 1fr; } }
.cash-count-sum { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 14px; padding: 12px 14px; background: var(--canvas); border: 1px solid var(--line); }
.cash-count-sum > div { display: grid; gap: 2px; }
.cash-count-sum span { font-size: 12px; }

/* Event side panel (Audit trail / Activity log) */
.ev-h3 { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); margin: 18px 0 6px; }
.ev-detail { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: var(--ink); }
.ev-detail a { font-weight: 600; }
.ev-id { margin: 22px 0 0; }


/* Document setup: blocks for every document; each opens its settings with a live preview */
.doc-home { display: grid; gap: 10px; margin-top: 16px; }
.doc-group { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); margin: 14px 0 0; }
.doc-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
/* One tile style for the whole system: an icon, a name, one line under it in grey, and an arrow when it opens a page.
   Every tile is the same height: the name and the line each stay on one line, cut with … when too long. Where a tile is
   written with two lines (what is there, and what it is for), only what is there shows. */
.doc-block { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.doc-block:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.doc-block, .doc-block:hover, .doc-block:hover * { text-decoration: none; } /* the whole card is the link; no underlines inside it */
.doc-block-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; background: var(--blue-bg); color: var(--link); }
.doc-block-text { display: grid; gap: 3px; flex: 1; min-width: 0; }
.doc-block-text > * { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-block-text > .small { font-size: 12.5px; color: var(--slate); margin-top: 0; }
.doc-block-text:has(> .doc-block-meta) > .small:not(.doc-block-meta) { display: none; }
button.doc-block, label.doc-block { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.doc-block-text strong { color: var(--head); font-size: 14px; font-weight: 600; }
.doc-block > .ms:last-child { color: var(--slate); align-self: center; }
.docs-layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.docs-shows { display: grid; gap: 8px; }
.docs-next { margin-top: -4px; }
.docs-preview { min-width: 0; }
.docs-preview .doc-paper { zoom: .72; }
@media (max-width: 1000px) { .docs-layout { grid-template-columns: 1fr; } }

/* System defaults: one area's settings */
.def-page { max-width: 820px; margin-top: 16px; }
/* System defaults › Banking: one group of fields per company */
/* Default bank account star */
.mv-star { display: inline-flex; vertical-align: middle; color: var(--head); }
.mv-star .ms { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
/* Organisation profile: logo on the left, the fields beside it */
.org-logo-col { display: grid; gap: 10px; justify-items: start; }
.org-logo-col .label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.org-logo-col .org-logo-box { width: 100%; }
@media (max-width: 720px) { .org-profile { grid-template-columns: 1fr; } }
/* Custom field: where it applies */
.cf-to { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cf-to .appr-pick-opt { font-weight: 400; }
@media (max-width: 640px) { .cf-to { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A number cell that opens its record: the button fills the whole cell, so the cell is the target */
.tbl td:has(> .cell-link) { padding: 0; }
.tbl .cell-link { display: block; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer; }
.tbl td.num > .cell-link { text-align: right; } /* a figure that opens something stays lined up with its column */
.tbl .cell-link:hover, .tbl .cell-link:focus-visible { background: var(--blue-bg); }
/* A table row that opens its record in a side panel */
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td, .tbl tr.row-link:focus-visible td { background: var(--blue-bg); }
.tbl tr.row-link:focus-visible { outline: none; }
/* Actions boxes are one width everywhere — the invoice's side column (340px); the other cards in the row share the rest */
@media (min-width: 1101px) {
  .grid.g2:has(> .act-card, > .stack > .act-card) { grid-template-columns: minmax(0, 1fr) 340px; }
  .grid.g3:has(> .act-card, > .stack > .act-card) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 340px; }
}
/* A card table with no toolbar: the header gets its own top line (the toolbar draws it otherwise) */
.card-head + .card-body.flush > .table-wrap:first-child,
.card-head + .card-body.flush > div:first-child > .table-wrap:first-child { margin-top: 12px; border-top: 1px solid var(--line); }
/* Why a payment's Cancel button is greyed out (shown under the actions in its side panel) */
.pay-why { margin: 10px 0 0; font-size: 12.5px; color: var(--slate); }
/* A role's permissions, grouped by area */
.role-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px 24px; }
.role-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-bottom: 6px; }
.role-perm { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; color: var(--ink); }
.role-perm.is-off { color: var(--slate); }
/* A custom group: one row per app, with its level */
.grp-levels td { vertical-align: middle; }
.grp-app { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--head); white-space: nowrap; }
.grp-app .ms { color: var(--link); }
/* An app's page in My apps: its setup buttons, and the foot of the access table */
.setup-links { display: flex; flex-wrap: wrap; gap: 8px; }
/* Settings › Access: apps down the side, groups and people across */
.role-perm .switch { flex: none; }
/* A person's permissions (their page): plain list by area */
.perm-group + .perm-group { margin-top: 14px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13.5px; color: var(--ink); }
.perm-list li { display: flex; gap: 8px; align-items: flex-start; }
.perm-list li .ms { color: var(--green-text); margin-top: 2px; }
/* Full-width Permissions card: areas side by side */
.perm-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 28px; align-items: start; }
.perm-cols .perm-group + .perm-group { margin-top: 0; }
.perm-cols > .pay-why, .perm-cols > p { grid-column: 1 / -1; }
/* Organisation profile: a bigger logo preview; company logos in the details table and on the company page */
.org-logo-box.org-logo-lg { width: 100%; max-width: 320px; height: 110px; }
.org-logo-box.org-logo-lg img { max-width: 280px; max-height: 80px; }
.ent-logo { display: block; max-width: 180px; max-height: 60px; object-fit: contain; }
.ent-logo-sm { display: block; max-width: 90px; max-height: 32px; object-fit: contain; }
.auth-org.is-invite { cursor: default; }
.auth-org.is-invite:hover { border-color: var(--line); background: var(--surface); }
.auth-org.is-invite > div:first-child { display: grid; gap: 2px; }
.auth-invite-acts { display: flex; gap: 8px; flex-shrink: 0; }
/* Phones: the header's right side wraps under the title instead of pushing past the screen edge */
@media (max-width: 560px) {
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; min-width: 0; max-width: 100%; }
  .top-select .dd-btn { max-width: 120px; }
}
/* One visible focus ring everywhere: 2px dark blue (light blue on white is too faint to see) */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* the page area takes focus after navigation (for screen readers) and never shows a ring; clickable rows get an inset one */
#view:focus, #view:focus-visible { outline: none; }
.tbl tr.row-link:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--head); }
/* General ledger: wide enough to read each posting on one line (scrolls sideways on small screens) */
.gl-table .tbl { min-width: 1000px; }
.gl-table .tbl td:nth-child(3) { min-width: 280px; }
.gl-table .tbl td { vertical-align: top; }
.gl-table .tbl tr.gl-bf td { font-weight: 600; color: var(--head); background: var(--surface-2); }
.gl-table .tbl td:nth-child(4) { white-space: nowrap; }
/* Cheque details in a payment window: a full-width row of their own, shown only for the Cheque method */
.form-grid > .pay-chq { grid-column: 1 / -1; }
.pay-chq[hidden] { display: none; }
.field[hidden] { display: none; }
/* A table in a window has no card around it, so it gets its own frame */
.modal-body .table-wrap { border: 1px solid var(--line); }
/* Payslip (page and print): company logo and details top left, title and period top right */
.mv-payslip-from { display: grid; gap: 2px; align-content: start; }
.mv-payslip-logo { max-height: 48px; max-width: 180px; object-fit: contain; margin-bottom: 6px; }
.mv-payslip-co { font-size: 16px; font-weight: 700; color: var(--head); }
.mv-payslip-top .right { text-align: right; display: grid; gap: 2px; justify-items: end; align-content: start; }
.mv-payslip-stamp { display: inline-block; margin-top: 4px; padding: 2px 8px; border: 1px solid #8A6100; color: #8A6100; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.mv-payslip-note { margin: 6px 0 0; }
/* printed payslips: the same design, one per sheet */
.mv-slip-sheet { padding: 0; font-size: 12.5px; }
.mv-slip-sheet + .mv-slip-sheet { break-before: page; page-break-before: always; }
#print-root .mv-payslip .tbl th, #print-root .mv-payslip .tbl td { padding: 6px 8px; }
#print-root .mv-payslip, #print-root .mv-payslip * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Approval history: older entries folded under "Show N earlier" */
.appr-more { margin-top: 6px; }
.appr-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--link); list-style: none; padding: 4px 0; }
.appr-more > summary::-webkit-details-marker { display: none; }
.appr-more > summary::before { content: '+ '; }
.appr-more[open] > summary::before { content: '− '; }
.appr-more > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.appr-timeline li { padding-top: 6px; padding-bottom: 6px; line-height: 1.4; }
/* Sidebar sections that open and close: a quiet, readable heading row; the chevron turns down when open */
.nav-group { margin-top: 0; }
.nav-group:first-child .nav-label { padding-top: 10px; }
.nav-fold { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.nav-toggle { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px 0 12px; margin: 0; background: none; border: 0; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
.nav-toggle:hover { background: var(--canvas); color: var(--head); }
.nav-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.nav-fold.open > .nav-toggle { color: var(--head); }
.nav-toggle .nav-chev { margin-left: auto; font-size: 18px; color: var(--faint-3); transform: rotate(0deg); transition: transform .15s ease; }
.nav-fold.open .nav-chev { transform: rotate(90deg); color: var(--head); }
.nav-toggle .badge-count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--navy); font-size: 11px; font-weight: 700; letter-spacing: 0; }
.nav-toggle .badge-count + .nav-chev { margin-left: 0; }
.nav-fold .nav-items { padding: 2px 0 4px; }
.nav-fold .nav-items[hidden] { display: none; }
/* Two levels. A category reads like a top-level page: its icon, its name in normal case, the same size as a link.
   The pages inside it are one step in, along a thin guide line, so the hierarchy shows at a glance. The pages at the
   very top (Dashboard, Approvals, App Center, pinned pages) have no heading and sit at the category level. */
.nav-top { padding-top: 6px; }
.nav-toggle { gap: 11px; height: 34px; font-size: 13.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--head); }
.nav-toggle > .ms:first-child { font-size: 19px; color: var(--faint-2); }
.nav-fold.open > .nav-toggle > .ms:first-child, .nav-fold.here > .nav-toggle > .ms:first-child { color: var(--link); }
.nav-fold { border-top: 0; margin-top: 0; padding-top: 0; }
/* the pages sit one step in, beside a guide line that runs under the middle of the category's icon, from the first
   page to the last and no further */
.nav-fold .nav-items { margin: 2px 0 6px 21px; padding: 0; border-left: 1px solid var(--line); }
.nav-fold .nav-items a { padding-left: 18px; font-size: 13px; }
.nav-fold .nav-items a .ms { font-size: 17px; }
/* the current page: its tint starts at the guide line and the blue bar sits on the line itself, so there is no gap.
   A top-level page is marked like a category, with the bar flush at its left edge. */
.nav a.active::before { left: 0; }
.nav-fold .nav-items a.active::before { left: -2px; }
.nav-top + .nav-fold { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
/* Sidebar polish: the link list scrolls between the logo and the footer; regular links, bold current page;
   quiet light-blue counts instead of yellow */
.nav { min-height: 0; overscroll-behavior: contain; }
.nav a { font-weight: 500; }
.nav a.active { font-weight: 600; }
.nav a .badge-count, .nav-toggle .badge-count { background: var(--sky-bg); color: var(--head); border: 0; border-radius: 0; min-width: 20px; height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: 0; line-height: 1; }
.nav a.active .badge-count { background: var(--surface); }
/* A closed section that holds the current page: marked like the active link (tint and bar), so you can see where you are */
.nav-fold.here:not(.open) > .nav-toggle { background: var(--sky-bg); color: var(--head); position: relative; }
.nav-fold.here:not(.open) > .nav-toggle::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sky); }
.nav-fold.here:not(.open) > .nav-toggle .nav-chev { color: var(--head); }
/* Pinning sidebar links: the pin sits at the right edge of the link, shown on hover or keyboard focus */
.nav-row { position: relative; }
.nav-row > a { padding-right: 36px; }
.nav-pin { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: transparent; color: var(--faint); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .12s; }
.nav-pin .ms { font-size: 17px; }
.nav-row:hover .nav-pin, .nav-row:focus-within .nav-pin { opacity: 1; pointer-events: auto; }
.nav-pin:hover { color: var(--head); background: var(--hover); }
.nav-pin:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; opacity: 1; }
.nav-row.pinned > .nav-pin { color: var(--link); }
.nav-row.pinned > .nav-pin .ms { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
/* touch screens have no hover: pins stay visible but faint */
@media (hover: none) { .nav-pin { opacity: .55; pointer-events: auto; } }
/* Pinning sidebar links: the pin sits at the right edge of the link, shown on hover or keyboard focus */
.nav-row { position: relative; }
.nav-row > a { padding-right: 36px; }
.nav-pin { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: transparent; color: var(--faint); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .12s; }
.nav-pin .ms { font-size: 17px; }
.nav-row:hover .nav-pin, .nav-row:focus-within .nav-pin { opacity: 1; pointer-events: auto; }
.nav-pin:hover { color: var(--head); background: var(--hover); }
.nav-pin:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; opacity: 1; }
.nav-row.pinned > .nav-pin { color: var(--link); }
.nav-row.pinned > .nav-pin .ms { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
/* touch screens have no hover: pins stay visible but faint */
@media (hover: none) { .nav-pin { opacity: .55; pointer-events: auto; } }
/* Organisation profile: delete organisation */
.org-danger p { margin-top: 0; max-width: 70ch; }
/* Organisation form: required marker, same as .field label .req */
.auth-field .req { color: var(--red-text); margin-left: 3px; font-weight: 600; }
/* Employee form: section headings across the grid */
.form-grid > .form-sec { grid-column: 1 / -1; margin: 10px 0 -4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.form-grid > .form-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
/* Employee overview: summary in two columns, section tiles below */
.emp-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.emp-sum .dl { margin: 0; }
@media (max-width: 640px) { .emp-sum { grid-template-columns: 1fr; row-gap: 10px; } }
.emp-tiles .doc-block.is-soon { background: var(--canvas); cursor: default; }
.emp-tiles .doc-block.is-soon:hover { border-color: var(--line); box-shadow: none; }
.emp-tiles .doc-block.is-soon .doc-block-icon { background: var(--line); color: var(--slate); }
.emp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .emp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .emp-tiles { grid-template-columns: 1fr; } }
/* Employer pension rate: company rate or a custom one for this employee */
.er-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; min-height: 36px; }
.form-grid .field.er-rate .er-opts input[name=erRate][type=number] { width: 96px; flex: none; margin-left: -8px; }
.er-opts > .muted { margin-left: -12px; }
.er-opts .check { align-items: center; }
.er-opts .check input { margin-top: 0; }
.row-acts { display: inline-flex; gap: 4px; white-space: nowrap; }
/* Allowances / deductions window: one row per item */
.pi-head, .pi-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 72px 88px 36px; gap: 8px; align-items: center; }
.pi-head.is-deduct, .pi-row.is-deduct { grid-template-columns: minmax(0, 1.1fr) 200px minmax(0, 1fr) 130px 30px; }
.pi-row .is-off { visibility: hidden; }
.pi-loan { display: grid; gap: 1px; font-size: 13px; color: var(--head); }
.pi-head { font-size: 12px; font-weight: 600; color: var(--head); padding-bottom: 6px; }
.pi-head .num, .pi-row [name=piAmount] { text-align: right; }
.pi-rows { display: grid; gap: 8px; }
.pi-row input[name=piName], .pi-row input[name=piAmount] { width: 100%; }
.pi-tick { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pi-tick span { display: none; }
.pi-del { justify-self: end; }
.pi-del:hover { border-color: var(--red); color: var(--red-text); }
.pi-add { display: inline-flex; align-items: center; gap: 4px; margin: 10px 0 12px; }
@media (max-width: 640px) {
  .pi-head { display: none; }
  .pi-row, .pi-row.is-deduct { grid-template-columns: minmax(0, 1fr) 36px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .pi-row .is-off { display: none; }
  .pi-row [name=piName] { grid-column: 1 / -1; }
  .pi-tick span { display: inline; }
}
/* Employee pay dialogs: the app's square checkbox (as in approvals) */
.pi-tick input[type=checkbox], .form-grid > label.check.field input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--hover-line); background: var(--surface) center / 12px 12px no-repeat; cursor: pointer; transition: background-color .12s, border-color .12s; }
.pi-tick input[type=checkbox]:checked, .form-grid > label.check.field input[type=checkbox]:checked { background-color: var(--blue); border-color: var(--blue); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='square'/%3E%3C/svg%3E"); }
.pi-tick input[type=checkbox]:focus-visible, .form-grid > label.check.field input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--blue); }
.pi-tick input[type=checkbox]:disabled, .form-grid > label.check.field input[type=checkbox]:disabled { opacity: .5; cursor: default; }
.form-grid > label.check.field { align-items: center; }
/* The salary structure table (page and printout) has its outer border */
.table-wrap:has(> table.mv-salary) { border: 1px solid var(--line); }
.pi-cell { min-width: 0; position: relative; }
.pi-cell .dd-btn, .pi-cell select { width: 100%; }
/* Salary settings: the three contribution rates share one row under "covered", greyed out when not covered */
.form-grid > .stat-rates { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.form-grid > .stat-rates.is-off label { color: var(--slate); }
.form-grid > .stat-rates.is-off > .field > input[type=number][name] { background: var(--surface-2); color: var(--slate); border-color: var(--line); cursor: not-allowed; }
.form-grid > label.check.field.stat-cover { min-height: 23px; } /* room for the tag, so showing it doesn't move anything */
.stat-cover .stat-na { display: none; margin-left: auto; flex: none; }
.stat-cover.is-off .stat-na { display: inline-flex; }
@media (max-width: 640px) { .form-grid > .stat-rates { grid-template-columns: 1fr; } }
/* Bonuses window: name | how much | amount or % | when | month | tax | EPF/ETF | remove */
.pi-head.is-bonus, .pi-row.is-bonus { grid-template-columns: minmax(0, 1.2fr) 118px 100px 138px 118px 56px 72px 30px; }
.bn-at .is-off { display: none; }
.pi-row .pi-tick span { display: none; }
@media (max-width: 640px) { .pi-row.is-bonus { grid-template-columns: 1fr 1fr; } .pi-row.is-bonus .pi-tick span { display: inline; } }
.form-grid > .settle-sum { grid-column: 1 / -1; }
/* HR set-up: pay item window, letters and policies */
.is-hidden { display: none !important; }
.hr-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 0; max-height: 180px; overflow: auto; }
.hr-checks .hr-check span { display: inline !important; }
.hr-rule-group + .hr-rule-group { margin-top: 14px; }
.hr-rule-group .section-title { margin-bottom: 6px; }
.letter-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 2px solid var(--navy); }
.letter-ref { text-align: right; margin: -8px 0 12px; }
.letter-title { font-size: 20px; font-weight: 700; color: var(--head); margin-bottom: 4px; }
.letter-body { font-size: 14px; line-height: 1.6; color: var(--ink); }
.letter-body p { margin: 0 0 10px; }
.letter-body table { border-collapse: collapse; width: 100%; }
.letter-body td, .letter-body th { border: 1px solid var(--line); padding: 6px 8px; }
.letter-sheet.is-inline { border: 1px solid var(--line); padding: 24px; background: var(--surface); }
.merge-missing { background: var(--amber-bg); color: var(--amber-text); padding: 0 3px; }
.hr-inputs { margin: 0; }
.form-grid > p.full { grid-column: 1 / -1; }

/* Report library tiles: the whole tile opens the report; the star sits top right */
.rp-tile { cursor: pointer; }
.rp-tile .rp-tile-name, .rp-tile .rp-tile-name:hover { text-decoration: none; }
.rp-tile .rp-tile-name strong { color: var(--head); font-size: 14px; }
.rp-tile .rp-tile-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rp-tile .rp-star { align-self: flex-start; flex: none; border-radius: 0; }
.doc-group .count { color: var(--slate); font-weight: 600; margin-left: 4px; }
.emp-tiles.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .emp-tiles.tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .emp-tiles.tiles-4 { grid-template-columns: 1fr; } }

/* Report viewer: period and options sit top right of the report itself; the table has a line above its header */
.rp-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rp-head-ctrl .rp-toolbar { justify-content: flex-end; }
.rp-head-ctrl .rp-toolbar > .input, .rp-head-ctrl .rp-toolbar .dd-btn { min-width: 160px; }
.rp-sheet > .rp-pad + :not(.rp-pad):not(.rp-note), .rp-sheet > .report-title + :not(.rp-pad):not(.rp-note) { border-top: 1px solid var(--line); }
@media (max-width: 860px) { .rp-head-ctrl { width: 100%; } .rp-head-ctrl .rp-toolbar { justify-content: flex-start; } }

/* Picking company salary components for an employee */
.pick-list { display: grid; border: 1px solid var(--line); }
.pick-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.pick-row + .pick-row { border-top: 1px solid var(--line); }
.pick-row:hover { background: var(--blue-bg); }
.pick-row input { margin-top: 3px; accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.pick-text { display: grid; gap: 2px; min-width: 0; }
.pick-text strong { color: var(--head); }

/* Budgets: one annual amount per account and how it spreads */
.bud-tbl .bud-annual { width: 140px; text-align: right; margin-left: auto; }
.bud-spread { display: flex; align-items: center; gap: 6px; }
.bud-spread .input, .bud-spread .dd-btn { width: 170px; min-width: 0; }
.bud-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
@media (max-width: 640px) { .bud-months { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Report period: the dropdown keeps its own width (the global .input width:100% made it stretch across the row);
   the date range sits above it as a clear chip */
.rp-toolbar > .input, .rp-toolbar .dd-btn, .rp-opt .dd-btn { width: auto; flex: none; min-width: 160px; max-width: 240px; }
.rp-head-ctrl { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.rp-range { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--blue-bg); color: var(--head); font-weight: 600; font-size: 13px; white-space: nowrap; }
.rp-range .ms { font-size: 16px; color: var(--link); }
.card-head .actions .rp-toolbar { flex-wrap: wrap; justify-content: flex-end; }
.card-head .actions { flex-wrap: wrap; justify-content: flex-end; }
.rp-sched { margin-top: 20px; }
@media (max-width: 860px) { .rp-head-ctrl { align-items: flex-start; } }

/* Sidebar: a line under the logo; the footer lines up with the menu icons (22px) */
/* no line under the logo while the menu is at its top; one appears while the menu is scrolled underneath it (ui.js
   marks the sidebar). The line's room is always there, so nothing moves when it shows. */
.sidebar .brand { border-bottom: 1px solid transparent; transition: border-color .15s ease; }
.sidebar.scrolled .brand { border-bottom-color: var(--line); }
/* the same at the foot: a line above it only while more of the menu lies below */
.sidebar .sidebar-foot { border-top: 1px solid transparent; transition: border-color .15s ease; }
.sidebar.more-below .sidebar-foot { border-top-color: var(--line); }
.sidebar-foot { padding-left: 22px; padding-right: 22px; }
/* Error log: technical detail */
.err-detail { margin: 6px 0 0; padding: 12px; background: var(--canvas); border: 1px solid var(--line); font: 12px/1.5 'IBM Plex Mono', monospace; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; }

/* One header height everywhere: the sidebar logo bar, the top bar and side panels (drawers) */
:root { --head-h: 64px; }
.sidebar .brand { height: var(--head-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; display: flex; align-items: center; flex: none; }
.topbar { height: var(--head-h); min-height: var(--head-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.modal.drawer .modal-head { height: var(--head-h); }
@media (max-width: 860px) { .topbar { height: auto; padding-top: 10px; padding-bottom: 10px; } } /* narrow screens: the top bar may wrap onto two lines */
.doc-blocks.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .doc-blocks.tiles-2 { grid-template-columns: 1fr; } }

/* Import & export */
.io-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; flex-wrap: wrap; }
.io-steps li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--slate); padding: 6px 10px; border: 1px solid var(--line); }
.io-steps li span { width: 20px; height: 20px; display: grid; place-items: center; background: var(--mist); font-weight: 700; font-size: 11px; }
.io-steps li.now { color: var(--head); border-color: var(--blue); font-weight: 600; }
.io-steps li.now span { background: var(--blue); color: #fff; }
.io-steps li.done span { background: var(--green-bg, #E6F4EC); color: var(--green, var(--green-text)); }
.io-map .io-sel { min-width: 220px; }
.io-map .io-sel.is-bad { border-color: var(--danger-strong); }
.io-map tr.is-muted td:first-child { color: var(--slate); }
.io-sample { display: inline-block; background: var(--mist); padding: 1px 6px; margin: 0 4px 3px 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.io-warn { color: var(--amber-text); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.io-existing { max-width: 520px; margin: 12px 0; }
.io-done { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.io-done > .ms { font-size: 36px; color: var(--green, var(--green-text)); }
.io-done h3 { margin: 0 0 4px; color: var(--head); }
.io-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.io-tile .card-body { display: flex; flex-direction: column; height: 100%; }
.io-tile-top { display: flex; gap: 12px; align-items: center; }
.io-tile-top strong { color: var(--head); }
.io-tile .io-desc { margin: 10px 0 12px; flex: 1; color: var(--slate); }
.io-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.io-tile-acts { display: flex; gap: 8px; }
@media (max-width: 1100px) { .io-grid, .io-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .io-grid, .io-grid-4 { grid-template-columns: 1fr; } }
.io-drop { display: grid; justify-items: center; gap: 8px; padding: 26px 16px; border: 2px dashed var(--hover-line); background: var(--hover); text-align: center; cursor: pointer; margin-bottom: 12px; }
.io-drop:hover, .io-drop.is-over { border-color: var(--blue); background: var(--blue-bg); }
.io-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.io-drop:focus-within { outline: 2px solid var(--sky, #05B3D7); outline-offset: 2px; }
.io-drop-icon .ms { font-size: 34px; color: var(--link); }
.io-drop strong { color: var(--head); }
.io-formats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.io-formats span { font-size: 11.5px; font-weight: 600; padding: 2px 8px; background: var(--surface); border: 1px solid var(--line); color: var(--head); }
.io-drop.is-bad { border-color: var(--danger-strong); background: var(--danger-bg); }
.io-drop.is-bad .ms { color: var(--danger-strong); }
.io-file { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--green-line); background: var(--green-bg); margin-bottom: 12px; }
.io-file > .ms { font-size: 30px; color: var(--green-text); }
.io-file.is-reading { border-color: var(--line); background: var(--blue-bg); }
.io-file.is-reading > .ms { color: var(--link); animation: io-spin 1.2s linear infinite; }
.io-file-main { flex: 1; min-width: 0; }
.io-file-main strong { color: var(--head); overflow-wrap: anywhere; }
.io-preview { border: 1px solid var(--line); max-height: 180px; overflow: auto; }
.io-preview td { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.io-paste-status { margin-top: 6px; color: var(--green-text); display: flex; align-items: center; gap: 4px; }
@keyframes io-spin { to { transform: rotate(360deg); } }

/* Advance (down payment) on quotes, orders and invoices: a light band under the total, printed too */
.pdoc-totals .adv { background: color-mix(in srgb, var(--pdoc-rule, #0C385F) 10%, var(--pdoc-bg, #fff)); color: var(--pdoc-rule, #0C385F); padding: 5px 9px; margin-top: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.le-sum-row.adv { background: var(--blue-bg); color: var(--head); padding: 6px 8px; margin-top: 6px; font-weight: 600; }
.adv-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 10px; align-items: end; }
/* My account › Delete my account: what happens to each organisation */
.close-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.close-list li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.close-list li .ms { margin-top: 3px; flex-shrink: 0; }
/* App Center */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.app-tools { margin: 12px 0 4px; padding: 0; border: 0; background: none; }
.app-card[hidden] { display: none; }
/* Settings › My apps: small cards, icon and name only */
.app-grid.my-apps { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 12px; }
.app-card.my-app .card-body { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
.my-app strong { color: var(--head); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.app-card:hover { border-color: var(--blue); }
.app-card .card-body { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.app-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.app-icon { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; flex-shrink: 0; }
.app-icon.lg { width: 56px; height: 56px; }
.app-icon .ms { font-size: 24px; }
.app-name { font-size: 15px; color: var(--head); margin-top: 4px; }
.app-tag { min-height: 36px; }
.app-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.app-stars { display: inline-flex; color: var(--link); vertical-align: middle; }
.app-stars.on-dark { color: #F2C643; }
.app-stars .ms { font-size: 15px; }
.app-hero { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.app-reviews { display: grid; gap: 10px; }
/* Clear data */
.clear-groups { display: grid; gap: 8px; margin-top: 12px; }
.clear-group { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); cursor: pointer; }
.clear-group.on { border-color: var(--danger-strong); background: rgba(180, 35, 24, .04); }
.clear-group.off { opacity: .55; cursor: default; }
.clear-group > span:last-child { display: grid; gap: 2px; }
.clear-group .ms { color: var(--link); margin-top: 2px; }
.clear-steps { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 10px; }
.clear-steps li.done .btn { border-color: var(--green, #1F7A4D); }
.app-card, .app-card:hover, .app-card:focus { text-decoration: none; }
/* "Crafting": being built now — yellow on navy (the brand allows yellow only on navy) */
.tag-craft { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #0C385F; color: #F2C643; border: 1px solid #0C385F; padding: 1px 6px; margin-left: 6px; vertical-align: middle; line-height: 1.5; }

/* Help panel opened from the (i) beside a field: an even border all round, and a pointer that joins it */
.help-pop { position: fixed; z-index: 2000; width: max-content; max-width: min(340px, calc(100vw - 16px)); background: var(--surface); color: var(--ink); border: 1px solid var(--navy); box-shadow: 0 10px 28px rgba(var(--shadow-rgb), .18); padding: 10px 12px 12px; font-size: 13px; line-height: 1.5; animation: help-pop-in .12s ease-out; }
/* the pointer: a navy triangle (the border) with a white one inside it (the fill), sitting on the top edge */
.help-pop::before, .help-pop::after { content: ''; position: absolute; left: calc(var(--arrow-x, 16px) - 7px); border: 7px solid transparent; pointer-events: none; }
.help-pop::before { top: -14px; border-bottom-color: var(--navy); }
.help-pop::after { top: -12px; border-bottom-color: var(--surface); }
/* opened above the icon: the pointer is on the bottom edge */
.help-pop.above::before { top: auto; bottom: -14px; border-bottom-color: transparent; border-top-color: var(--navy); }
.help-pop.above::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: var(--surface); }
.help-pop-head { display: flex; align-items: center; gap: 6px; color: var(--head); margin-bottom: 4px; }
.help-pop-head .ms { color: var(--link); }
.help-pop-head strong { font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.help-pop-x { margin-left: auto; border: 0; background: none; padding: 2px; color: var(--slate); cursor: pointer; display: inline-flex; }
.help-pop-x:hover { color: var(--head); }
.help-pop p { margin: 0; color: var(--ink); }
@keyframes help-pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .help-pop { animation: none; } }
/* An app's "What's new": each version with its date and notes */
.sp-releases { display: grid; gap: 14px; }
.sp-release { display: grid; gap: 6px; }
.sp-release + .sp-release { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.sp-release-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Setting up an organisation: steps with a bar on top, one step at a time, Back and Next */
.auth-card.wide { width: min(560px, 100%); }
.wiz-bar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wiz-bar li { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--slate); position: relative; cursor: default; }
.wiz-bar li::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 2px; background: var(--line); }
.wiz-bar li:first-child::before { display: none; }
.wiz-num { width: 28px; height: 28px; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--line); background: var(--surface); font-weight: 700; color: var(--slate); border-radius: 50% !important; position: relative; z-index: 1; transition: background .2s, box-shadow .2s, color .2s; }
.wiz-bar li.now .wiz-num { box-shadow: inset 0 0 0 2px var(--link); color: var(--link); }
.wiz-bar li.now .wiz-label { color: var(--head); font-weight: 600; }
.wiz-bar li.done { cursor: pointer; }
.wiz-bar li.done .wiz-num { background: var(--blue); box-shadow: none; color: var(--surface); }
.wiz-bar li.done::before, .wiz-bar li.now::before { background: var(--blue); }
.wiz-bar li.skip { opacity: .4; }
.wiz-step { display: grid; gap: 14px; }
.wiz-step[hidden] { display: none; }
.wiz-step.from-right { animation: wiz-in-right .22s ease-out; }
.wiz-step.from-left { animation: wiz-in-left .22s ease-out; }
@keyframes wiz-in-right { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes wiz-in-left { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wiz-step.from-right, .wiz-step.from-left { animation: none; } }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; }
.wiz-nav [hidden] { display: none; }
.wiz-nav .btn { min-width: 120px; justify-content: center; height: 42px; }
.wiz-hint { font-weight: 400; color: var(--slate); font-size: 12px; }
.wiz-sum { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; margin: 0; padding: 14px; border: 1px solid var(--line); background: var(--canvas); font-size: 14px; }
.wiz-sum dt { color: var(--slate); } .wiz-sum dd { margin: 0; color: var(--head); font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 480px) { .wiz-label { display: none; } .wiz-sum { grid-template-columns: 1fr; } }
/* Build your plan: the apps on the left, the plan and total at the side (stays in view) */
.bp-opts { gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 16px; }
.bp-opts .field, .bp-opts label { margin: 0; }
.bp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.bp-sum { position: sticky; top: calc(var(--head-h, 64px) + 16px); }
.bp-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.bp-app { display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "box icon text" "box icon price"; column-gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); cursor: pointer; }
.bp-app input { grid-area: box; } .bp-app .app-icon { grid-area: icon; } .bp-app-text { grid-area: text; display: grid; min-width: 0; } .bp-app-price { grid-area: price; color: var(--slate); }
.bp-app-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-app.on { border-color: var(--accent-line, var(--line)); background: var(--sky-bg); }
.bp-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin: 0 0 12px; }
.bp-lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.bp-lines .bp-total { font-weight: 700; color: var(--head); border-top: 1px solid var(--line); padding-top: 8px; }
@media (max-width: 960px) { .bp-grid { grid-template-columns: 1fr; } .bp-sum { position: static; } }

