/* Cheque Manager design system.
   One stylesheet, no framework. Colours are tokens with dark-mode values;
   controls are 44px tall so they line up and are easy to tap. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../vendor/fonts/plus-jakarta-sans-latin-wght-normal.7660bd9909fb.woff2") format("woff2-variations");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../vendor/fonts/jetbrains-mono-latin-500-normal.a21e038a03f7.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* --- tokens -------------------------------------------------------------- */
:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --bg: #F6F7F9;  --surface: #FFFFFF;  --surface-2: #F9FAFB;  --sunken: #EEF0F4;
  --border: #E4E7EC;  --border-strong: #D0D5DD;  --divider: #EEF0F4;
  --ink: #101828;  --ink-2: #344054;  --muted: #5D6B82;  --faint: #98A2B3;
  --accent: #0F6E63;  --accent-hover: #0B544B;  --accent-soft: #E6F2F0;  --accent-ring: #CDE7E2;  --on-accent: #FFFFFF;
  --bar: #101828;  --on-bar: #FFFFFF;
  --draft-bg: #FEF3C7;  --draft-fg: #92400E;
  --issued-bg: #E0EAFF;  --issued-fg: #1D4ED8;
  --cleared-bg: #DCFCE7;  --cleared-fg: #166534;
  --bounced-bg: #FEE2E2;  --bounced-fg: #B91C1C;
  --cancelled-bg: #F2F4F7;  --cancelled-fg: #475467;
  --stale-bg: #FFEDD5;  --stale-fg: #9A3412;
  --spoiled-bg: #FCE7F3;  --spoiled-fg: #9D174D;
  --warn: #B45309;  --warn-bg: #FFFBEB;  --warn-border: #FDE68A;
  --error: #B91C1C;  --error-bg: #FEF2F2;  --error-border: #FECACA;
  --ok: #15803D;  --ok-bg: #F0FDF4;  --ok-border: #BBF7D0;
  --radius: 10px;  --radius-lg: 14px;
  --control: 44px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1018;  --surface: #121A26;  --surface-2: #162030;  --sunken: #1C2636;
    --border: #253246;  --border-strong: #33435C;  --divider: #1E2A3B;
    --ink: #EEF2F7;  --ink-2: #CBD5E1;  --muted: #94A3B8;  --faint: #64748B;
    --accent: #2DB3A2;  --accent-hover: #4FC9B9;  --accent-soft: #10302C;  --accent-ring: #1F5A52;  --on-accent: #04201C;
    --bar: #EEF2F7;  --on-bar: #0B1018;
    --draft-bg: #3B2A0A;  --draft-fg: #FCD34D;
    --issued-bg: #172554;  --issued-fg: #BFDBFE;
    --cleared-bg: #0F2E1C;  --cleared-fg: #86EFAC;
    --bounced-bg: #3B1212;  --bounced-fg: #FCA5A5;
    --cancelled-bg: #1F2937;  --cancelled-fg: #CBD5E1;
    --stale-bg: #3A1F0B;  --stale-fg: #FDBA74;
    --spoiled-bg: #3A1229;  --spoiled-fg: #F9A8D4;
    --warn: #FBBF24;  --warn-bg: #2A2110;  --warn-border: #5C4513;
    --error: #F87171;  --error-bg: #2A1414;  --error-border: #5C1F1F;
    --ok: #4ADE80;  --ok-bg: #0F2417;  --ok-border: #1E4D2E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

