/* =====================================================================
   Mark Ford CPA - Practice Manager
   Design: ledger green on cool paper, brass for attention, Caslon for names,
   double-rule underlines borrowed from accounting totals.
   ===================================================================== */

:root {
  --paper: #f3f6f3;
  --surface: #ffffff;
  --surface-2: #f8faf8;
  --ledger: #f2f7f3;
  --ink: #17201c;
  --ink-2: #44524c;
  --ink-3: #6f7d77;
  --rule: #d8e1db;
  --rule-2: #e8eee9;
  --primary: #1d4a3a;
  --primary-hover: #245a47;
  --on-primary: #ffffff;
  --accent: #1d4a3a;
  --accent-wash: #e3eee8;
  --brass: #9a6f17;
  --brass-wash: #f6ecd2;
  --red: #b0352b;
  --red-wash: #fbe8e5;
  --amber: #a35f00;
  --amber-wash: #fcefd8;
  --blue: #2b5b97;
  --blue-wash: #e5edf8;
  --violet: #62449f;
  --violet-wash: #eee8f8;
  --teal: #17716b;
  --teal-wash: #def1ef;
  --green: #1f6b45;
  --green-wash: #e1f1e6;
  --neutral: #5f6b66;
  --neutral-wash: #eceff0;
  --side: #163a2e;
  --side-2: #1d4a3a;
  --side-ink: #cfe0d7;
  --side-ink-2: #8fb0a0;
  --focus: #c79a3a;
  --shadow-1: 0 1px 2px rgba(20, 40, 32, .06);
  --shadow-2: 0 10px 30px rgba(16, 36, 28, .14), 0 2px 6px rgba(16, 36, 28, .06);
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --r-sm: 6px;
  --r: 9px;
  --r-lg: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1512; --surface: #141e1a; --surface-2: #19251f; --ledger: #17221d;
    --ink: #e3ebe6; --ink-2: #b2c1b9; --ink-3: #83938b; --rule: #2a3832; --rule-2: #202c27;
    --primary: #4c9c7a; --primary-hover: #5aae8a; --on-primary: #06110c; --accent: #7cc4a3; --accent-wash: #1a2f26;
    --brass: #d9ad55; --brass-wash: #33291a; --red: #ef7f72; --red-wash: #3a1d1a; --amber: #e9a547; --amber-wash: #382915;
    --blue: #8db4ea; --blue-wash: #1a2738; --violet: #b9a0ea; --violet-wash: #2a2238; --teal: #6dcdc4; --teal-wash: #15302d;
    --green: #78cf9c; --green-wash: #183224; --neutral: #a3b0aa; --neutral-wash: #232d29;
    --side: #0b1310; --side-2: #14231d; --side-ink: #c3d4cb; --side-ink-2: #7f998c;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 14px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1512; --surface: #141e1a; --surface-2: #19251f; --ledger: #17221d;
  --ink: #e3ebe6; --ink-2: #b2c1b9; --ink-3: #83938b; --rule: #2a3832; --rule-2: #202c27;
  --primary: #4c9c7a; --primary-hover: #5aae8a; --on-primary: #06110c; --accent: #7cc4a3; --accent-wash: #1a2f26;
  --brass: #d9ad55; --brass-wash: #33291a; --red: #ef7f72; --red-wash: #3a1d1a; --amber: #e9a547; --amber-wash: #382915;
  --blue: #8db4ea; --blue-wash: #1a2738; --violet: #b9a0ea; --violet-wash: #2a2238; --teal: #6dcdc4; --teal-wash: #15302d;
  --green: #78cf9c; --green-wash: #183224; --neutral: #a3b0aa; --neutral-wash: #232d29;
  --side: #0b1310; --side-2: #14231d; --side-ink: #c3d4cb; --side-ink-2: #7f998c;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 14px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }
p { margin: 0 0 12px; }
small, .small { font-size: 13px; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
kbd { border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--ink-3); font-size: 11.5px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
img { max-width: 100%; }
.ic { flex: none; vertical-align: middle; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.serif { font-family: var(--serif); }
.pad { padding: 14px 16px; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; } .mb-0 { margin-bottom: 0; }
.hide { display: none !important; }
.inline-form { display: inline; margin: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.text-red { color: var(--red); } .text-green { color: var(--green); } .text-amber { color: var(--amber); } .text-brass { color: var(--brass); }

/* ---------------- App shell ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 20px; }
.sidebar-top { padding: 18px 16px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #e9d9ad; color: #173b2f; font: 700 14px/1 var(--serif); letter-spacing: .02em; flex: none; }
.brand-name { font: 400 16px/1.15 var(--serif); color: #f3efe2; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); font-weight: 500; font-size: 14.5px; text-decoration: none !important; position: relative; }
.nav-link .ic { color: var(--side-ink-2); }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active { background: var(--side-2); color: #fff; box-shadow: inset 3px 0 0 #e9d9ad; }
.nav-link.is-active .ic { color: #e9d9ad; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #e9d9ad; color: #173b2f; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.nav-section { padding: 14px 10px 0; }
.nav-heading { display: flex; align-items: center; gap: 6px; margin: 0 10px 4px; font-size: 12px; font-weight: 600; color: var(--side-ink-2); }
.nav-client { display: block; padding: 5px 10px; border-radius: 6px; color: var(--side-ink); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.nav-client:hover { background: rgba(255,255,255,.06); color: #fff; }
.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule-2); }
.searchbar { flex: 1 1 auto; min-width: 0; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r); color: var(--ink-3); font: inherit; cursor: text; text-align: left; box-shadow: var(--shadow-1); }
.searchbar span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchbar:hover { border-color: var(--ink-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }
.only-mobile { display: none !important; }
.sidebar-scrim { display: none; }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-brass { background: var(--brass); border-color: var(--brass); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--rule-2); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-wash); border-color: var(--red); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12.5px; border-radius: 5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--rule-2); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; }
.dot-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 6px; border-radius: var(--r-sm); color: var(--ink); font: 500 14px var(--sans); cursor: pointer; }
.user-btn:hover { background: var(--rule-2); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- Dropdowns ---------------- */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; z-index: 50; }
.dropdown.is-open > .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--ink); font: 500 14px var(--sans); text-align: left; border-radius: 6px; cursor: pointer; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--rule-2); }
.dropdown-menu form { margin: 0; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule-2); margin-bottom: 4px; display: flex; flex-direction: column; }
.dropdown-head span { color: var(--ink-3); font-size: 13px; }
.dropdown-wide { width: 360px; max-height: 70vh; overflow-y: auto; }
.notif { display: block; padding: 10px; border-radius: 6px; color: var(--ink); text-decoration: none !important; }
.notif:hover { background: var(--rule-2); }
.notif.unread { background: var(--accent-wash); }
.notif strong { display: block; font-size: 14px; }
.notif span { color: var(--ink-3); font-size: 13px; }

