:root, [data-theme="light"] {
  --ink: #1c2430;
  --muted: #5c6b7c;
  --line: #d7dee8;
  --paper: #e8edf2;
  --card: #f7f8fa;
  --sidebar: #121820;
  --sidebar-ink: #d7deea;
  --sidebar-dim: #93a0b3;
  --sidebar-hover: #243246;
  --blue: #1e4d7b;
  --blue-ink: #fff;
  --bad: #8d2b2b;
  --good: #1d6b45;
  --warn: #8a5a12;
  --soft: #eef1f5;
  --input: #fff;
  --input-line: #c5ceda;
  --row: transparent;
  --row-line: #e6ebf1;
  --hover: #eef2f6;
  --badge: #e7edf3;
  --banner-good-bg: #e7f6ee;
  --banner-good-ink: #135236;
  --banner-bad-bg: #fdecec;
  --banner-bad-ink: #7d2424;
  --private-bg: #fdecec;
  --private-ink: #7d2424;
  --private-line: #e4b7b7;
  --banner-warn-bg: #fff6df;
  --banner-warn-ink: #6d4d10;
  --bar: #5d7690;
  --bar-2: #c4a36a;
  --shadow: 0 1px 2px rgba(18, 24, 32, 0.05);
  color-scheme: light;
}