/* --- base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); }
h1, h2, h3, h4, h5 { margin: 0 0 .75rem; line-height: 1.25; font-weight: 700; color: var(--ink); }
h1, .content-inner > h2, .page-head h2 { font-size: 26px; letter-spacing: -.02em; }
.content-inner > h2 { margin-bottom: 1.25rem; }
h2 { font-size: 20px; }  h3 { font-size: 17px; }  h4 { font-size: 15px; }  h5 { font-size: 14px; }
p, ul, ol, dl, table, form, fieldset, details, figure { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
small, .small { font-size: 13px; }
code, kbd { font-family: var(--mono); font-size: .92em; background: var(--sunken); padding: .1em .35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.muted { color: var(--muted); }
.mono, .leaf { font-family: var(--mono); font-size: 13px; letter-spacing: .01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: .5rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { left: .5rem; }

/* --- buttons -------------------------------------------------------------- */
button, [role="button"], input[type="submit"], input[type="button"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--control); padding: 0 18px; margin: 0;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: var(--on-accent);
  font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, [role="button"]:hover, input[type="submit"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.secondary, [role="button"].secondary, button.outline, [role="button"].outline {
  background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }
button.secondary:hover, [role="button"].secondary:hover, button.outline:hover, [role="button"].outline:hover {
  background: var(--surface-2); color: var(--ink); border-color: var(--faint); }
button.contrast, [role="button"].contrast { background: var(--bar); border-color: var(--bar); color: var(--on-bar); }
button.danger, [role="button"].danger { background: var(--surface); color: var(--error); border-color: var(--error-border); }
button.ghost, [role="button"].ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--sunken); color: var(--ink); }
button.small, [role="button"].small, .inline-form button { min-height: 36px; padding: 0 12px; font-size: 13px; }
button:disabled, button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-button { width: var(--control); padding: 0; }
.btn-row, .form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* --- forms ---------------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; font-weight: 600; color: var(--ink); }
label > small, label .field-help { font-weight: 400; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]), select, textarea {
  width: 100%; min-height: var(--control); padding: 0 14px; margin: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: 500 14px/1.4 var(--font);
}
textarea { padding: 10px 14px; min-height: 88px; resize: vertical; }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235D6B82' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
input[type="checkbox"][role="switch"] { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .15s; }
input[type="checkbox"][role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #FFFFFF; box-shadow: var(--shadow); transition: transform .15s; }
input[type="checkbox"][role="switch"]:checked { background: var(--accent); }
input[type="checkbox"][role="switch"]:checked::after { transform: translateX(18px); }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]), label.check {
  flex-direction: row; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; }
fieldset[role="group"] { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
fieldset[role="group"] > * { width: auto; flex: 0 1 auto; }
.field-error { display: block; color: var(--error); font-weight: 600; font-size: 13px; }

/* --- cards, grids, tables -------------------------------------------------- */
article, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin: 0 0 1.25rem; box-shadow: var(--shadow); }
article > header, .card > header { margin: -20px -20px 16px; padding: 14px 20px; border-bottom: 1px solid var(--divider);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
article > header strong, .card-title { font-size: 15px; font-weight: 700; }
article > footer { margin: 16px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--divider); }
article > :last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.25rem; align-items: start; }
.grid > article { margin: 0; }
hgroup { margin-bottom: 1rem; }  hgroup > * { margin: 0; }  hgroup > p { color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--divider); }
thead th { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 16px; }  th:last-child, td:last-child { padding-right: 16px; }
table.compact th, table.compact td { padding-top: 9px; padding-bottom: 9px; }
tfoot th, tfoot td { border-top: 1px solid var(--border); font-weight: 700; }
.table-scroll { overflow-x: auto; margin: 0 0 1.25rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.table-scroll table { margin: 0; }
article .table-scroll { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px; }
article table.compact:not(thead table) th { background: transparent; }
table th[scope="row"], .kv th { width: 34%; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; background: transparent; }

/* --- status pills, notices -------------------------------------------------- */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-DRAFT { background: var(--draft-bg); color: var(--draft-fg); }
.status-ISSUED { background: var(--issued-bg); color: var(--issued-fg); }
.status-CLEARED { background: var(--cleared-bg); color: var(--cleared-fg); }
.status-BOUNCED { background: var(--bounced-bg); color: var(--bounced-fg); }
.status-CANCELLED { background: var(--cancelled-bg); color: var(--cancelled-fg); text-decoration: line-through; }
.status-STALE { background: var(--stale-bg); color: var(--stale-fg); }
.status-SPOILED { background: var(--spoiled-bg); color: var(--spoiled-fg); }
.notice { padding: 12px 16px; margin: 0 0 1rem; border: 1px solid var(--warn-border); border-radius: var(--radius);
  background: var(--warn-bg); color: var(--ink); }
.notice.error, .messages .error { border-color: var(--error-border); background: var(--error-bg); }
.messages .success { border-color: var(--ok-border); background: var(--ok-bg); }
.messages .info { border-color: var(--accent-ring); background: var(--accent-soft); }
.error-summary ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.error-summary:focus { outline: 3px solid var(--error-border); }
.empty-state { color: var(--muted); padding: 1rem 0; margin: 0; }
.empty-state a { margin-left: .25rem; font-weight: 600; }

/* --- disclosure, dialog, pagination, breadcrumb ------------------------------ */
details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 0 16px; }
details > summary { min-height: var(--control); display: flex; align-items: center; cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; width: 1em; font-size: 18px; color: var(--muted); transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details[open] { padding-bottom: 12px; }
dialog { border: 0; padding: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); background: transparent; max-width: min(28rem, calc(100vw - 32px)); }
dialog article { margin: 0; }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
nav.pager ul, main nav:not(.breadcrumb) > ul { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; list-style: none; padding: 0; }
nav.breadcrumb ul, nav[aria-label="breadcrumb"] ul { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0 0 .5rem;
  font-size: 13px; color: var(--muted); }