/* ---------------- Page header ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; font-weight: 650; }
.page-head .sub { color: var(--ink-3); margin: 4px 0 0; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 13.5px; margin-bottom: 8px; }
.crumbs a { color: var(--ink-3); }

/* The double rule: accounting's mark for a final total */
.double-rule { border: 0; height: 4px; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); margin: 10px 0 0; width: 72px; }
.total-rule { border-bottom: 3px double var(--ink); }

/* ---------------- Panels ---------------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 18px; }
.grid > .panel + .panel, .grid > * + .panel, [class*="cols-"] > .panel + .panel { margin-top: 0; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .45; cursor: pointer; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule-2); }
.panel-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.panel-head .ic { color: var(--ink-3); }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 8px 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--rule-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 16px; color: var(--ink); text-decoration: none !important; position: relative; }
a.stat:hover { border-color: var(--ink-3); }
.stat-label { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; line-height: 1.1; }
.stat-note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.stat.tone-red .stat-value { color: var(--red); }
.stat.tone-brass .stat-value { color: var(--brass); }
.stat.tone-amber .stat-value { color: var(--amber); }

/* Season progress bar */
.progress { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--rule-2); gap: 2px; }
.progress span { display: block; height: 100%; min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend a { color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------- Tables (ledger) ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 9px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table th a { color: inherit; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--ledger); }
.table tbody tr:hover td { background: var(--accent-wash); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .tight { width: 1%; white-space: nowrap; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--ink); background: var(--surface); }
.table tfoot td.num span { border-bottom: 3px double var(--ink); padding-bottom: 1px; }
.row-link { color: var(--ink); font-weight: 600; }
.row-link:hover { color: var(--accent); }
.row-sub { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.table-compact td { padding: 7px 10px; }
.table input[type="checkbox"] { width: 16px; height: 16px; }
tr.is-selected td { background: var(--brass-wash) !important; }

/* Inline status select inside tables */
.status-select { appearance: none; border: 0; background: transparent; font: inherit; padding: 0; cursor: pointer; }
.chip-select { position: relative; display: inline-flex; }
.chip-select select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------------- Chips ---------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--neutral-wash); color: var(--neutral); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-amber { background: var(--amber-wash); color: var(--amber); }
.chip-blue { background: var(--blue-wash); color: var(--blue); }
.chip-violet { background: var(--violet-wash); color: var(--violet); }
.chip-brass { background: var(--brass-wash); color: var(--brass); }
.chip-teal { background: var(--teal-wash); color: var(--teal); }
.chip-green { background: var(--green-wash); color: var(--green); }
.chip-red { background: var(--red-wash); color: var(--red); }
.chip-plain { background: transparent; border: 1px solid var(--rule); color: var(--ink-2); }
.chip-plain i { display: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--rule-2); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.due { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.due.is-overdue { color: var(--red); font-weight: 600; }
.due.is-soon { color: var(--amber); font-weight: 600; }

/* ---------------- Avatars ---------------- */
.avatar { --av: #1d4a3a; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--av) 18%, var(--surface)); color: color-mix(in srgb, var(--av) 85%, var(--ink)); font-size: 12px; font-weight: 700; flex: none; border: 1.5px solid color-mix(in srgb, var(--av) 35%, transparent); }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-empty { background: transparent; border: 1.5px dashed var(--rule); color: var(--ink-3); }
.client-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-wash); color: var(--accent); font: 700 12.5px/1 var(--sans); flex: none; }
.client-mark.is-biz { background: var(--brass-wash); color: var(--brass); }
.client-mark.lg { width: 56px; height: 56px; border-radius: 13px; font-size: 18px; }
.client-mark.lg .ic { width: 26px; height: 26px; }
.client-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { display: block; width: 100%; margin-top: 5px; height: 40px; padding: 0 11px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 15px var(--sans); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 90px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f7d77' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--primary); vertical-align: middle; box-shadow: none; }
input[type="file"] { height: auto; padding: 8px; }
input[type="color"] { padding: 2px; width: 60px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { margin-top: 2px; }
.check span small { display: block; color: var(--ink-3); font-weight: 400; }
.field { margin-bottom: 14px; }
.hint { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 400; margin-top: 4px; }
.form-grid { display: grid; gap: 14px 16px; }
.form-grid fieldset { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 12px; }
.form-grid legend { font-weight: 650; font-size: 15px; margin-bottom: 8px; padding: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.input-group { display: flex; gap: 0; margin-top: 5px; }
.input-group input { margin-top: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; height: 40px; margin-left: -1px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { font-size: 12.5px; }
.filters input, .filters select { height: 36px; font-size: 14px; min-width: 130px; }
.filters select { max-width: 190px; }
.filters .search-input { min-width: 260px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); padding: 2px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 5px; color: var(--ink-2); font: 600 13.5px var(--sans); border: 0; background: none; cursor: pointer; text-decoration: none !important; }
.seg .is-active { background: var(--primary); color: var(--on-primary); }

/* ---------------- Alerts ---------------- */
.alert { padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: var(--red-wash); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert-success { background: var(--green-wash); color: var(--green); }
.alert-info { background: var(--blue-wash); color: var(--blue); }
.callout { border-left: 3px solid var(--brass); background: var(--brass-wash); padding: 14px 16px; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 16px 0; color: var(--ink); }
.callout p { margin: 6px 0 0; color: var(--ink-2); }
.callout-warn { border-left-color: var(--red); background: var(--red-wash); }
.callout-info { border-left-color: var(--blue); background: var(--blue-wash); }
.client-alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--red-wash); color: var(--red); border-radius: var(--r-sm); font-weight: 600; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.keybox { background: var(--surface); border: 1px dashed var(--red); padding: 12px; border-radius: var(--r-sm); word-break: break-all; white-space: pre-wrap; font-size: 15px; margin: 10px 0 0; color: var(--ink); }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); font-size: 14px; animation: toast-in .22s ease-out; }
.toast-success .ic { color: #8fe0b0; } .toast-error .ic { color: #ff9b8f; } .toast-warn .ic { color: #f4c56c; }
.toast span { flex: 1; }
.toast-x { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 19px; border-radius: 10px; background: var(--rule-2); font-size: 11.5px; padding: 0 5px; margin-left: 4px; color: var(--ink-2); }

/* ---------------- Client profile header (the signature moment) ---------------- */
.client-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.client-head h1 { font: 400 36px/1.12 var(--serif); letter-spacing: -.01em; }
.client-head .double-rule { width: 100%; max-width: 420px; }
.client-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; color: var(--ink-2); font-size: 14px; }
.client-meta span, .client-meta a { display: inline-flex; align-items: center; gap: 6px; }
.client-meta .ic { color: var(--ink-3); }
.client-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fav-btn.is-on .ic { fill: var(--brass); color: var(--brass); }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.reveal-inline { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------- Timeline / notes ---------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: -2px; width: 1.5px; background: var(--rule); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 3px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline .t-meta { font-size: 12.5px; color: var(--ink-3); }
.note { padding: 12px 14px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--surface); }
.note + .note { margin-top: 10px; }
.note.is-pinned { border-color: color-mix(in srgb, var(--brass) 45%, transparent); background: var(--brass-wash); }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-kind { font-weight: 600; color: var(--ink-2); }

/* ---------------- Board ---------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--rule-2); border-radius: var(--r); padding: 10px; min-height: 120px; }
.board-col.is-over { border-color: var(--primary); background: var(--accent-wash); }
.board-col h3 { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; padding: 2px 4px 10px; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 11px; margin-bottom: 8px; color: var(--ink); cursor: grab; box-shadow: var(--shadow-1); text-decoration: none !important; }
.board-card:hover { border-color: var(--ink-3); }
.board-card.is-dragging { opacity: .5; }
.board-card strong { display: block; font-size: 14px; }
.board-card .bc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }

/* ---------------- Empty states ---------------- */
.empty { text-align: center; padding: 38px 20px; color: var(--ink-2); }
.empty .ic { color: var(--ink-3); margin-bottom: 8px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); max-width: 420px; margin: 0 auto 14px; }

/* ---------------- Pager ---------------- */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--rule-2); }
.pager .muted { margin-right: auto; font-size: 13.5px; }