[data-theme="dark"] {
  --ink: #e7eef6;
  --muted: #a9b6c7;
  --line: #2c3a4c;
  --paper: #10161d;
  --card: #18222d;
  --sidebar: #0c1117;
  --sidebar-ink: #d7deea;
  --sidebar-dim: #8ea0b5;
  --sidebar-hover: #243246;
  --blue: #8eb6e0;
  --blue-ink: #0e1620;
  --bad: #f0b4b4;
  --good: #9ed9b8;
  --warn: #e6c48a;
  --soft: #243140;
  --input: #101820;
  --input-line: #3a4b60;
  --row: transparent;
  --row-line: #263444;
  --hover: #223041;
  --badge: #243140;
  --banner-good-bg: #163528;
  --banner-good-ink: #c8ecd8;
  --banner-bad-bg: #3a2222;
  --banner-bad-ink: #f3d0d0;
  --private-bg: #3a2222;
  --private-ink: #f3d0d0;
  --private-line: #6d4545;
  --banner-warn-bg: #3a301c;
  --banner-warn-ink: #f3e2bc;
  --bar: #7f97b0;
  --bar-2: #c4a36a;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14.5px; line-height: 1.4; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 0.98rem; margin: 0.85rem 0 0.4rem; }
h3 { font-size: 0.84rem; margin: 0 0 0.35rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
.app { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); padding: 0.45rem 0.4rem 0.65rem; display: flex; flex-direction: column; gap: 0.28rem; position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; }
.brand { color: white; text-decoration: none; display: block; padding: 0.1rem 0.15rem 0; margin: 0 0 2.05rem; }
.brand-logo { display: block; width: 100%; height: auto; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.16rem; }
.nav-rule { display: block; height: 0; margin: 0.45rem 0.35rem 0; border-top: 1px solid rgba(215, 222, 234, 0.28); }
.nav-space { display: block; height: 0.7rem; }
.sidebar nav a, .side-foot { color: var(--sidebar-ink); text-decoration: none; padding: 0.38rem 0.5rem; border-radius: 9px; font-size: 0.92rem; display: flex; align-items: center; gap: 0.42rem; border: 1px solid transparent; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.nav-icon { width: 1rem; height: 1rem; flex: 0 0 auto; }
.sidebar nav a:hover, .side-foot:hover { background: var(--sidebar-hover); text-decoration: none; }
.sidebar nav a.active { background: #1e4d7b; color: white; border-color: #4d86bf; }
.sidebar nav a.active:hover { background: #245a8f; }
.sidebar nav a:focus, .theme-switch button:focus { outline: 2px solid #8eb6e0; outline-offset: 2px; }
.nav-count { margin-left: auto; min-width: 1.15rem; height: 1.15rem; padding: 0 0.28rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 750; line-height: 1; }
.nav-count.bad { background: #c4473a; color: #fff; }
.nav-count.warn { background: #e0a045; color: #2a1c08; }
.side-foot { margin-top: 0; color: var(--sidebar-dim); }
.settings-jump { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.settings-stack { display: flex; flex-direction: column; gap: 0.28rem; }
.settings-section { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0 0.7rem; }
.settings-section[open] { padding-bottom: 0.65rem; }
.settings-section summary { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; list-style: none; padding: 0.4rem 0; color: var(--ink); }
.settings-section summary::-webkit-details-marker { display: none; }
.settings-section summary::before { content: ""; width: 0.4rem; height: 0.4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); flex: 0 0 auto; }
.settings-section[open] summary::before { transform: rotate(45deg); }
.settings-section summary h2 { margin: 0; font-size: 0.98rem; }
.settings-section h3 { margin: 0.65rem 0 0.2rem; font-size: 0.9rem; }
.doc-edit { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.55rem 0.55rem; margin: 0.4rem 0 0.7rem; background: var(--paper); }
.profile-address, .profile-row { display: grid; gap: 0.35rem 0.45rem; margin-bottom: 0.35rem; }
.profile-address { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.25fr) minmax(3.4rem, 0.45fr) minmax(4.4rem, 0.62fr) minmax(0, 0.8fr); }
.profile-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.profile-row.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-row.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-row.docs-edit { grid-template-columns: minmax(0, 1.5fr) minmax(4.2rem, 0.45fr) minmax(0, 1fr) minmax(7.2rem, 0.8fr) minmax(7.2rem, 0.8fr); }
.profile-address > .field, .profile-row > .field { grid-column: auto; min-width: 0; }
.settings-jump a { border: 1px solid var(--line); border-radius: 7px; padding: 0.28rem 0.5rem; background: var(--paper); }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; padding: 0 0.2rem; }
.theme-switch button { background: transparent; color: var(--sidebar-dim); border: 1px solid #314158; border-radius: 7px; padding: 0.28rem 0.15rem; cursor: pointer; font-size: 0.72rem; }
.theme-switch button.on { background: var(--sidebar-hover); color: white; border-color: #5d7690; }
.content { min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 0.8rem; align-items: end; padding: 0.75rem 1rem 0.15rem; }
.eyebrow { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.1rem; }
.top-meta { color: var(--muted); text-align: right; font-size: 0.8rem; }
main { padding: 0.55rem 1rem 1.4rem; display: grid; gap: 0.65rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem 0.8rem; box-shadow: var(--shadow); position: relative; min-width: 0; max-width: 100%; transition: border-color 160ms ease, background-color 160ms ease; }
.hero { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: 0.55rem; }
.stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.62rem 0.72rem 0.68rem; box-shadow: var(--shadow); min-width: 0; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease; }
.stat:hover { transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.stat-top h2 { margin: 0; }
.stat-icon { width: 1.35rem; height: 1.35rem; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: color-mix(in srgb, var(--tone) 18%, transparent); color: var(--tone-ink); }
.stat-icon svg { width: 0.95rem; height: 0.95rem; }
.stat-label { color: var(--ink); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 650; }
.stat-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 0.15rem 0 0.1rem; color: var(--tone-ink); }
.stat-value.warn { color: var(--bad); }
.stat-value.small { font-size: 1.28rem; }
.stat-meta { color: var(--muted); font-size: 0.78rem; margin: 0; }
.stat-link { font-size: 0.82rem; font-weight: 650; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; }
.tone-ar { --tone: #0e8eb8; --tone-ink: #08384a; background: #d5f3fb; border-color: #1493c4; }
.tone-overdue { --tone: #c4473a; --tone-ink: #6e221c; background: #fde0dc; border-color: #d4655a; }
.tone-invoiced { --tone: #1d5f9e; --tone-ink: #0e3358; background: #d7e7f8; border-color: #2f6fad; }
.tone-paid { --tone: #157a45; --tone-ink: #0d4a2a; background: #d4f3e2; border-color: #1d8a52; }
.tone-expense { --tone: #b57612; --tone-ink: #5c3d08; background: #ffe8c2; border-color: #d0892b; }
.tone-po { --tone: #6d4ca8; --tone-ink: #3d2868; background: #eadff8; border-color: #7a5caf; }
.stat[class*="tone-"] .stat-label,
.stat[class*="tone-"] .stat-value,
.stat[class*="tone-"] .stat-link { color: var(--tone-ink); }
.stat[class*="tone-"] .stat-meta { color: color-mix(in srgb, var(--tone-ink) 78%, transparent); }
.stat[class*="tone-"] .stat-icon { background: color-mix(in srgb, var(--tone) 24%, white); color: var(--tone); }
[data-theme="dark"] .tone-ar { --tone: #5ad4ef; --tone-ink: #e8fbff; background: #0f3d4c; border-color: #2aa3c4; }
[data-theme="dark"] .tone-overdue { --tone: #ffb0a6; --tone-ink: #ffe8e4; background: #4a2422; border-color: #d4655a; }
[data-theme="dark"] .tone-invoiced { --tone: #8ec4f5; --tone-ink: #e7f3ff; background: #163556; border-color: #3d7eb8; }
[data-theme="dark"] .tone-paid { --tone: #7ddea8; --tone-ink: #e5ffef; background: #143c2a; border-color: #2f9a62; }
[data-theme="dark"] .tone-expense { --tone: #ffd089; --tone-ink: #fff3dd; background: #463414; border-color: #d0892b; }
[data-theme="dark"] .tone-po { --tone: #d2bef2; --tone-ink: #f6efff; background: #342454; border-color: #8d6cc4; }
[data-theme="dark"] .stat[class*="tone-"] .stat-icon { background: color-mix(in srgb, var(--tone) 22%, transparent); color: var(--tone); }
[data-theme="dark"] .dot.invoiced, [data-theme="dark"] .bar.invoiced { background: #3cb4e0; }
[data-theme="dark"] .dot.collected, [data-theme="dark"] .bar.collected { background: #3cbe78; }
.reminder-tag { display: inline-block; border-radius: 999px; padding: 0.05rem 0.42rem; font-size: 0.72rem; font-weight: 700; }
.reminder-tag.warn { background: #ffe8c2; color: #5c3d08; }
.reminder-tag.bad { background: #fde0dc; color: #6e221c; }
.help { margin-left: auto; width: 1.15rem; height: 1.15rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; padding: 0; line-height: 1; font-size: 0.72rem; flex: 0 0 auto; }
.help:focus-visible, .bar-col:focus-visible { outline: 2px solid var(--tone, var(--blue)); outline-offset: 2px; }
.help-pop { position: absolute; z-index: 4; right: 0.45rem; top: 2.15rem; max-width: 16rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.5rem; font-size: 0.78rem; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16); }
.legend { display: flex; gap: 0.8rem; font-size: 0.78rem; margin: 0.15rem 0 0.45rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.dot { width: 0.55rem; height: 0.55rem; border-radius: 2px; display: inline-block; }
.dot.invoiced, .bar.invoiced { background: #1d6fad; }
.dot.collected, .bar.collected { background: #1d8a52; }
.lines th.extra, .lines td.extra { display: none; }
.lines.show-extra th.extra, .lines.show-extra td.extra { display: table-cell; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.row-actions, .split-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.55rem; }
.btn, button.btn { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 0.18rem 0.48rem; font-size: 0.78rem; line-height: 1.2; gap: 0.25rem; width: auto; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.btn.ghost, a.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.bad { background: #8d2b2b; color: white; border-color: transparent; }
a.btn:hover, button.btn:hover, .btn:hover { text-decoration: none; color: var(--ink); background: var(--hover); }
a.btn.bad:hover, .btn.bad:hover { color: white; background: #732323; }
.profile-row > .btn, .form-grid .btn, .field > .btn, .list-head .btn { width: auto; justify-self: start; }
.tool { position: relative; width: 2.6rem; height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; padding: 0; text-decoration: none; }
.tool svg { width: 26px; height: 26px; display: block; stroke-width: 0.95; }
.tool:hover, .tool:focus-visible { color: var(--ink); background: var(--hover); }
.tool:hover::after, .tool:focus-visible::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 0.35rem); transform: translateX(-50%); background: #243140; color: white; font-size: 0.72rem; line-height: 1.2; padding: 0.22rem 0.4rem; border-radius: 4px; white-space: nowrap; z-index: 30; pointer-events: none; }
.tools, .acct-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.55rem; }
.acct-tools { margin-bottom: 0.35rem; width: max-content; max-width: 100%; }
form.acct-tools { margin: 0; }
.acct-tools .field { margin: 0; width: auto; }
.acct-year { display: inline-flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0; width: auto; color: var(--ink); font-size: 0.84rem; white-space: nowrap; }
.acct-year select { width: 5.4rem; height: 2.6rem; min-width: 0; padding: 0 0.4rem 0 0.55rem; border-radius: 8px; }
.profile-row > .btn, .profile-row > a.btn { width: max-content; max-width: 100%; justify-self: start; align-self: center; }
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0.32rem 0.35rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 0.38rem 0.35rem; border-bottom: 1px solid var(--row-line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--hover); }
.table-wrap tbody tr:nth-child(odd of :has(td)) td { background: #ffffff; color: #1c2430; }
.table-wrap tbody tr:nth-child(even of :has(td)) td { background: #e8edf2; color: #1c2430; }
.table-wrap tbody tr:hover td { background: #d5e0ec; color: #1c2430; }
.table-wrap tbody td a { color: #1a4f86; }
.table-wrap tbody td .btn, [data-theme="dark"] .table-wrap tbody td .btn { color: #1c2430; background: #fff; border-color: #c5ced8; }
.table-wrap tbody td .btn.ghost, [data-theme="dark"] .table-wrap tbody td .btn.ghost { color: #1c2430; background: #fff; border-color: #8d97a6; }
.table-wrap tbody td .tool, [data-theme="dark"] .table-wrap tbody td .tool { color: #3d4c5c; }
.table-wrap table.lines tbody tr td,
.table-wrap table.pick-lines tbody tr td,
.table-wrap table.estimate-costs tbody tr td,
.table-wrap table.cost-lines tbody tr td { background: transparent; color: inherit; }
.invoice-table th.fit, .invoice-table td.fit { width: 1%; white-space: nowrap; }
.badge { display: inline-block; border-radius: 999px; padding: 0.05rem 0.42rem; font-size: 0.72rem; background: var(--badge); color: var(--ink); }
.badge.overdue, .badge.bad { background: color-mix(in srgb, var(--bad) 18%, var(--card)); color: var(--bad); }
.badge.paid, .badge.good { background: color-mix(in srgb, var(--good) 18%, var(--card)); color: var(--good); }
.badge.partial, .badge.warn, .badge.soon { background: color-mix(in srgb, var(--warn) 20%, var(--card)); color: var(--warn); }
.badge.estimated { background: color-mix(in srgb, var(--bar-2) 25%, var(--card)); color: var(--warn); }
.invoice-summary { display: grid; gap: 0.35rem; margin-bottom: 0.55rem; }
.collect-bar { display: flex; height: 0.5rem; border-radius: 999px; overflow: hidden; background: #d5dde6; }
.collect-bar .seg.collected { background: #1d8a52; }
.collect-bar .seg.outstanding { background: #d0892b; }
.collect-bar .seg.overdue { background: #c4473a; }
.collect-bar .seg.empty { flex: 1 1 auto; background: #d5dde6; }
.collect-legend { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.seg-link { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.16rem 0.5rem; color: var(--ink); background: var(--paper); font-size: 0.78rem; }
.seg-link strong { font-variant-numeric: tabular-nums; }
.seg-link .swatch { width: 0.55rem; height: 0.55rem; border-radius: 2px; background: currentColor; }
.seg-link.collected .swatch { background: #1d8a52; }
.seg-link.outstanding .swatch { background: #d0892b; }
.seg-link.overdue .swatch { background: #c4473a; }
.seg-link.on { box-shadow: inset 0 0 0 2px #1c2430; font-weight: 700; }
.invoice-query { display: flex; flex-wrap: wrap; gap: 0.4rem 0.55rem; align-items: end; width: 100%; max-width: 100%; min-width: 0; margin: 0.15rem 0 0.55rem; }
.invoice-query .field { flex: 0 1 auto; width: auto; min-width: 0; max-width: 100%; }
.invoice-query .period-field { flex-basis: 9.6rem; }
.invoice-query .period-month { flex-basis: 8.6rem; }
.invoice-query .period-year { flex-basis: 6.2rem; }
.invoice-query .period-range { flex-basis: 9.4rem; }
.invoice-query .period-search { flex: 1 1 12rem; min-width: 0; }
.invoice-query .period-basis { flex: 0 0 auto; margin: 0 0 0.42rem; font-size: 0.75rem; color: var(--muted); }
.invoice-query .btn { flex: 0 0 auto; }
.invoice-query input, .invoice-query select { min-width: 0; max-width: 100%; }
.invoice-query .field[hidden] { display: none; }
.invoice-results { margin: 0.15rem 0 0.45rem; font-size: 0.86rem; }
.invoice-results strong { font-variant-numeric: tabular-nums; }
.invoice-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
@media (max-width: 1100px) {
  .invoice-query .period-search { flex-basis: 100%; }
}
@media (max-width: 720px) {
  .invoice-query .field { flex-basis: calc(50% - 0.4rem); }
  .invoice-query .period-search, .invoice-query .period-basis { flex-basis: 100%; }
}
@media (max-width: 480px) {
  .invoice-query .field, .invoice-query .period-search, .invoice-query .btn { flex-basis: 100%; }
}
.invoice-filters a { border: 1px solid var(--line); border-radius: 999px; padding: 0.22rem 0.6rem; color: var(--ink); background: var(--paper); }
.invoice-filters a.on { background: var(--sidebar); color: white; border-color: var(--sidebar); }
.invoice-filters a span { font-variant-numeric: tabular-nums; }
.invoice-table thead th { color: var(--muted); background: transparent; }
.invoice-table thead th a { color: inherit; font-weight: 650; }
.invoice-table thead th .arrow { margin-left: 0.28rem; }
.invoice-table td.memo { min-width: 16rem; width: 32%; }
.invoice-table td.memo span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.invoice-table tbody tr:nth-child(odd) td { background: #ffffff; color: #1c2430; }
.invoice-table tbody tr:nth-child(even) td { background: #e8edf2; color: #1c2430; }
.invoice-table tbody td a { color: #1a4f86; }
.invoice-table tbody tr:hover td { background: #d5e0ec; color: #1c2430; }
.invoice-table .badge { background: #e7edf3; color: #1c2430; }
.invoice-table .badge.open { background: #e4eef8; color: #163e66; }
.invoice-table .badge.partial { background: #fff1d6; color: #6d4d10; }
.invoice-table .badge.paid { background: #d9f2e4; color: #135236; }
.invoice-table .badge.overdue { background: #fde2e0; color: #7d2424; }
.invoice-table .badge.void { background: #eceff3; color: #1c2430; box-shadow: inset 0 0 0 1px #8d97a6; }
.invoice-table .badge.unmatched { background: #eceff3; color: #1c2430; }
.invoice-table .badge.suggested { background: #fff1d6; color: #6d4d10; }
.invoice-table .badge.matched { background: #d9f2e4; color: #135236; }
.invoice-table th.invoice-pay, .invoice-table td.invoice-pay { width: 1%; white-space: nowrap; text-align: right; }
.pay-btn { padding: 0.18rem 0.45rem; font-size: 0.75rem; line-height: 1.2; }
.pay-due-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.4rem; flex-wrap: wrap; }
.pay-modal { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem 0.75rem; width: min(26rem, calc(100vw - 1.25rem)); background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28); }
.pay-modal::backdrop { background: rgba(10, 16, 24, 0.48); }
.pay-modal h2 { margin: 0 0 0.15rem; font-size: 1.02rem; }
.pay-who, .pay-balance { margin: 0.1rem 0 0.2rem; }
.pay-error { margin: 0.3rem 0; }
.pay-grid { display: flex; flex-wrap: wrap; gap: 0.4rem 0.55rem; align-items: end; }
.pay-grid .field { flex: 1 1 8.2rem; width: auto; }
.pay-grid .pay-method { flex: 1 1 12rem; }
.pay-note { margin-top: 0.4rem; }
.pay-note .field { width: 100%; }
.pay-modal textarea { width: 100%; min-height: 2.5rem; }
.pay-modal .row-actions { margin-top: 0.5rem; justify-content: flex-end; }
.invoice-table tbody td .btn, [data-theme="dark"] .invoice-table tbody td .btn { color: #1c2430; background: #fff; border-color: #c5ced8; }
.invoice-table tbody td .btn.ghost, [data-theme="dark"] .invoice-table tbody td .btn.ghost { color: #1c2430; background: #fff; border-color: #8d97a6; }
.invoice-table tbody td .tool, [data-theme="dark"] .invoice-table tbody td .tool { color: #3d4c5c; }
.tool.pay-btn { padding: 0; }
.bank-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.45rem 0.75rem; margin: 0.15rem 0 0.55rem; }
.bank-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.35rem 0.45rem; margin: 0; flex: 1 1 32rem; min-width: 0; }
.bank-filters label { display: flex; flex-direction: column; gap: 0.12rem; margin: 0; font-size: 0.72rem; color: var(--muted); width: auto; }
.bank-filters .field { margin: 0; width: 12.5rem; max-width: 100%; flex: 1 1 10rem; grid-column: auto; }
.bank-filters select, .bank-filters input { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.32rem 0.45rem; }
.bank-year select { width: 6.4rem; }
.bank-month select { width: 7.2rem; }
.bank-flow select { width: 9.2rem; }
.bank-status select { width: 8.8rem; }
.bank-filters a.btn.on { background: #1e4d7b; color: #fff; border-color: #1e4d7b; }
.bank-side { display: flex; align-items: flex-end; gap: 0.35rem; margin-left: auto; }
.bank-import { display: flex; align-items: flex-end; gap: 0.2rem; margin: 0; }
.bank-file { position: relative; display: inline-flex; align-items: center; height: 2.15rem; max-width: 11rem; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-size: 0.78rem; cursor: pointer; }
.bank-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-file input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.bank-match { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.25rem; }
.bank-match form { display: inline; }
.bank-match p { margin: 0; }
[data-theme="dark"] .invoice-table tbody tr:nth-child(odd) td { background: #ffffff; color: #1c2430; }
[data-theme="dark"] .invoice-table tbody tr:nth-child(even) td { background: #e8edf2; color: #1c2430; }
[data-theme="dark"] .invoice-table tbody td a { color: #1a4f86; }
[data-theme="dark"] .invoice-table tbody tr:hover td { background: #d5e0ec; color: #1c2430; }
[data-theme="dark"] .seg-link.on { box-shadow: inset 0 0 0 2px #e7eef6; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.4rem 0.55rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: 0.18rem; grid-column: span 4; min-width: 0; }
.field.s2 { grid-column: span 2; }
.field.s3 { grid-column: span 3; }
.field.s4 { grid-column: span 4; }
.field.s5 { grid-column: span 5; }
.field.s6 { grid-column: span 6; }
.field.s8 { grid-column: span 8; }
.field.s12, .field.wide { grid-column: span 12; }
.profile-address > .field,
.profile-address > .field.s2,
.profile-address > .field.s3,
.profile-address > .field.s4,
.profile-address > .field.s5,
.profile-address > .field.s6,
.profile-row > .field,
.profile-row > .field.s2,
.profile-row > .field.s3,
.profile-row > .field.s4,
.profile-row > .field.s5,
.profile-row > .field.s6 { grid-column: auto; }
.field span, .check-field > span:first-child { font-size: 0.75rem; color: var(--muted); }
.field-hint { color: var(--muted); font-size: 0.75rem; line-height: 1.3; }
input, select, textarea { border: 1px solid var(--input-line); border-radius: 7px; padding: 0.36rem 0.48rem; background: var(--input); width: 100%; }
textarea { resize: vertical; min-height: 2.3rem; }
textarea.autogrow { overflow: hidden; }
.lines input, .lines select { min-width: 0; }
.banner { border-radius: 8px; padding: 0.5rem 0.7rem; }
.banner.good { background: var(--banner-good-bg); color: var(--banner-good-ink); }
.banner.bad { background: var(--banner-bad-bg); color: var(--banner-bad-ink); }
.banner.sim, .banner.warn { background: var(--banner-warn-bg); color: var(--banner-warn-ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr); gap: 0.7rem; align-items: start; }
iframe.pdf { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.45rem; align-items: end; min-height: 148px; }
.dash-charts { align-items: stretch; }
.dash-charts .card { min-width: 0; }
.dash-charts .row-actions { margin-top: 0; }
.year-bars { grid-template-columns: repeat(auto-fit, minmax(1.65rem, 1fr)); gap: 0.12rem; }
.year-bars .bar { width: 12px; }
.year-bars .bar-col { height: 178px; }
.year-bars .bar-pair { height: 112px; }
.year-bars .bar-name { font-size: 0.68rem; line-height: 1; writing-mode: vertical-rl; height: 2.7rem; margin: 0 auto; }
.bar-col { position: relative; display: flex; flex-direction: column; justify-content: end; gap: 0.25rem; height: 148px; cursor: pointer; border-radius: 8px; padding: 0.2rem; }
.bar-col:hover, .bar-col:focus-within, .bar-col.pinned { background: var(--hover); }
.bar-pair { display: flex; gap: 4px; align-items: end; justify-content: center; height: 112px; }
.bar { width: 14px; border-radius: 4px 4px 0 0; background: var(--bar); transform-origin: bottom; animation: rise 420ms ease both; animation-delay: calc(var(--i, 0) * 40ms); transition: height 280ms ease; }
.bar-name { text-align: center; font-size: 0.75rem; color: var(--ink); }
.bar-tip { position: absolute; left: 50%; bottom: calc(100% - 8px); transform: translateX(-50%); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.45rem; font-size: 0.72rem; width: max-content; max-width: 14rem; opacity: 0; pointer-events: none; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16); transition: opacity 140ms ease; }
.bar-col:first-child .bar-tip { left: 0; transform: none; }
.bar-col:last-child .bar-tip { left: auto; right: 0; transform: none; }
.bar-col:hover .bar-tip, .bar-col:focus-within .bar-tip, .bar-col.pinned .bar-tip { opacity: 1; }
@keyframes rise { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
.checks { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; }
.check { display: flex; gap: 0.35rem; align-items: center; min-height: 2.05rem; }
.check input { width: auto; }
.check-field .check { align-items: center; }
.contact { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.55rem 0.6rem; margin-bottom: 0.45rem; }
.contact-sheet { max-width: 67rem; }
.contact-head, .contact-row {
  display: grid;
  grid-template-columns: 140px 200px 300px 140px 140px 5.6rem;
  gap: 0.35rem 0.45rem;
  align-items: start;
  justify-content: start;
}
.contact-head { color: var(--muted); font-size: 0.72rem; padding: 0 0.05rem 0.15rem; }
.contact-row { margin-bottom: 0.35rem; }
.contact-row label { display: block; min-width: 0; }
.contact-row input { min-width: 0; width: 100%; padding: 0.28rem 0.4rem; }
.contact-row .row-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.contact-row .btn { white-space: nowrap; }
.area-cell { position: relative; }
.area-menu { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% - 0.05rem); margin: 0; padding: 0.15rem 0; list-style: none; background: var(--input); color: var(--ink); border: 1px solid var(--input-line); border-radius: 7px; max-height: 11rem; overflow: auto; box-shadow: var(--shadow); }
.area-option { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); padding: 0.32rem 0.5rem; cursor: pointer; font-size: 0.86rem; }
.area-option:hover, .area-option.on { background: var(--hover); }
.hint { display: block; color: var(--muted); font-size: 0.72rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; align-items: start; }
.place { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(3.2rem, 0.45fr) minmax(4.2rem, 0.6fr); gap: 0.4rem 0.55rem; }
.place .field { grid-column: auto; }
.pay-box { background: #172033; color: white; border-radius: 10px; padding: 0.8rem; }
.pay-box strong { font-size: 1.6rem; display: block; }
.disabled-note { background: var(--soft); color: var(--ink); border-radius: 8px; padding: 0.65rem; }
.fold { border-top: 1px solid var(--line); margin-top: 0.55rem; padding-top: 0.35rem; }
.fold summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.swatches { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.45rem; }
.swatch { border-radius: 8px; padding: 0.55rem 0.7rem; border: 1px solid var(--line); }
.swatch img { display: block; width: 140px; height: auto; }
.swatch.light { background: #f4f6f8; }
.swatch.dark { background: #10161d; }
.period-pick { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.4rem 0.55rem; align-items: end; }
.period-pick .field { grid-column: auto; }
.period-pick .field.s2 { grid-column: span 2; }
.period-pick .field.s3 { grid-column: span 3; }
.period-pick .field.s4 { grid-column: span 4; }
.period-now { font-size: 1.05rem; font-weight: 680; margin: 0.55rem 0 0.45rem; }
.stats.tax-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tax-return { margin-top: 0.7rem; }
.tax-split { display: grid; grid-template-columns: minmax(17rem, 24rem) minmax(0, 1fr); gap: 0.55rem 1rem; align-items: start; }
.tax-summary-side .tax-lines { max-width: none; margin: 0 0 0.45rem; }
.tax-lines { display: grid; gap: 0.18rem; max-width: 26rem; margin: 0.35rem 0 0.5rem; }
.tax-lines div { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.86rem; align-items: center; }
.tax-lines strong { font-variant-numeric: tabular-nums; }
.allowance-line { justify-content: flex-start; }
.allowance-line strong { margin-left: auto; }
.allowance-toggle { min-height: 0; flex: 0 0 auto; }
.allowance-toggle input { width: auto; margin: 0; padding: 0; }
.tax-lines .net-due { background: var(--soft); border-radius: 6px; padding: 0.22rem 0.4rem; font-weight: 650; }
.tax-lines .net-due strong { font-size: 1.02rem; }
.tax-adjust { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 0 0.6rem; min-width: 0; color: var(--ink); }
.tax-adjust[open] { padding-bottom: 0.5rem; }
.tax-adjust summary { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; list-style: none; min-height: 2rem; font-size: 0.9rem; }
.tax-adjust summary::-webkit-details-marker { display: none; }
.tax-adjust summary::before { content: ""; width: 0.4rem; height: 0.4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); flex: 0 0 auto; }
.tax-adjust[open] summary::before { transform: rotate(45deg); }
.adjusted-flag { margin-left: auto; font-size: 0.68rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tax-adjust-grid { display: grid; gap: 0.28rem 0.45rem; }
.allowance-edit { display: grid; grid-template-columns: minmax(0, 9rem) auto; gap: 0.35rem; align-items: end; justify-content: start; }
.allowance-edit .btn { width: auto; justify-self: start; white-space: nowrap; }
.tax-adjust-grid > .field,
.tax-adjust-grid > .field.s4,
.tax-adjust-grid > .field.s8,
.tax-adjust-grid > .field.s12,
.allowance-edit > .field,
.allowance-edit > .field.s4 { grid-column: auto; min-width: 0; }
.tax-adjust-grid > .field.s12 { grid-column: 1 / -1; }
.tax-adjust-grid .hint { margin: 0; }
.tax-adjust input { padding: 0.28rem 0.4rem; }
.tax-return .check-field { grid-column: 1 / -1; width: auto; }
.chart-year { display: flex; gap: 0.4rem; align-items: end; }
.chart-year .field { grid-column: auto; width: 6.5rem; }
.tax-chart { overflow-x: auto; }
.tax-bars { grid-template-columns: repeat(12, minmax(3.4rem, 1fr)); min-width: 44rem; }
.tax-bars .bar-col { height: 188px; color: inherit; text-decoration: none; }
.tax-bars .bar { width: 6px; }
.tax-bars .bar.metric-tax, .dot.metric-tax { background: #1d6fad; }
.tax-bars .bar.metric-allowance, .dot.metric-allowance { background: #d0892b; }
.tax-bars .bar.metric-penalty, .dot.metric-penalty { background: #d4655a; }
.tax-bars .bar.metric-paid, .dot.metric-paid { background: #1d8a52; }
[data-theme="dark"] .tax-bars .bar.metric-tax, [data-theme="dark"] .dot.metric-tax { background: #3cb4e0; }
[data-theme="dark"] .tax-bars .bar.metric-allowance, [data-theme="dark"] .dot.metric-allowance { background: #e6c48a; }
[data-theme="dark"] .tax-bars .bar.metric-penalty, [data-theme="dark"] .dot.metric-penalty { background: #f0a097; }
[data-theme="dark"] .tax-bars .bar.metric-paid, [data-theme="dark"] .dot.metric-paid { background: #5cbf86; }
.tax-bars .bar.paid { background: #1d8a52; }
.tax-bars .bar.partial { background: #c4892a; }
.tax-bars .bar.pending { background: #2f6fad; }
.tax-bars .bar.none { background: var(--line); }
.tax-bars .bar-col.on { outline: 2px solid var(--blue); }
.tax-bars .bar-tip { max-width: 16rem; white-space: normal; }
.bar-status { text-align: center; font-size: 0.62rem; color: var(--muted); line-height: 1.15; }
.dot.tax-paid { background: #1d8a52; }
.dot.tax-partial { background: #c4892a; }
.dot.tax-pending { background: #2f6fad; }
.dot.tax-none { background: var(--line); }
[data-theme="dark"] .tax-bars .bar.paid, [data-theme="dark"] .dot.tax-paid { background: #5cbf86; }
[data-theme="dark"] .tax-bars .bar.partial, [data-theme="dark"] .dot.tax-partial { background: #e6c48a; }
[data-theme="dark"] .tax-bars .bar.pending, [data-theme="dark"] .dot.tax-pending { background: #6aa6e0; }
.reason-list { margin-top: 0.45rem; }
.invoice-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "notes side" "ways margin"; gap: 0.7rem 1rem; align-items: start; margin-top: 0.45rem; }
.invoice-notes { grid-area: notes; }
.invoice-notes .field { grid-column: auto; }
.invoice-side { grid-area: side; justify-self: end; width: min(26rem, 100%); min-width: 0; }
.invoice-foot > .ways { grid-area: ways; margin-top: 0; }
.invoice-foot > .internal-margin { grid-area: margin; margin-top: 0; width: 100%; }
.money-stack { width: 100%; display: grid; gap: 0.16rem; }
.internal-margin { margin-top: 0.35rem; background: var(--private-bg); border: 1px solid var(--private-line); color: var(--ink); border-radius: 8px; padding: 0.45rem 0.55rem 0.5rem; min-width: 0; }
.internal-margin h2 { margin: 0 0 0.22rem; font-size: 0.84rem; color: var(--private-ink); }
.internal-margin .field { grid-column: auto; gap: 0.08rem; }
.internal-margin .field span { font-size: 0.7rem; }
.internal-margin .stat-meta, .internal-margin .money-line span { color: var(--ink); }
.internal-margin .money-line em { font-style: normal; color: var(--private-ink); font-size: 0.72rem; margin-left: 0.2rem; }
.internal-margin .money-stack { gap: 0.04rem; }
.internal-margin .money-line { gap: 0.4rem; font-size: 0.82rem; }
.internal-margin .row-actions { margin: 0.15rem 0 0.28rem; }
.internal-margin textarea { min-height: 0; padding: 0.18rem 0.35rem; line-height: 1.25; font-size: 0.82rem; }
.costs-complete { margin: 0.12rem 0 0.2rem; min-height: 0; font-size: 0.8rem; }
.internal-margin .table-wrap { overflow: visible; }
.estimate-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem); gap: 0.35rem 0.8rem; margin-top: 0.3rem; align-items: start; }
.estimate-foot > .doc-notes { grid-column: 1; min-width: 0; }
.estimate-foot > .money-stack { grid-column: 2; }
.estimate-foot > .internal-margin { grid-column: 1 / -1; }
.doc-sheet { display: grid; gap: 0.22rem; min-width: 0; }
.row-actions.doc-back, .row-actions.doc-link { margin: 0; }
.doc-card { padding: 0.4rem 0.7rem 0.5rem; }
.doc-card > h2, .doc-card > .stat-top { margin: 0.16rem 0 0.08rem; }
.doc-card > .fold { margin-top: 0.15rem; padding-top: 0.12rem; }
.doc-warn { margin: 0.15rem 0 0; }
.doc-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-start; gap: 0.28rem 0.45rem; min-width: 0; }
.doc-head > .field { flex: 0 0 auto; width: auto; min-width: 0; position: relative; }
.doc-head > .field.doc-number { width: 10rem; }
.doc-head > .field.doc-party { flex: 1 1 16rem; width: auto; min-width: min(100%, 12rem); max-width: 22rem; }
.doc-head > .field.doc-date { width: 9.5rem; }
.doc-head > .field.doc-po { width: 11.5rem; }
.doc-head > .field.doc-terms { width: 12rem; }
.doc-head > .field.doc-status { width: 9.4rem; }
.doc-head > .field > span, .doc-notes .field > span, .invoice-notes .field > span { display: flex; align-items: center; gap: 0.25rem; }
.doc-head .help, .doc-notes .help, .invoice-notes .help { margin-left: 0.12rem; }
.doc-head .help-pop, .doc-notes .help-pop, .invoice-notes .help-pop { left: 0; right: auto; top: 1.4rem; width: min(18rem, 72vw); color: var(--ink); background: var(--card); z-index: 8; }
.doc-head input, .doc-head select { min-width: 0; width: 100%; max-width: 100%; padding: 0.28rem 0.4rem; }
.doc-notes textarea, .invoice-notes textarea, .po-address textarea { min-height: 0; line-height: 1.35; }
.doc-notes .field, .invoice-notes .field { position: relative; min-width: 0; }
.doc-sheet .invoice-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 0.3rem 0.5rem; margin: 0; }
.doc-sheet .invoice-find { display: flex; flex: 1 1 16rem; max-width: 32rem; align-items: end; gap: 0.4rem; min-width: 0; }
.doc-sheet .invoice-find > .field { flex: 1 1 12rem; min-width: 0; }
.doc-sheet .plain { margin: 0.05rem 0; }
.estimate-margin { width: min(100%, 52%); }
.estimate-costs { width: 100%; table-layout: fixed; }
.estimate-costs th:nth-child(1), .estimate-costs td:nth-child(1) { width: 26%; }
.estimate-costs th:nth-child(2), .estimate-costs td:nth-child(2) { width: 42%; }
.estimate-costs th:nth-child(3), .estimate-costs td:nth-child(3) { width: 16%; }
.estimate-costs th:nth-child(4), .estimate-costs td:nth-child(4) { width: 16%; }
.estimate-costs th, .estimate-costs td { vertical-align: top; padding: 0.2rem 0.28rem; }
.estimate-costs th:last-child, .estimate-costs td:last-child { width: 16%; text-align: left; }
.estimate-costs select, .estimate-costs input { width: 100%; min-width: 0; box-sizing: border-box; }
.concept-stack { display: grid; gap: 0.28rem; min-width: 0; }
.concept-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.28rem; min-width: 0; }
.estimate-costs .concept-line > input { flex: 1 1 7rem; width: auto; min-width: 0; }
.cost-link { display: grid; gap: 0.16rem; min-width: 0; }
.cost-link-tools { display: flex; align-items: center; gap: 0.12rem; flex: 0 0 auto; }
.estimate-costs .link-btn { width: auto; padding: 0.12rem 0.4rem; font-size: 0.75rem; line-height: 1.2; min-height: 0; }
.cost-link .icon-btn { width: 1.35rem; height: 1.35rem; }
.cost-link .link-edit:hover { color: var(--ink); background: var(--hover); }
.cost-url { display: grid; gap: 0.08rem; min-width: 0; }
.cost-url > span { font-size: 0.72rem; color: var(--muted); }
.cost-url-row { display: flex; align-items: center; gap: 0.28rem; min-width: 0; }
.estimate-costs .cost-url-row input { flex: 1 1 8rem; width: auto; min-width: 0; }
.cost-url-error { margin: 0; color: var(--bad); font-size: 0.75rem; }
.cost-link-tools[hidden], .cost-url[hidden], .cost-url-error[hidden], .cost-link-tools [hidden] { display: none !important; }
.estimate-costs td[data-label="Remove"] { white-space: nowrap; }
.estimate-costs .btn { width: auto; max-width: 100%; }
.cost-lines { width: 100%; table-layout: fixed; }
.cost-lines th, .cost-lines td { padding: 0.16rem 0.22rem; vertical-align: top; }
.cost-lines th:nth-child(1), .cost-lines td:nth-child(1) { width: 22%; }
.cost-lines th:nth-child(2), .cost-lines td:nth-child(2) { width: 16%; }
.cost-lines th:nth-child(4), .cost-lines td:nth-child(4) { width: 6.6rem; }
.cost-lines td:nth-child(3) input { text-overflow: ellipsis; }
.po-cost-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 0.4rem 0.5rem; }
.vq-import { display: grid; gap: 0.45rem; margin-top: 0.7rem; }
.cost-ref { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; }
.cost-ref .hint { flex-basis: 100%; }
.po-line-picker { flex: 1 1 100%; display: grid; gap: 0.35rem; }
.po-pick { display: grid; grid-template-columns: auto minmax(0, 1fr) 6.4rem; gap: 0.15rem 0.4rem; align-items: center; }
.po-pick small { grid-column: 2 / 3; color: var(--muted); }
.po-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-cost-actions .field { flex: 1 1 12rem; min-width: min(100%, 12rem); margin: 0; }
.po-cost-actions .btn { flex: 0 0 auto; }
.internal-margin .btn:disabled, .internal-margin select:disabled { opacity: 0.55; cursor: not-allowed; }
.vendor-cell { position: relative; }
.vendor-menu { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% - 0.1rem); margin: 0; padding: 0.15rem 0; list-style: none; background: var(--input); color: var(--ink); border: 1px solid var(--input-line); border-radius: 7px; max-height: 11rem; overflow: auto; box-shadow: var(--shadow); }
.vendor-option { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); padding: 0.32rem 0.5rem; cursor: pointer; font-size: 0.86rem; }
.vendor-option:hover, .vendor-option.on { background: var(--hover); }
.po-ref a { white-space: nowrap; }
.po-address { display: grid; grid-template-columns: 1fr 1fr; gap: 0.28rem 0.5rem; margin-top: 0.2rem; }
.po-address > .field { grid-column: auto; }
.po-address > .field.s12 { grid-column: 1 / -1; }
.po-address textarea { min-height: 0; }
.po-lines { table-layout: fixed; }
.po-lines th:nth-child(1), .po-lines td:nth-child(1) { width: 18%; }
.po-lines th:nth-child(2), .po-lines td:nth-child(2) { width: 42%; }
.po-lines th:nth-child(3), .po-lines td:nth-child(3) { width: 9%; }
.po-lines th:nth-child(4), .po-lines td:nth-child(4) { width: 12%; }
.po-lines th:nth-child(5), .po-lines td:nth-child(5) { width: 13%; }
.po-lines th:nth-child(6), .po-lines td:nth-child(6) { width: 6%; }
.po-lines td:nth-child(3) input, .po-lines td:nth-child(4) input { text-align: right; }
.po-foot { display: flex; justify-content: flex-end; margin: 0.15rem 0 0.45rem; }
.po-foot .money-stack { width: min(16rem, 100%); }
.pick-lines input { width: 100%; min-width: 0; }
.pick-lines td:nth-child(1) { width: 2rem; }
.pick-lines td:nth-child(3), .pick-lines td:nth-child(5) { width: 7rem; }
.pick-lines td:nth-child(4) { width: 6rem; }
.cost-lines th:last-child, .cost-lines td:last-child { width: 1.8rem; text-align: right; }
.cost-lines input { min-width: 0; width: 100%; padding: 0.28rem 0.4rem; font-size: 0.86rem; }
.internal-margin .icon-btn { width: 1.45rem; height: 1.45rem; }
.internal-margin .icon-btn svg { width: 0.85rem; height: 0.85rem; }
.margin-pair { display: inline-flex; gap: 0.4rem; justify-content: flex-end; }
.money-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem; align-items: baseline; }
.money-line strong { font-variant-numeric: tabular-nums; text-align: right; }
.money-line.sub { color: var(--muted); font-size: 0.84rem; padding-left: 0.65rem; }
.money-line.emphasis { font-weight: 700; padding-top: 0.22rem; margin-top: 0.12rem; border-top: 1px solid var(--line); }
.ways { margin-top: 0.55rem; }
.ways h2 { font-size: 0.95rem; margin: 0 0 0.25rem; }
.ways p { margin: 0.15rem 0; }
.wire { margin: 0.35rem 0; font-family: inherit; font-size: 0.86rem; white-space: pre-wrap; }
.list-head { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; align-items: end; justify-content: space-between; }
.list-head h2 { margin: 0; }
.party-board { padding-bottom: 0.7rem; }
.party-board .list-head { margin-bottom: 0.35rem; }
.party-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.45rem; }
.party-cards.recent-row { margin-top: 0; }
.party-card {
  display: grid;
  gap: 0.08rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.party-card:hover { background: var(--hover); text-decoration: none; color: inherit; }
.party-card strong { overflow-wrap: anywhere; }
.party-card span { color: var(--muted); font-size: 0.75rem; }
.party-card b { font-variant-numeric: tabular-nums; }
.party-card.overdue { background: #f8d4d0; border-color: #c4473a; }
.party-card.current { background: #cfeedd; border-color: #1f9d5a; }
.party-card.missing { background: #e8edf3; border-color: #7b8ea3; }
.party-card.overdue:hover { background: #f4c3bd; }
.party-card.current:hover { background: #bce6cf; }
.party-card.missing:hover { background: #dde4ec; }
.status-tag {
  display: inline-flex;
  align-self: start;
  width: fit-content;
  margin: 0.1rem 0 0.12rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.status-tag.overdue { background: #c4473a; color: #fff; }
.status-tag.current { background: #1f9d5a; color: #fff; }
.status-tag.missing { background: #5c6b7c; color: #fff; }
[data-theme="dark"] .party-card.overdue { background: #5a2420; border-color: #ef6f62; color: #ffe8e5; }
[data-theme="dark"] .party-card.current { background: #184a31; border-color: #3dce7e; color: #e4ffe9; }
[data-theme="dark"] .party-card.missing { background: #2a3644; border-color: #8ea0b5; }
[data-theme="dark"] .party-card.overdue:hover { background: #6b2d28; }
[data-theme="dark"] .party-card.current:hover { background: #1d5a3b; }
[data-theme="dark"] .party-card.missing:hover { background: #334253; }
[data-theme="dark"] .status-tag.overdue { background: #ef6f62; color: #2a0f0c; }
[data-theme="dark"] .status-tag.current { background: #3dce7e; color: #062214; }
[data-theme="dark"] .status-tag.missing { background: #a9b6c7; color: #121820; }
.form-back { margin: 0 0 0.35rem; }
.leave-dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 0.95rem; background: var(--card); color: var(--ink); box-shadow: var(--shadow); max-width: 24rem; }
.leave-dialog::backdrop { background: rgba(12, 17, 23, 0.45); }
.leave-dialog p { margin: 0 0 0.7rem; }
.customer-search { display: flex; gap: 0.4rem; align-items: end; margin: 0.35rem 0 0.1rem; }
.customer-search .field { grid-column: auto; min-width: 14rem; flex: 1; }
.customer-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); gap: 0.75rem 1rem; align-items: start; }
.vendor-workspace { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 0.7rem; align-items: start; }
.vendor-main { min-width: 0; }
.vendor-index { position: sticky; top: 0.4rem; padding: 0.55rem; }
.vendor-index .field { grid-column: auto; margin: 0.45rem 0; }
.vendor-links { display: grid; gap: 0.1rem; max-height: 22rem; overflow: auto; }
.vendor-link { display: block; padding: 0.28rem 0.4rem; border-radius: 6px; color: inherit; text-decoration: none; }
.vendor-link.on, .vendor-link:hover { background: var(--hover); text-decoration: none; color: inherit; }
.vendor-extra { display: grid; gap: 0.2rem; margin: 0.55rem 0 0; font-size: 0.78rem; }
.vendor-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.15rem 0 0.45rem; }
.vendor-tabs a { padding: 0.25rem 0.5rem; border-radius: 7px; color: var(--muted); text-decoration: none; }
.vendor-tabs a.on { background: var(--hover); color: var(--ink); font-weight: 650; }
.txn-actions form { display: inline; }
.customer-summary h2 { margin: 0; font-size: 1.15rem; }
.customer-contact { margin: 0.35rem 0 0.45rem; }
.address-pair h3 { margin-top: 0; }
.summary-money { border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.65rem; background: var(--paper); }
.summary-money h3 { margin: 0 0 0.35rem; }
.overdue-balance, .overdue-balance span, .overdue-balance strong { color: var(--bad); }
.txn-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: end; margin: 0.15rem 0 0.55rem; }
.txn-filters .field { grid-column: auto; width: 10.5rem; flex: 0 1 11rem; }
.txn-filters .field:first-of-type { flex: 1 1 16rem; width: auto; min-width: 12rem; }
.sort-col a { color: inherit; text-decoration: none; display: inline-flex; gap: 0.25rem; align-items: center; }
.sort-col a:hover { text-decoration: underline; }
.sort-col a:focus-visible, .pager a:focus-visible, .txn-filters a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pager { display: flex; gap: 0.7rem; align-items: center; margin-top: 0.45rem; font-size: 0.82rem; }
.pager a { color: inherit; }
.txn-menu { position: relative; }
.txn-menu > summary { list-style: none; cursor: pointer; }
.txn-menu > summary::-webkit-details-marker { display: none; }
.txn-menu[open] > div { position: absolute; z-index: 4; right: 0; top: calc(100% + 0.25rem); min-width: 11rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.25rem; display: grid; box-shadow: var(--shadow); }
.txn-menu a { padding: 0.35rem 0.5rem; border-radius: 6px; color: var(--ink); }
.txn-menu a:hover { background: var(--hover); text-decoration: none; }
.txn-actions { white-space: nowrap; }
.txn-actions a + a { margin-left: 0.45rem; }
.customer-details > summary { font-weight: 650; cursor: pointer; }
.payment-view .money-stack { max-width: 22rem; margin: 0.45rem 0 0.7rem; }
.search { display: flex; gap: 0.4rem; align-items: end; }
.search .field { min-width: 16rem; }
.invoice-tools { display: grid; grid-template-columns: minmax(8rem, 0.85fr) minmax(14rem, 1.5fr) auto; gap: 0.4rem 0.6rem; align-items: end; margin-bottom: 0.2rem; }
.invoice-find { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem; align-items: end; }
.invoice-tools > .field, .invoice-find > .field { grid-column: auto; min-width: 0; }
.invoice-tools > .btn { justify-self: start; }
.invoice-head { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem 0.55rem; align-items: end; }
.invoice-head > .field { grid-column: auto; min-width: 0; }
.invoice-head input, .invoice-head select { padding: 0.28rem 0.36rem; min-width: 0; width: 100%; }
.invoice-lines { table-layout: fixed; }
.invoice-lines th:nth-child(1), .invoice-lines td:nth-child(1) { width: 18%; }
.invoice-lines th:nth-child(2), .invoice-lines td:nth-child(2) { width: 36%; }
.invoice-lines th:nth-child(3), .invoice-lines td:nth-child(3) { width: 8%; }
.invoice-lines th:nth-child(4), .invoice-lines td:nth-child(4) { width: 12%; }
.invoice-lines th:nth-child(5), .invoice-lines td:nth-child(5) { width: 13%; }
.invoice-lines th:nth-child(6), .invoice-lines td:nth-child(6) { width: 7%; }
.invoice-lines th:nth-child(7), .invoice-lines td:nth-child(7) { width: 6%; }
.invoice-lines td:nth-child(3) input, .invoice-lines td:nth-child(4) input { text-align: right; }
.quote-lines { table-layout: fixed; }
.quote-lines th:nth-child(1), .quote-lines td:nth-child(1) { width: 11%; }
.quote-lines th:nth-child(2), .quote-lines td:nth-child(2) { width: 40%; }
.quote-lines th:nth-child(3), .quote-lines td:nth-child(3) { width: 7%; }
.quote-lines th:nth-child(4), .quote-lines td:nth-child(4) { width: 13%; }
.quote-lines th:nth-child(5), .quote-lines td:nth-child(5) { width: 13%; }
.quote-lines th:nth-child(6), .quote-lines td:nth-child(6) { width: 8%; }
.quote-lines th:nth-child(7), .quote-lines td:nth-child(7) { width: 8%; }
.quote-lines td:nth-child(3) input,
.quote-lines td:nth-child(4) input,
.quote-lines td:nth-child(5) input { text-align: right; }
.quote-lines td:nth-child(6) { text-align: center; position: relative; }
.quote-lines .icon-btn { margin: 0 auto; }
.tax-detail { display: inline-block; position: relative; margin-left: 0.15rem; vertical-align: middle; }
.tax-detail summary { width: 0.95rem; height: 0.95rem; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 0.65rem; line-height: 0.85rem; text-align: center; cursor: pointer; list-style: none; }
.tax-detail summary::-webkit-details-marker { display: none; }
.tax-detail summary::before { content: "i"; }
.tax-detail .tax-panel { position: absolute; right: 0; top: 1.2rem; z-index: 6; width: 16rem; padding: 0.4rem 0.5rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; text-align: left; box-shadow: var(--shadow); }
.tax-detail .tax-panel p { margin: 0.2rem 0 0; font-size: 0.78rem; }
.line-desc { width: 100%; min-height: 1.9rem; resize: vertical; line-height: 1.3; }
.line-amount { display: block; text-align: right; font-variant-numeric: tabular-nums; padding-top: 0.32rem; }
.resale-card h2 { margin: 0 0 0.35rem; font-size: 1rem; }
.resale-status { margin: 0 0 0.45rem; }
.resale-grid { display: flex; flex-wrap: wrap; gap: 0.45rem 0.7rem; align-items: end; }
.resale-grid .resale-number { flex: 1 1 12rem; max-width: 16rem; }
.resale-grid .resale-date { flex: 0 1 9.5rem; }
.resale-grid .check { flex: 0 1 auto; width: max-content; max-width: 100%; margin: 0 0 0.15rem; }
.resale-file { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: end; margin-top: 0.45rem; }
.resale-upload { flex: 1 1 14rem; max-width: 22rem; margin: 0; }
#resale-note, #resale-offer { margin: 0.15rem 0 0.35rem; }
.tax-check { display: flex; justify-content: center; min-height: 1.9rem; align-items: center; }
.tax-check input { width: auto; }
.icon-btn { width: 1.7rem; height: 1.7rem; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; padding: 0; }
.icon-btn svg { width: 0.95rem; height: 0.95rem; }
.icon-btn:hover { color: var(--bad); background: var(--hover); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
ul.plain { margin: 0.3rem 0 0; padding-left: 1.1rem; }
@media (max-width: 1280px) {
  .party-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .contact-head, .contact-row {
    grid-template-columns: 7.5rem 10.5rem minmax(11rem, 16.5rem) 7.5rem 7.5rem 5.2rem;
  }
}
@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .stats.tax-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .invoice-head { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr) minmax(0, 1fr); }
}
.nav-toggle, .nav-backdrop { display: none; }
.top-side { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.45rem 0.7rem; }
.sign-out { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; }
.sign-out span { color: var(--muted); font-size: 0.8rem; }
.access-card, .access-manage { max-width: 40rem; }
.google-signin { min-height: 44px; margin: 0.35rem 0; }
.statement { max-width: 44rem; }
.acct-meters { display: grid; gap: 0.28rem; margin: 0.35rem 0 0.55rem; max-width: 36rem; }
.acct-meter { display: grid; grid-template-columns: 9.2rem minmax(4rem, 1fr) 6.6rem; gap: 0.4rem; align-items: center; font-size: 0.84rem; }
.acct-track { display: block; height: 0.5rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.acct-track span { display: block; height: 100%; background: #1f7a4d; }
.acct-meter strong { text-align: right; }
.pay-due { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.8rem; margin: 0.15rem 0 0.4rem; }
.pay-due strong { font-size: 1.15rem; }
.payroll-edit { display: flex; flex-wrap: wrap; align-items: end; gap: 0.35rem; }
.payroll-edit .field { width: 7.2rem; }
.payroll-edit .field.name { width: 12rem; }
.payroll-edit .btn { width: auto; }
.statement-head h2 { margin: 0 0 0.15rem; }
.statement-head p { margin: 0; }
.statement-table td:first-child { padding-left: calc(0.35rem + (var(--depth, 0) * 0.85rem)); }
.statement-table tr.section td { font-weight: 650; }
.statement-table tr.total td { font-weight: 650; border-top: 1px solid var(--line); }
.field.short { max-width: 8rem; }
.access-form, .access-inline { margin-top: 0.45rem; }
.inline-form { display: inline-flex; margin: 0 0 0 0.35rem; }
.recovery-codes { list-style: none; padding: 0; }
.recovery-codes code { font-size: 0.95rem; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 0.25rem; padding: 0.4rem 0.75rem; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(10, 16, 24, 0.48); }
  .nav-backdrop:not([hidden]) { display: block; }
  .sidebar { position: fixed; z-index: 40; top: 0; left: 0; width: min(16.5rem, 86vw); height: 100dvh; transform: translateX(-105%); transition: transform 160ms ease; }
  .sidebar.open { transform: none; }
  .sidebar nav { flex-direction: column; flex-wrap: nowrap; }
  .side-foot { margin-top: 0; }
  .theme-switch { max-width: none; }
  .brand { max-width: 12.4rem; margin-bottom: 0.7rem; }
  .nav-rule, .nav-space { width: auto; }
  .top-meta, .top-side { text-align: left; justify-content: flex-start; }
  .hero, .split, .customer-summary, .vendor-workspace { grid-template-columns: minmax(0, 1fr); }
  .vendor-index { position: static; }
  .party-cards { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  iframe.pdf { height: 480px; }
}
@media (max-width: 800px) {
  body { overflow-x: hidden; }
  input, select, textarea { font-size: 16px; }
  .btn, button.btn, .sidebar nav a, .theme-switch button, .nav-toggle, .icon-btn, .tool { min-height: 44px; min-width: 44px; }
  .acct-year select { height: 44px; min-height: 44px; }
  .bank-file { min-height: 44px; height: 44px; }
  .bank-side { width: 100%; justify-content: flex-end; }
  .sidebar nav a, .btn, button.btn { padding-top: 0.55rem; padding-bottom: 0.55rem; }
  .pay-modal { max-height: calc(100dvh - 1.25rem); overflow: auto; }
  .table-wrap { max-width: 100%; }
  .two, .tax-split { grid-template-columns: 1fr; }
  .dash-charts .row-actions { justify-content: flex-start; }
  .dash-charts .row-actions h2 { flex: 1 0 100%; }
  .contact-head { display: none; }
  .contact-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem; }
  .contact-row .emails-cell,
  .contact-row .btn { grid-column: 1 / -1; }
  .contact-row .row-label { position: static; width: auto; height: auto; margin: 0 0 0.15rem; overflow: visible; clip: auto; display: block; color: var(--muted); font-size: 0.72rem; }
  .contact-row .btn { justify-self: start; }
  .invoice-tools { grid-template-columns: 1fr; }
  .invoice-foot { grid-template-columns: minmax(0, 1fr); grid-template-areas: "notes" "side" "ways" "margin"; }
  .invoice-side { width: 100%; }
  .invoice-side .money-stack { max-width: none; margin-left: 0; }
  .estimate-margin { width: 100%; }
  .estimate-foot { grid-template-columns: minmax(0, 1fr); }
  .estimate-foot > .doc-notes, .estimate-foot > .money-stack, .estimate-foot > .internal-margin { grid-column: auto; }
  .estimate-costs thead { display: none; }
  .estimate-costs, .estimate-costs tbody, .estimate-costs tr, .estimate-costs td { display: block; width: auto; }
  .estimate-costs th:nth-child(n), .estimate-costs td:nth-child(n) { width: 100%; }
  .estimate-costs tr { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem; margin-bottom: 0.4rem; }
  .estimate-costs td { margin-bottom: 0.35rem; }
  .estimate-costs td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 0.12rem; }
  .estimate-costs td[data-label="Remove"] { width: auto; }
}
@media (max-width: 900px) {
  .profile-address { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(3.2rem, 0.4fr) minmax(4.2rem, 0.55fr); }
  .profile-address > .field:first-child { grid-column: 1 / -1; }
  .profile-row.docs-edit, .profile-row.three-up { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .field, .field.s2, .field.s3, .field.s4, .field.s5, .field.s6, .field.s8 { grid-column: span 12; }
  .profile-address > .field, .profile-row > .field { grid-column: auto; }
  .profile-address, .profile-row, .profile-row.two-up, .profile-row.three-up, .profile-row.docs-edit { grid-template-columns: 1fr; }
  .profile-address > .field:first-child { grid-column: auto; }
  .po-address { grid-template-columns: 1fr; }
  .po-address > .field,
  .po-address > .field.s12 { grid-column: auto; }
  .place { grid-template-columns: minmax(0, 1.4fr) 3.4rem 4.6rem; }
  main, .topbar { padding-left: 0.7rem; padding-right: 0.7rem; }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr.line { border: 1px solid var(--line); border-radius: 8px; padding: 0.35rem 0.45rem; margin-bottom: 0.4rem; }
  .lines td { border: 0; padding: 0.18rem 0; }
  .lines td::before { content: attr(data-label); display: block; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.03em; text-transform: uppercase; }
  .quote-lines th:nth-child(n), .quote-lines td:nth-child(n) { width: 100%; }
  .lines td.extra { display: none; }
  .lines.show-extra td.extra { display: block; }
  .party-cards { grid-template-columns: 1fr; }
  .contact-row { grid-template-columns: minmax(0, 1fr); }
  .invoice-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .invoice-head > .field,
  .invoice-head > .field.s2,
  .invoice-head > .field.s3,
  .invoice-head > .field.s4,
  .invoice-head > .field.s5,
  .invoice-head > .field.s6,
  .invoice-head > .field.s8 { grid-column: auto; }
  .invoice-head > .field:first-child { grid-column: 1 / -1; }
  .invoice-head input, .invoice-head select { min-width: 0; width: 100%; }
  .doc-head > .field.doc-number,
  .doc-head > .field.doc-date,
  .doc-head > .field.doc-po,
  .doc-head > .field.doc-terms,
  .doc-head > .field.doc-status { flex: 1 1 calc(50% - 0.4rem); width: auto; max-width: none; }
  .doc-head > .field.doc-party { flex: 1 1 100%; max-width: none; }
  .stats, .hero, .stats.tax-stats { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .doc-head > .field.doc-number,
  .doc-head > .field.doc-date,
  .doc-head > .field.doc-po,
  .doc-head > .field.doc-terms,
  .doc-head > .field.doc-status,
  .doc-head > .field.doc-party { flex-basis: 100%; }
}
@media print {
  .internal-margin { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stat:hover { transform: none; }
}
.invoice-pick { width: 2.4rem; text-align: center; }
.mail-draft .form-grid { margin-top: 0.35rem; }
.mail-draft textarea { min-height: 8.5rem; }
.mail-attachments { list-style: none; margin: 0 0 0.55rem; padding: 0; }
.mail-attachments li { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; padding: 0.32rem 0; border-bottom: 1px solid var(--line); }
.mail-total { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin: 0.2rem 0 0.4rem; }
.mail-total strong { font-variant-numeric: tabular-nums; }
.mail-steps { margin: 0.55rem 0 0; padding-left: 1.15rem; }
.mail-steps li + li { margin-top: 0.28rem; }
.mail-account .row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.mail-account .row-actions form { margin: 0; }
.mail-draft .row-actions { margin-top: 0.65rem; }