nav[aria-label="breadcrumb"] li + li::before { content: "/"; margin-right: .4rem; color: var(--faint); }
nav[aria-label="breadcrumb"] a { color: var(--muted); text-decoration: none; }

/* --- app shell ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 256px; flex: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-org { font-size: 12px; color: var(--muted); line-height: 1.3; }
.sidebar .new-cheque { width: 100%; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 0 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 8px;
  color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav-link:hover { background: var(--sunken); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.nav-link svg { flex: none; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--sunken); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who small { color: var(--muted); }
.user-menu { position: relative; }
.user-menu > summary { border: 0; padding: 0; min-height: 40px; width: 40px; justify-content: center; border-radius: 8px; color: var(--muted); }
.user-menu > summary::before { display: none; }
.user-menu[open] { padding: 0; }
.user-menu { border: 0; background: transparent; padding: 0; }
.user-menu .menu { position: absolute; bottom: 48px; right: 0; z-index: 30; min-width: 210px; padding: 6px; margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); list-style: none; }
.user-menu .menu a, .user-menu .menu button { display: flex; width: 100%; justify-content: flex-start; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--sunken); color: var(--ink); }
.user-menu form { margin: 0; }
.content { flex: 1; min-width: 0; padding: 32px 40px 56px; }
.content-inner { max-width: 1240px; margin: 0 auto; }
.topbar, .tabbar, .drawer-backdrop { display: none; }
.public-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.public-page .content-inner { width: 100%; max-width: 440px; }
.public-brand { justify-content: center; margin-bottom: 20px; }

@media (max-width: 900px) {
  .content { padding: 20px 16px 96px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(16, 24, 40, .45); }
  .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 52px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .tab-new { align-self: center; justify-self: center; width: 52px; height: 52px; min-height: 0; border-radius: 16px;
    background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px rgba(15, 110, 99, .3); }
  .tabbar .tab-new:hover { color: var(--on-accent); }
  .user-menu .menu { bottom: auto; top: 48px; }
}

/* --- page header, KPI cards, account cards ------------------------------------ */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1, .page-head h2, .page-head hgroup { margin: 0; }
.page-head .eyebrow, .eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-actions label { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
  color: inherit; text-decoration: none; }
.kpi:hover { color: inherit; border-color: var(--border-strong); }
.kpi-label { color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-note { color: var(--muted); margin-top: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 12px; }
.section-head h2 { font-size: 17px; margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }
.account-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 28px; }
.account-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.account-card:hover { color: inherit; border-color: var(--accent); }
.account-card .top, .account-card .bottom { display: flex; justify-content: space-between; gap: 12px; }
.account-card .top { align-items: flex-start; }  .account-card .bottom { align-items: flex-end; }
.account-card .name { font-weight: 700; font-size: 15px; }
.account-card .sub { color: var(--muted); font-size: 13px; }
.account-card .amount { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--sunken); color: var(--ink-2);
  font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.warn { background: var(--draft-bg); color: var(--draft-fg); }