/* ---------------- Command palette ---------------- */
.palette { position: fixed; inset: 0; z-index: 300; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette-scrim { position: absolute; inset: 0; background: rgba(10, 22, 17, .45); }
.palette-box { position: relative; width: min(640px, calc(100vw - 24px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; border: 1px solid var(--rule); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--rule); }
.palette-input .ic { color: var(--ink-3); }
.palette-input input { border: 0; box-shadow: none !important; height: 58px; margin: 0; font-size: 18px; padding: 0; background: transparent; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none !important; }
.palette-item.is-active { background: var(--accent-wash); }
.palette-item .pi-main { flex: 1; min-width: 0; }
.palette-item .pi-title { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-sub { font-size: 12.5px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item mark { background: var(--brass-wash); color: inherit; border-radius: 2px; }
.palette-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--rule-2); font-size: 12px; color: var(--ink-3); }
.palette-empty { padding: 28px; text-align: center; color: var(--ink-3); }

/* ---------------- Modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(10, 22, 17, .45); }
.modal-box { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.modal-box.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--rule-2); }
.modal-body { padding: 20px; }
dialog.mf-dialog { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; }
template { display: none; }

/* ---------------- Vault ---------------- */
.vault-locked { text-align: center; padding: 34px 20px; }
.vault-locked .ic { color: var(--brass); }
.vault-locked form { max-width: 340px; margin: 16px auto 0; }
.vault-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--brass-wash); color: var(--ink-2); font-size: 14px; margin-bottom: 16px; }
.vault-bar strong { color: var(--brass); }
.vault-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.vault-cat { border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.vault-cat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule-2); }
.vault-cat-head h3 { font-size: 15px; }
.vault-cat-head .muted { font-size: 12.5px; }
.vault-cat-head .btn { margin-left: auto; }
.vault-entry { padding: 12px 16px; border-bottom: 1px dashed var(--rule); }
.vault-entry:last-child { border-bottom: 0; }
.vault-entry-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vault-entry-head strong { font-size: 14.5px; }
.vault-entry-head .actions { margin-left: auto; display: flex; gap: 2px; }
.vault-field { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.vault-field dt { color: var(--ink-3); font-size: 13px; }
.vault-field dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; letter-spacing: .02em; }
.vault-field dd.is-masked { color: var(--ink-3); letter-spacing: .15em; }
.vault-field dd.is-text { font-family: var(--sans); white-space: pre-wrap; letter-spacing: 0; }
.vault-field .vf-actions { display: flex; gap: 0; }
.vault-meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* ---------------- Calendar ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.cal-dow { padding: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); }
.cal-day.is-other { background: var(--surface-2); }
.cal-day.is-other .cal-num { color: var(--ink-3); }
.cal-day.is-today .cal-num { background: var(--primary); color: var(--on-primary); }
.cal-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-item { display: block; font-size: 12px; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); text-decoration: none !important; border-left: 3px solid var(--primary); background: var(--accent-wash); }
.cal-item.is-return { border-left-color: var(--brass); background: var(--brass-wash); }
.cal-item.is-done { opacity: .55; text-decoration: line-through !important; }
.cal-more { font-size: 12px; color: var(--ink-3); }

/* ---------------- Tasks ---------------- */
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--rule-2); }
.task-row:last-child { border-bottom: 0; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--ink-3); }
.task-check { width: 22px; height: 22px; border-radius: 6px; border: 1.8px solid var(--ink-3); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; margin-top: 1px; color: transparent; padding: 0; }
.task-check:hover { border-color: var(--primary); }
.task-row.is-done .task-check { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.task-title { font-weight: 600; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.checklist-mini { list-style: none; margin: 8px 0 0; padding: 0; }
.checklist-mini li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 2px 0; }
.checklist-mini li.done span { text-decoration: line-through; color: var(--ink-3); }
.task-group-head { padding: 10px 18px; font-size: 13px; font-weight: 650; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--rule-2); }
.task-group-head.is-overdue { color: var(--red); }

/* ---------------- Checklist (onboarding, install) ---------------- */
.checklist { list-style: none; padding: 0; margin: 0 0 16px; }
.checklist li { padding: 4px 0; font-size: 14px; }
.checklist .ok { color: var(--green); } .checklist .bad { color: var(--red); font-weight: 600; } .checklist .warn { color: var(--amber); }
.onboard { list-style: none; padding: 0; margin: 0; }
.onboard li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.onboard li.done span { color: var(--ink-3); text-decoration: line-through; }
.meter { height: 6px; background: var(--rule-2); border-radius: 3px; overflow: hidden; margin: 6px 0 12px; }
.meter span { display: block; height: 100%; background: var(--primary); }