.chip.ok { background: var(--accent-soft); color: var(--accent-hover); }
.meter { width: 130px; }
.meter-track { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter-fill { height: 6px; border-radius: 3px; background: var(--accent); }
.meter-fill.warn { background: var(--warn); }
.meter small { display: block; text-align: right; margin-top: 6px; color: var(--muted); font-size: 12px; }
.two-col { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.two-col > .main-col { flex: 999 1 520px; min-width: 0; }
.two-col > .side-col { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.two-col > * > article { margin: 0; }
.attention { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--divider); }
.attention:first-of-type { border-top: 0; padding-top: 0; }
.attention .icon { width: 32px; height: 32px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.attention .icon.warn { background: var(--draft-bg); color: var(--draft-fg); }
.attention .icon.info { background: var(--issued-bg); color: var(--issued-fg); }
.attention .icon.error { background: var(--bounced-bg); color: var(--bounced-fg); }
.attention strong { display: block; }
.attention small { color: var(--muted); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list a { display: flex; align-items: center; justify-content: space-between; min-height: 42px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.link-list a:hover { color: var(--accent); }
.link-list li + li { border-top: 1px solid var(--divider); }
.payee-cell strong { display: block; font-weight: 600; }
.payee-cell small { color: var(--muted); }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .75rem; margin: 0 0 1.5rem; }
.quick-links a { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  text-decoration: none; color: inherit; }
.quick-links a:hover { border-color: var(--accent); }
.quick-links strong, .quick-links small { display: block; }

/* --- filters, segmented tabs, bulk bar -------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label { flex: 1 1 10rem; margin: 0; font-size: 13px; color: var(--muted); }
.filters button, .filters [role="button"] { flex: none; }
.search-field { position: relative; flex: 2 1 16rem; }
.search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 40px !important; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--sunken); margin-bottom: 16px; }
.segmented a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 8px; color: var(--muted);
  font-weight: 600; text-decoration: none; }
.segmented a:hover { color: var(--ink); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.bulk-bar { position: sticky; bottom: 16px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; margin: 0 0 16px; border-radius: 12px; background: var(--bar); color: var(--on-bar); box-shadow: var(--shadow-lg); }
.bulk-bar label { flex-direction: row; align-items: center; gap: 8px; margin: 0; color: inherit; font-weight: 500; }
.bulk-bar input[type="date"] { width: auto; min-height: 36px; }
.bulk-bar button { min-height: 36px; background: var(--surface); color: var(--ink); border-color: var(--surface); }
.list-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); }
.list-foot nav ul { margin: 0; }
@media (max-width: 900px) { .bulk-bar { bottom: 84px; } }

/* --- cheque form -------------------------------------------------------------------- */
.cheque-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.cheque-layout > form { flex: 1 1 420px; min-width: 0; }
.cheque-layout > .cheque-preview { flex: 1.3 1 460px; min-width: 0; position: sticky; top: 24px; }
.account-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.account-option { flex-direction: column !important; align-items: stretch !important; gap: 2px !important; margin: 0; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.account-option:has(input:checked) { border: 2px solid var(--accent); padding: 11px 13px; background: var(--accent-soft); }
.account-option:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-ring); }
.account-option .line1 { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.account-option .line2 { color: var(--muted); font-size: 12px; font-weight: 500; padding-left: 26px; }
.leaf-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-hover); font-weight: 600; font-size: 13px; }
.amount-words { margin: -6px 0 1rem; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--divider);
  color: var(--ink-2); min-height: 48px; }
.amount-words:empty { display: none; }
.amount-words::before { content: "In words"; display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.switch-row { flex-direction: row !important; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); }
.switch-row .text small { display: block; color: var(--muted); font-weight: 400; }
.preview-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 12px; }
.preview-legend span { display: inline-flex; align-items: center; gap: 6px; }
.preview-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.autocomplete { position: relative; }
.autocomplete ul { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% - 12px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 16rem; overflow-y: auto; }
.autocomplete li { padding: 8px 12px; border-radius: 8px; cursor: pointer; list-style: none; }
.autocomplete li:hover, .autocomplete li.active { background: var(--accent-soft); }
.detail-preview { max-width: 46rem; margin: 0 0 1.5rem; }
@media (max-width: 900px) { .cheque-layout > .cheque-preview { position: static; order: -1; } }