/* ---------------- Files ---------------- */
.file-ext { display: inline-grid; place-items: center; width: 38px; height: 44px; border-radius: 6px; background: var(--rule-2); color: var(--ink-2); font: 700 10.5px var(--sans); position: relative; flex: none; }
.file-ext-pdf { background: var(--red-wash); color: var(--red); }
.file-ext-jpg, .file-ext-jpeg, .file-ext-png, .file-ext-heic, .file-ext-gif, .file-ext-webp { background: var(--violet-wash); color: var(--violet); }
.file-ext-xlsx, .file-ext-xls, .file-ext-csv { background: var(--green-wash); color: var(--green); }
.file-ext-doc, .file-ext-docx { background: var(--blue-wash); color: var(--blue); }
.dropzone { border: 2px dashed var(--rule); border-radius: var(--r); padding: 26px; text-align: center; background: var(--surface-2); color: var(--ink-2); cursor: pointer; transition: border-color .12s, background .12s; display: block; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--accent-wash); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .ic { color: var(--primary); }
.dropzone strong { display: block; color: var(--ink); margin: 6px 0 2px; }
.dropzone-files { font-size: 13px; color: var(--ink-2); margin-top: 8px; }

/* ---------------- Messages ---------------- */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; padding: 16px 18px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--rule-2); align-self: flex-start; }
.msg.is-mine { align-self: flex-end; background: var(--accent-wash); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px; border-top: 1px solid var(--rule-2); }
.composer textarea { min-height: 46px; margin: 0; }
.inbox-row { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--rule-2); color: var(--ink); text-decoration: none !important; }
.inbox-row:hover { background: var(--accent-wash); }
.inbox-row.unread strong { color: var(--accent); }
.inbox-row .grow span { display: block; color: var(--ink-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Signature pad ---------------- */
.sigpad { border: 1.5px dashed var(--ink-3); border-radius: var(--r); background: #fff; touch-action: none; width: 100%; height: 180px; display: block; cursor: crosshair; }
.sig-img { max-width: 320px; background: #fff; border-bottom: 1.5px solid #222; padding: 6px; }
.letter { font-family: var(--serif); font-size: 16px; line-height: 1.7; background: var(--surface); padding: 32px 36px; border: 1px solid var(--rule); border-radius: var(--r); max-width: 760px; color: var(--ink); }
.letter p { margin: 0 0 14px; }

/* ---------------- Auth ---------------- */
.auth-body { min-height: 100vh; background:
  repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--primary) 7%, transparent) 31px 32px),
  var(--paper); }
.auth-wrap { width: min(440px, calc(100vw - 32px)); margin: 0 auto; padding: 8vh 0 40px; }
.auth-wrap.auth-wide { width: min(680px, calc(100vw - 32px)); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font: 400 21px var(--serif); color: var(--ink); }
.auth-brand em { font-style: normal; font-family: var(--sans); font-size: 14px; color: var(--ink-3); margin-left: 6px; }
.auth-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-3); margin-bottom: 20px; }
.auth-card form > label, .auth-card .field { margin-bottom: 14px; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 13px; margin-top: 18px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.code-input { font-size: 26px !important; letter-spacing: .4em; text-align: center; height: 56px !important; font-family: ui-monospace, Menlo, monospace !important; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--r); border: 1px solid var(--rule); width: max-content; margin: 12px auto; }
.secret { text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .1em; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: var(--r-sm); }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; background: var(--surface-2); padding: 14px; border-radius: var(--r-sm); text-align: center; }
.steps-mini { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; }
.steps-mini li { counter-increment: s; position: relative; padding-left: 32px; margin-bottom: 8px; font-size: 14.5px; }
.steps-mini li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-wash); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.error-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.error-card { max-width: 460px; text-align: center; }
.error-code { font: 400 64px/1 var(--serif); color: var(--brass); margin-bottom: 8px; }

/* ---------------- Portal ---------------- */
.portal-body { background: var(--paper); }
.portal-top { background: var(--side); color: var(--side-ink); }
.portal-top-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
.portal-switch { margin-left: auto; }
.portal-switch select { margin: 0; height: 36px; background-color: var(--side-2); color: #fff; border-color: rgba(255,255,255,.15); min-width: 200px; }
.portal-signout { margin-left: auto; }
.portal-switch + .portal-signout { margin-left: 0; }
.portal-signout .btn { color: var(--side-ink); }
.portal-signout .btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.portal-nav { border-top: 1px solid rgba(255,255,255,.08); }
.portal-nav-inner { max-width: 980px; margin: 0 auto; display: flex; gap: 4px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.portal-nav a { display: flex; align-items: center; gap: 7px; padding: 12px 12px; color: var(--side-ink); font-weight: 600; font-size: 14.5px; border-bottom: 2.5px solid transparent; white-space: nowrap; text-decoration: none !important; }
.portal-nav a:hover { color: #fff; }
.portal-nav a.is-active { color: #fff; border-bottom-color: #e9d9ad; }
.portal-main { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; }
.portal-foot { max-width: 980px; margin: 0 auto; padding: 20px; color: var(--ink-3); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.portal-foot p { margin: 0; display: flex; align-items: center; gap: 6px; }
.portal-hello { font: 400 30px/1.2 var(--serif); margin-bottom: 4px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--rule-2); color: var(--ink); text-decoration: none !important; }
.todo:last-child { border-bottom: 0; }
a.todo:hover { background: var(--accent-wash); }
.todo-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brass-wash); color: var(--brass); flex: none; }
.todo strong { display: block; }
.todo span { color: var(--ink-3); font-size: 13.5px; }

/* Return tracker (portal and staff) */
.tracker { list-style: none; padding: 0; margin: 18px 0 6px; display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
.tracker li { text-align: center; font-size: 12.5px; color: var(--ink-3); position: relative; padding-top: 30px; }
.tracker li::before { content: ""; position: absolute; top: 9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rule); z-index: 1; }
.tracker li::after { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 2px; background: var(--rule); }
.tracker li:first-child::after { display: none; }
.tracker li.is-done { color: var(--ink-2); }
.tracker li.is-done::before { background: var(--primary); border-color: var(--primary); }
.tracker li.is-done::after, .tracker li.is-current::after { background: var(--primary); }
.tracker li.is-current { color: var(--ink); font-weight: 650; }
.tracker li.is-current::before { border-color: var(--brass); background: var(--brass); box-shadow: 0 0 0 5px var(--brass-wash); }
.tracker-text { font-size: 15.5px; margin: 8px 0 0; }
.return-card { padding: 20px 22px; }
.return-card + .return-card { border-top: 1px solid var(--rule-2); }

/* ---------------- Front desk ---------------- */
.desk-search { position: relative; }
.desk-search input { height: 60px; font-size: 21px; padding-left: 50px; border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.desk-search .ic { position: absolute; left: 16px; top: 22px; color: var(--ink-3); }
.desk-results { margin-top: 14px; }
.desk-client { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--rule-2); }
.desk-client:last-child { border-bottom: 0; }
.desk-returns { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.desk-return { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }

/* ---------------- Reports ---------------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 90px; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { height: 14px; background: var(--rule-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.bar-fill.alt { background: var(--brass); }
.bar-row .num { text-align: right; font-weight: 600; }
.report-nav { display: flex; flex-direction: column; gap: 2px; }
.report-nav a { padding: 9px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.report-nav a:hover { background: var(--rule-2); }
.report-nav a.is-active { background: var(--accent-wash); color: var(--accent); }
.colchart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; border-bottom: 1px solid var(--rule); }
.colchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.colchart .col span.v { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.colchart .col i { display: block; width: 100%; max-width: 54px; background: var(--primary); border-radius: 4px 4px 0 0; }
.colchart .col i.alt { background: var(--brass); }
.colchart-labels { display: flex; gap: 10px; }
.colchart-labels span { flex: 1; text-align: center; font-size: 12.5px; color: var(--ink-3); padding-top: 6px; }

/* ---------------- Permission matrix ---------------- */
.perm-group { border: 1px solid var(--rule); border-radius: var(--r); margin-bottom: 14px; overflow: hidden; }
.perm-group h3 { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--rule-2); font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; padding: 10px 14px; }
.perm-list .check { padding: 5px 0; font-size: 14px; }
.perm-tri { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--rule-2); font-size: 14px; }
.perm-tri select { margin: 0; height: 32px; width: 150px; font-size: 13.5px; }

/* ---------------- Settings layout ---------------- */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.settings-nav a:hover { background: var(--rule-2); }
.settings-nav a.is-active { background: var(--accent-wash); color: var(--accent); }

/* ---------------- Invoice / print ---------------- */
.invoice-doc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 34px 38px; }
.invoice-top { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.invoice-firm { font: 400 24px/1.2 var(--serif); color: var(--accent); }
.invoice-title { text-align: right; }
.invoice-title h2 { font: 400 28px var(--serif); }
.invoice-items td input { margin: 0; height: 36px; }
.totals { margin-left: auto; width: min(320px, 100%); margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--ink); padding-top: 8px; }
.totals .grand span:last-child { border-bottom: 3px double var(--ink); }
.print-body { background: #e9edea; }
.print-bar { max-width: 820px; margin: 16px auto; display: flex; gap: 8px; }
.print-page { max-width: 820px; margin: 0 auto 40px; background: #fff; color: #17201c; padding: 48px; box-shadow: var(--shadow-2); border-radius: 4px; }
.print-page .invoice-doc { border: 0; padding: 0; background: #fff; color: #17201c; }
.receipt { max-width: 420px; }
.receipt h2 { font: 400 22px var(--serif); }

@media print {
  body, .print-body { background: #fff !important; }
  .no-print, .sidebar, .topbar, .toasts, .print-bar { display: none !important; }
  .print-page { box-shadow: none; padding: 0; margin: 0; max-width: none; }
  .content { padding: 0; }
}

/* ---------------- Misc ---------------- */
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-2); font-size: 14px; }
.kv-list li:last-child { border-bottom: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.list-plain > li:last-child { border-bottom: 0; }
.deadline { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--rule-2); color: var(--ink); text-decoration: none !important; }
.deadline:hover { background: var(--accent-wash); }
.deadline:last-child { border-bottom: 0; }
.deadline-date { width: 46px; text-align: center; flex: none; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; background: var(--surface); }
.deadline-date b { display: block; font-size: 17px; line-height: 1.3; }
.deadline-date small { display: block; font-size: 10.5px; font-weight: 700; background: var(--primary); color: var(--on-primary); letter-spacing: .02em; }
.deadline-date.is-overdue small { background: var(--red); }
.deadline .grow strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deadline .grow span { font-size: 13px; color: var(--ink-3); }
.greeting { font: 400 30px/1.15 var(--serif); }
.diff-del { color: var(--red); text-decoration: line-through; }
.import-log { max-height: 340px; overflow: auto; font-size: 13px; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 14px; }
.badge-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 0 6px; }
.copy-flash { animation: flash .6s; }
@keyframes flash { 0% { background: var(--brass-wash); } 100% { background: transparent; } }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); font-size: 13px; font-weight: 600; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1200px) {
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s ease; }
  .app.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .app.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 10px 14px; }
  .content { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .client-head { flex-wrap: wrap; }
  .client-head-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .hide-sm { display: none; }
  .searchbar kbd { display: none; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .page-head h1 { font-size: 23px; }
  .client-head h1 { font-size: 28px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .vault-cats { grid-template-columns: minmax(0, 1fr); }
  .vault-field { grid-template-columns: minmax(0, 1fr) auto; }
  .vault-field dt { grid-column: 1 / -1; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-item { font-size: 10.5px; padding: 1px 3px; }
  .tracker li { font-size: 10.5px; }
  .bar-row { grid-template-columns: 110px 1fr 70px; }
  .msg { max-width: 92%; }
  .invoice-doc, .letter { padding: 20px; }
  .invoice-top { flex-direction: column; }
  .invoice-title { text-align: left; }
  .print-page { padding: 20px; }
  .auth-card { padding: 22px 18px; }
  .desk-client { grid-template-columns: minmax(0, 1fr); }
  .filters .search-input, .filters input, .filters select { min-width: 0; width: 100%; }
  .filters > * { flex: 1 1 140px; }
  .dropdown-wide { width: calc(100vw - 24px); position: fixed; left: 12px; right: 12px; top: 60px; }
  .portal-switch select { min-width: 0; max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------- Client picker ---------------- */
[data-client-picker] { position: relative; }
.picker-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-2); max-height: 280px; overflow-y: auto; }
.picker-results:empty { display: none; }
.picker-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.picker-item:hover, .picker-item:focus { background: var(--accent-wash); }
.picker-item span { min-width: 0; }
.picker-item strong { display: block; font-size: 14px; }
.picker-item small { display: block; color: var(--ink-3); font-size: 12.5px; }
.picker-item mark { background: none; color: inherit; }

/* =====================================================================
   Help, tours, hints, undo, saved views, season tools, questionnaire
   ===================================================================== */

/* Help menu in the top bar */
.help-menu { width: 340px; }
.help-menu-search { padding: 4px 4px 8px; }
.help-menu-search input { margin: 0; height: 36px; font-size: 14px; }
.help-menu-head { margin: 4px 10px 2px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.help-menu-foot { margin: 6px 10px 2px; padding-top: 8px; border-top: 1px solid var(--rule-2); font-size: 12px; color: var(--ink-3); }

/* Help center */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.help-grid .panel + .panel { margin-top: 0; }
.help-list { list-style: none; margin: 0; padding: 6px 0; }
.help-list li a { display: block; padding: 8px 18px; color: var(--ink); text-decoration: none !important; font-size: 14.5px; }
.help-list li a:hover { background: var(--accent-wash); color: var(--accent); }
.help-article { max-width: 760px; }
.help-article h1 { font: 400 30px/1.2 var(--serif); }
.help-article h2 { font-size: 17px; margin: 22px 0 8px; }
.help-article p, .help-article li { font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.help-article ul { padding-left: 22px; margin: 0 0 14px; }
.help-article ul li { margin-bottom: 4px; }
.help-steps { counter-reset: hs; list-style: none; padding: 0; margin: 4px 0 16px; }
.help-steps li { counter-increment: hs; position: relative; padding: 2px 0 10px 38px; }
.help-steps li::before { content: counter(hs); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-wash); color: var(--accent); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.help-article code { background: var(--surface-2); border: 1px solid var(--rule-2); padding: 1px 5px; border-radius: 4px; }

/* Guided tour */
.tour-shield { position: fixed; inset: 0; z-index: 400; }
.tour-spot { position: fixed; z-index: 401; border-radius: 10px; box-shadow: 0 0 0 4px var(--focus), 0 0 0 9999px rgba(8, 20, 15, .55); pointer-events: none; transition: all .2s ease; }
.tour-pop { position: fixed; z-index: 402; background: var(--surface); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 16px 18px 14px; border: 1px solid var(--rule); }
.tour-pop h3 { font: 400 20px/1.25 var(--serif); margin: 2px 0 6px; }
.tour-pop p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 12px; }
.tour-pop .tour-count { font-size: 12px; font-weight: 600; color: var(--brass); margin: 0; }
.tour-btns { display: flex; gap: 6px; align-items: center; }

/* Hints */
.tip { position: relative; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-3); font: 700 11px/1 var(--sans); cursor: help; padding: 0; margin-left: 4px; vertical-align: 1px; }
.tip:hover, .tip:focus-visible, .tip.is-open { color: var(--accent); border-color: var(--accent); }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 7px; background: var(--ink); color: var(--paper); font: 400 13px/1.45 var(--sans); text-align: left; white-space: normal; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 70; }
.tip:hover::after, .tip:focus-visible::after, .tip.is-open::after { opacity: 1; }

/* Undo in toasts */
.toast .toast-undo { margin: 0; }
.toast .toast-undo button, .toast .toast-undo-btn { border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #f4c56c; font: 700 13px var(--sans); padding: 3px 10px; border-radius: 5px; cursor: pointer; }
.toast .toast-undo button:hover, .toast .toast-undo-btn:hover { background: rgba(255, 255, 255, .1); }
.toast.has-undo { align-items: center; }

/* Saved views */
.nav-shared { font-size: 10.5px; color: var(--side-ink-2); margin-left: 4px; }
.view-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 14px; }
.view-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--rule); background: var(--surface); border-radius: 16px; padding: 2px 4px 2px 12px; font-size: 13px; }
.view-chip a { color: var(--ink-2); font-weight: 600; text-decoration: none !important; }
.view-chip a:hover { color: var(--accent); }
.view-chip.is-active { border-color: var(--primary); background: var(--accent-wash); }
.view-chip form { margin: 0; }
.view-chip button { border: 0; background: none; color: var(--ink-3); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.view-chip button:hover { background: var(--rule-2); color: var(--red); }
.filters .save-view { align-self: flex-end; }

/* Getting started */
.starter { border-color: color-mix(in srgb, var(--brass) 40%, var(--rule)); }
.starter-list { list-style: none; margin: 0; padding: 4px 0; }
.starter-list li { display: flex; align-items: center; gap: 12px; padding: 9px 18px; }
.starter-list .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule); display: grid; place-items: center; flex: none; color: transparent; }
.starter-list li.done .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.starter-list li.done .st-title { color: var(--ink-3); text-decoration: line-through; }
.starter-list .st-title { font-weight: 600; font-size: 14.5px; }
.starter-list .grow span { display: block; font-size: 13px; color: var(--ink-3); }