/* --- cheque leaf preview (printing/_cheque_preview.svg.html; units are mm) ---------------- */
.cheque-svg { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
.cheque-svg .leaf { fill: #F4F8FB; stroke: #B6C6D6; stroke-width: .3; }
.cheque-svg .leaf-bank { font: 600 3.2px Helvetica, Arial, sans-serif; fill: #3B5B85; letter-spacing: .2px; }
.cheque-svg .leaf-label { font: 2.2px Helvetica, Arial, sans-serif; fill: #7B8DA3; }
.cheque-svg .leaf-box { fill: #FFFFFF; stroke: #B6C6D6; stroke-width: .25; }
.cheque-svg .leaf-rule { stroke: #B6C6D6; stroke-width: .2; stroke-dasharray: .8 .6; }
.cheque-svg .micr { fill: #E6EBF1; }
.cheque-svg .micr-label { font: 2px Helvetica, Arial, sans-serif; fill: #8A97A8; }
.cheque-svg .ink-text text { fill: #0B2A5B; }
.cheque-svg .ink { stroke: #0B2A5B; stroke-width: .3; }
.cheque-svg text.overflow { fill: #B91C1C; }

/* --- layout calibration ---------------------------------------------------------------- */
.calibrate { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.5rem; align-items: start; margin: 0 0 1.5rem; padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.calibrate-controls select { margin-bottom: .75rem; }
.step-label { display: block; font-size: 13px; margin-bottom: .25rem; }
.step-sizes { display: flex; gap: .35rem; margin-bottom: 1rem; }
.step-sizes button { flex: 1; min-height: 36px; padding: 0 8px; font-size: 13px; }
.dpad { display: grid; grid-template-columns: repeat(3, 3rem); grid-template-rows: repeat(3, 3rem); gap: .25rem; justify-content: center; margin-bottom: .75rem; }
.dpad button { min-height: 0; padding: 0; font-size: 1rem; }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
.offset-readout { font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
#undo-moves { width: 100%; }
.grid-fields { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: .5rem; align-items: center; margin: 1rem 0; }
@media (max-width: 800px) { .calibrate { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .grid-fields { grid-template-columns: repeat(4, minmax(4.5rem, 1fr)); }
  .grid-fields > strong:first-child, .grid-fields > span:not(:has(input)) { grid-column: 1 / -1; }
}

/* --- settings page ---------------------------------------------------------------------- */
.settings-tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.settings-tabs a { padding: .7rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.settings-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.settings { display: grid; grid-template-columns: 14rem 1fr; gap: 2rem; align-items: start; }
.settings aside a { display: block; padding: .55rem .75rem; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.settings aside a:hover { background: var(--sunken); }
.settings aside a.on { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.settings > section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow); }
.settings-row { display: grid; grid-template-columns: 1fr 12rem 7rem; gap: 1rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--divider); }
.settings-row:last-child { border-bottom: 0; }
.settings-row a[role=button], .settings-row button { min-height: 36px; padding: 0 12px; font-size: 13px; width: 100%; }
.settings-form { max-width: 32rem; }
@media (max-width: 760px) {
  .settings { grid-template-columns: 1fr; gap: 1rem; }
  .settings aside { display: flex; flex-wrap: wrap; gap: .25rem; }
  .settings-row { grid-template-columns: 1fr; gap: .4rem; }
}

/* --- master data and misc ---------------------------------------------------------------- */
.master-edit { display: grid; grid-template-columns: minmax(0, 36rem) minmax(0, 1fr); gap: 24px; align-items: start; }
.master-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.master-form h2 { font-size: 20px; }
.plain-list { list-style: none; padding: 0; }
.plain-list li { padding: .3rem 0; }
.inline-check { flex-direction: row !important; align-items: center; gap: .5rem !important; flex: 0 0 auto !important; align-self: center; }
.narrow-card { max-width: 32rem; margin: 1.5rem auto; }
.narrow-card--sm { max-width: 28rem; }  .narrow-card--lg { max-width: 36rem; }  .narrow-card--xl { max-width: 40rem; }
.temp-password { font-size: 1.5rem; text-align: center; }
.checkbox-cell { padding-top: 2rem; }
.bulk-actions { max-width: 36rem; }
@media (max-width: 900px) { .master-edit { grid-template-columns: 1fr; } }
@media print { .sidebar, .topbar, .tabbar, .no-print { display: none !important; } .content { padding: 0; } }
.mt-1 { margin-top: 1rem; }