/* Season tools */
.season-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.season-grid .panel + .panel { margin-top: 0; }
.count-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 14px; background: var(--brass-wash); color: var(--brass); font-weight: 700; font-size: 13.5px; }
.queue { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r); background: var(--blue-wash); color: var(--ink); margin-bottom: 18px; }
.queue.is-done { background: var(--green-wash); }
.queue .bar-track { flex: 1 1 200px; height: 10px; background: color-mix(in srgb, var(--blue) 18%, transparent); }
.queue .bar-fill { background: var(--blue); transition: width .3s; }
.queue.is-done .bar-fill { background: var(--green); }
.check-cols { columns: 2; column-gap: 18px; }
.check-cols .check { break-inside: avoid; padding: 3px 0; font-size: 14px; }

/* Questionnaire */
.qa-list { list-style: none; margin: 0; padding: 0; }
.qa { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--rule-2); }
.qa:last-child { border-bottom: 0; }
.qa-q { font-weight: 600; font-size: 15.5px; }
.qa-help { display: block; color: var(--ink-3); font-size: 13px; font-weight: 400; margin-top: 2px; }
.yesno { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.yesno label { margin: 0; }
.yesno input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.yesno span { display: block; padding: 8px 18px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); cursor: pointer; background: var(--surface); }
.yesno label + label span { border-left: 1px solid var(--rule); }
.yesno input:checked + span { background: var(--primary); color: var(--on-primary); }
.yesno input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: -3px; }
.answer-yes { color: var(--green); font-weight: 700; }
.q-editor td { vertical-align: top; }
.q-editor textarea { min-height: 60px; font-size: 13.5px; }
.q-editor input, .q-editor select, .q-editor textarea { margin: 0; }

/* Split client */
.split-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.split-cols .panel + .panel { margin-top: 0; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.pick-list li { padding: 7px 18px; border-bottom: 1px dashed var(--rule-2); }

.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.session-warn .modal-box { width: min(420px, 100%); }
.session-warn h2 { font: 400 24px var(--serif); }

@media (max-width: 960px) {
  .season-grid, .split-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .help-menu { width: auto; }
  .qa { grid-template-columns: minmax(0, 1fr); }
  .check-cols { columns: 1; }
  .tip::after { left: auto; right: -8px; transform: none; }
}

/* Portal FAQ */
.faq{padding:0;overflow:hidden}
.faq-item{border-bottom:1px solid var(--rule-2)}
.faq-item:last-child{border-bottom:0}
.faq-item summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;font-weight:600;font-size:15.5px}
.faq-item summary::-webkit-details-marker{display:none}
.faq-item summary svg{flex:none;color:var(--ink-3);transition:transform .18s}
.faq-item[open] summary svg{transform:rotate(180deg)}
.faq-item summary:hover{background:var(--surface-2)}
.faq-body{padding:0 20px 18px;color:var(--ink-2)}
[hidden] { display: none !important; }
