/* ===================== Fairway Custom Co. ===================== */
/* Layout: charcoal sidebar shell, warm off-white work surface, charcoal as the action colour */
:root {
  --bg: #f2f1ed;
  --surface: #ffffff;
  --surface-2: #f7f6f3;
  --line: #e2e0da;
  --line-2: #cecbc3;
  --ink: #232323;
  --ink-2: #4a4946;
  --muted: #7a7872;
  --brand: #2d2d2d;
  --brand-2: #2d2d2d;
  --brand-soft: #e9e7e1;
  --on-brand: #f5f4f0;
  --shell: #2d2d2d;
  --shell-ink: #f5f4f0;
  --gold: #b8b1a2;
  --note-bg: #faf6ea; --note-line: #ece2c6; --note-ink: #5a4a22; --note-label: #8e7637;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --pos: #1d7a4b;
  --neg: #b42318;
  --s-scheduled: #2e5f8f;  --s-scheduled-soft: #e6edf5;
  --s-in_progress: #b5741a; --s-in_progress-soft: #fbf0dc;
  --s-complete: #6b6f76;   --s-complete-soft: #ecedee;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 6px 18px rgba(20, 20, 20, .04);
  --shadow-lg: 0 20px 60px rgba(10, 10, 10, .28);
  --font: 'Archivo', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Anton', 'Archivo Narrow', Impact, 'Arial Narrow Bold', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616; --surface: #1f1f1f; --surface-2: #1a1a1a; --line: #303030; --line-2: #454545;
    --ink: #f2f1ed; --ink-2: #cfcdc7; --muted: #949089;
    --brand: #f5f4f0; --brand-2: #f5f4f0; --brand-soft: #2c2c2b; --on-brand: #232323; --shell: #232323; --gold: #8a8476;
    --note-bg: #2b2719; --note-line: #4a4229; --note-ink: #eadfbf; --note-label: #c9b47a;
    --danger: #f0776c; --danger-soft: #3a1f1d; --pos: #5fc48f; --neg: #f0776c;
    --s-scheduled: #6ea2d6; --s-scheduled-soft: #1c2a38;
    --s-in_progress: #e3a14a; --s-in_progress-soft: #3a2c17;
    --s-complete: #9ea2a9; --s-complete-soft: #2a2b2d;
    --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161616; --surface: #1f1f1f; --surface-2: #1a1a1a; --line: #303030; --line-2: #454545;
  --ink: #f2f1ed; --ink-2: #cfcdc7; --muted: #949089;
  --brand: #f5f4f0; --brand-2: #f5f4f0; --brand-soft: #2c2c2b; --on-brand: #232323; --shell: #232323; --gold: #8a8476;
  --note-bg: #2b2719; --note-line: #4a4229; --note-ink: #eadfbf; --note-label: #c9b47a;
  --danger: #f0776c; --danger-soft: #3a1f1d; --pos: #5fc48f; --neg: #f0776c;
  --s-scheduled: #6ea2d6; --s-scheduled-soft: #1c2a38;
  --s-in_progress: #e3a14a; --s-in_progress-soft: #3a2c17;
  --s-complete: #9ea2a9; --s-complete-soft: #2a2b2d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.break { word-break: break-word; }
.spacer { flex: 1; }

/* ---------- boot & auth ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; overflow: hidden; box-shadow: var(--shadow); text-align: center; }
.auth-logo { display: flex; justify-content: center; background: var(--shell); margin: -32px -28px 24px; padding: 34px 28px 30px; border-radius: 18px 18px 0 0; }
.auth-logo img { width: 230px; height: auto; }
.auth-card h1 { font-size: 15px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.auth-card .form { text-align: left; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-err { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 1em; }
.link-btn { background: none; border: 0; color: var(--brand-2); cursor: pointer; padding: 6px 0; font-size: 14px; }
.btn.google { background: var(--surface); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--shell); color: var(--shell-ink); display: flex; flex-direction: column; padding: 22px 14px 18px; }
.brand { display: flex; align-items: center; padding: 6px 10px 30px; }
.brand-logo { display: block; width: 168px; height: auto; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.72); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.11); color: #fff; box-shadow: inset 3px 0 0 #f5f4f0; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.mode-chip { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255,255,255,.7); padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.06); overflow: hidden; }
.mode-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-chip.demo { color: #f5f4f0; background: rgba(255,255,255,.08); text-transform: uppercase; letter-spacing: .12em; font-size: 11.5px; justify-content: center; font-weight: 600; letter-spacing: .02em; }
.side-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: rgba(255,255,255,.65); padding: 6px 10px; cursor: pointer; font-size: 13.5px; border-radius: 8px; }
.side-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.main { min-width: 0; }
.view { max-width: 1240px; margin: 0 auto; padding: 30px 34px 72px; }
.banner { display: flex; align-items: center; gap: 10px; background: var(--note-bg); color: var(--note-ink); border-bottom: 1px solid var(--note-line); padding: 9px 34px; font-size: 13.5px; }
.banner span { flex: 1; }
.banner code { background: transparent; border-color: var(--note-line); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 40px; font-weight: 400; line-height: 1.02; letter-spacing: .005em; text-transform: uppercase; text-wrap: balance; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lede { color: var(--muted); margin-top: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .seg button:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.25); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost.danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--brand-2); color: var(--brand-2); background: var(--brand-soft); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button, .seg label span { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button.on, .seg label input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg-sm button, .seg-sm label span { padding: 5px 12px; font-size: 13px; }
.seg.period { margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 28px 0 16px; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs em { font-style: normal; background: var(--brand-soft); color: var(--brand-2); padding: 1px 7px; border-radius: 999px; font-size: 12px; margin-left: 4px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .section-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.section-head:not(:first-child) { margin-top: 26px; }
.count { font-size: 12.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); border-radius: 999px; padding: 1px 9px; }
.empty { padding: 28px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-line { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.s-scheduled, .pill.st-sent { background: var(--s-scheduled-soft); color: var(--s-scheduled); }
.badge.s-in_progress, .pill.st-partial { background: var(--s-in_progress-soft); color: var(--s-in_progress); }
.badge.s-complete, .pill.st-draft, .pill.st-declined { background: var(--s-complete-soft); color: var(--s-complete); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.st-accepted, .pill.st-paid { background: var(--brand-soft); color: var(--pos); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.s-scheduled { background: var(--s-scheduled); } .dot.s-in_progress { background: var(--s-in_progress); } .dot.s-complete { background: var(--s-complete); }
.flag { font-size: 11.5px; font-weight: 700; color: var(--brand-2); background: var(--brand-soft); padding: 1px 7px; border-radius: 6px; }
.flag.warn { color: var(--danger); background: var(--danger-soft); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fld > span em { color: var(--danger); font-style: normal; }
.fld input, .fld select, .fld textarea, .add-row input, .task-text, .search-bar input, .picker-search input, .items-ed input, .items-ed textarea {
  width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.fld textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .add-row input:focus, .task-text:focus, .search-bar input:focus, .picker-search input:focus, .items-ed input:focus, .items-ed textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.fld input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.fld select { appearance: none; 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='%23767c76' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important; font-size: 13px !important; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.span2 { grid-column: span 2; }
.inline2 { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.input-btn { display: flex; gap: 8px; align-items: center; }
.input-btn > input, .input-btn > .money-in { flex: 1; }
.input-btn .btn { height: 42px; }
.money-in { position: relative; }
.money-in > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.money-in input { padding-left: 26px !important; width: 100%; }
.box-set { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; margin: 0; background: var(--surface-2); }
.box-set legend { font-weight: 700; font-size: 13px; padding: 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.box-set legend small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-left: 4px; }
.profit-out { display: flex; flex-direction: column; justify-content: center; gap: 2px; font-size: 13px; color: var(--muted); font-weight: 600; min-height: 42px; }
.profit-out strong { font-size: 19px; letter-spacing: -.01em; }
.profit-out.wide { flex-direction: row; align-items: baseline; gap: 10px; margin-top: 10px; min-height: 0; }
.add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.add-row.slim { margin: 10px 0 0; }
.add-row.slim input { height: 36px; font-size: 14px; background: var(--surface-2); }
.add-row.slim input:focus { background: var(--surface); }

/* ---------- checklists ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; background: var(--surface); transition: background .15s, border-color .15s; margin-top: 0; }
.check:hover .box { border-color: var(--brand-2); }
.check input:checked + .box { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--brand-soft); }
.check .txt { line-height: 1.45; padding-top: 1px; }
.checklist li.done .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.inline-check { padding: 4px 0; }
.task-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task-edit:empty { display: none; }
.task-edit li { display: flex; align-items: center; gap: 8px; }
.task-edit .check { padding: 0; }
.task-text { height: 38px !important; }

/* ---------- today ---------- */
.today-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
.todo-card { padding: 18px 18px 8px; position: sticky; top: 20px; }
.job-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 14px; margin-bottom: 14px; border-left: 4px solid var(--s-scheduled); }
.job-card.s-in_progress { border-left-color: var(--s-in_progress); }
.jc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; cursor: pointer; }
.jc-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.jc-head:hover h3 { color: var(--brand-2); }
.jc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 3px; }
.jc-addr { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; text-decoration: none; margin-top: 8px; }
.jc-addr:hover { color: var(--brand-2); text-decoration: underline; }
.jc-prog { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.progress { flex: 1; height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; transition: width .3s; }
.detail .progress { margin-bottom: 4px; }
.jc-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mini-list { display: flex; flex-direction: column; }
.mini-list.card { padding: 4px 6px; }
.mini-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 11px 10px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; border-radius: 8px; width: 100%; }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--surface-2); }
.mini-row > span:nth-child(2) { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mini-row small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.mini-row > span.muted { font-size: 13.5px; white-space: nowrap; }

/* ---------- client link & avatars ---------- */
.client-link { background: none; border: 0; padding: 0; color: var(--brand-2); font-weight: 600; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: text-decoration-color .15s; }
.client-link:hover { text-decoration-color: currentColor; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); display: inline-grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12.5px; }
.avatar.xs { width: 28px; height: 28px; border-radius: 8px; font-size: 11.5px; }

/* ---------- schedule ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 500; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.s-scheduled, .cal-dots i.s-scheduled { background: var(--s-scheduled); }
.legend i.s-in_progress, .cal-dots i.s-in_progress { background: var(--s-in_progress); }
.legend i.s-complete, .cal-dots i.s-complete { background: var(--s-complete); }
.cal-card { overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 10px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 6px 8px; cursor: pointer; min-width: 0; transition: background .12s; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.012) 6px 12px), var(--surface-2); }
.cal-cell.out .cal-date span { color: var(--muted); opacity: .6; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--brand-2); }
.cal-date { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-date span { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-date span { background: var(--brand); color: var(--on-brand); }
.cal-add { opacity: 0; border: 0; background: var(--brand-soft); color: var(--brand-2); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; transition: opacity .12s; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-evs { display: flex; flex-direction: column; gap: 3px; }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; font-size: 12px; font-weight: 600; padding: 3px 7px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; line-height: 1.35; border-left: 3px solid; }
.cal-ev.s-scheduled { background: var(--s-scheduled-soft); color: var(--s-scheduled); border-left-color: var(--s-scheduled); }
.cal-ev.s-in_progress { background: var(--s-in_progress-soft); color: var(--s-in_progress); border-left-color: var(--s-in_progress); }
.cal-ev.s-complete { background: var(--s-complete-soft); color: var(--s-complete); border-left-color: var(--s-complete); }
.cal-ev.cont { opacity: .78; }
.cal-ev:hover { filter: brightness(.96); opacity: 1; }
.cal-more { font-size: 11.5px; color: var(--muted); font-weight: 600; padding-left: 4px; }
.cal-dots { display: none; }
.day-panel { margin-top: 18px; padding: 18px; }
.day-jobs { display: flex; flex-direction: column; gap: 10px; }
.day-job { display: flex; justify-content: space-between; gap: 14px; padding: 13px 15px; border: 1px solid var(--line); border-left: 4px solid var(--s-scheduled); border-radius: 11px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.day-job:hover { background: var(--surface-2); }
.day-job.s-in_progress { border-left-color: var(--s-in_progress); }
.day-job.s-complete { border-left-color: var(--s-complete); }
.dj-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.dj-main strong { font-size: 15.5px; }
.dj-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
.list-card { padding: 18px; margin-bottom: 18px; }
.group-h { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 8px; }
.group-h:first-of-type { margin-top: 0; }

/* ---------- clients ---------- */
.search-bar { position: relative; margin-bottom: 18px; }
.search-bar .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-bar input { height: 48px; padding-left: 44px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px; }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.client-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s; }
.client-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.cc-top { display: flex; gap: 12px; align-items: center; }
.cc-name { display: flex; flex-direction: column; min-width: 0; }
.client-link.name { font-size: 16.5px; color: var(--ink); }
.client-link.name:hover { color: var(--brand-2); }
.cc-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.cc-lines li { display: flex; gap: 8px; align-items: center; min-width: 0; }
.cc-lines .ic { color: var(--muted); }
.cc-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-notes { font-size: 13.5px; color: var(--note-ink); background: var(--note-bg); border: 1px solid var(--note-line); padding: 8px 10px; border-radius: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-next { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.cc-next strong { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- modals ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 22, 18, .45); opacity: 0; transition: opacity .18s; backdrop-filter: blur(2px); }
.modal { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px) scale(.985); transition: opacity .18s, transform .18s; }
.modal-wrap.open .modal-backdrop { opacity: 1; }
.modal-wrap.open .modal { opacity: 1; transform: none; }
.size-sm .modal { max-width: 420px; }
.size-lg .modal { max-width: 780px; }
.size-full .modal { max-width: 1160px; height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
.confirm-msg { font-size: 15.5px; line-height: 1.55; }

.contact-actions { display: flex; flex-direction: column; gap: 8px; }
.contact-act { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: background .15s, border-color .15s; }
.contact-act:hover { background: var(--surface-2); border-color: var(--line-2); }
.ca-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex: none; }
.ca-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ca-txt span { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-act > .ic:last-child { color: var(--muted); }
.note-box { margin-top: 14px; background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink); border-radius: 11px; padding: 11px 13px; font-size: 14.5px; }
.note-box span { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--note-label); margin-bottom: 3px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-bottom: 18px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 6px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); text-decoration: none; font-weight: 600; font-size: 13px; }
.qa:hover { filter: brightness(.97); }

.detail .kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin-bottom: 18px; }
.kv > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 3px; }
.kv > div { font-size: 15px; }
.kv small { display: block; color: var(--muted); font-size: 13.5px; }
.link { display: inline-flex; align-items: flex-start; gap: 5px; color: var(--brand-2); text-decoration: none; }
.link .ic { margin-top: 3px; }
.link:hover { text-decoration: underline; }
.desc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; margin-bottom: 18px; color: var(--ink-2); }
.fin-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-variant-numeric: tabular-nums; }
.fin-table th, .fin-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; font-size: 14.5px; }
.fin-table th:first-child { text-align: left; font-weight: 500; color: var(--ink-2); }
.fin-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.fin-table tr.total th, .fin-table tr.total td { font-weight: 700; border-bottom: 0; font-size: 15.5px; }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 6px; }
.sub-head h3 { font-size: 15px; font-weight: 700; }

/* ---------- client picker ---------- */
.picker { position: relative; }
.picked { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-2); border-radius: 11px; padding: 8px 8px 8px 10px; background: var(--surface-2); }
.picked > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picked > div span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-search { position: relative; }
.picker-ic { position: absolute; left: 12px; top: 13px; color: var(--muted); pointer-events: none; }
.picker-search input { padding-left: 36px; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 10; padding: 6px; max-height: 320px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.picker-item:hover { background: var(--surface-2); }
.picker-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.picker-item small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item.add { color: var(--brand-2); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; padding-top: 11px; }
.picker-empty { color: var(--muted); padding: 8px 10px; font-size: 14px; }

/* ---------- billing ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi > span { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi strong { font-family: var(--font-display); font-weight: 400; font-size: 30px; letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { color: var(--muted); font-size: 13px; }
.kpi.hero { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.kpi.hero > span, .kpi.hero small { color: var(--on-brand); opacity: .72; }
.chart-card { padding: 18px; }
.legend i.c-inc, .bar.inc { background: var(--brand-2); }
.legend i.c-exp, .bar.exp { background: var(--gold); }
.mchart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; height: 190px; margin-bottom: 8px; }
.mcol { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; min-width: 0; }
.mbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); }
.bar { width: min(26px, 38%); border-radius: 5px 5px 0 0; min-height: 2px; transition: height .4s; }
.mlab { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mval { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.bill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; }
.bill-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.bc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.bc-top > div { display: flex; flex-direction: column; min-width: 0; }
.bc-top strong { font-size: 16px; }
.bc-top span { font-size: 13.5px; color: var(--muted); }
.bc-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bc-nums span { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bc-nums strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.est-tag { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--s-in_progress); font-weight: 600; }
.doc-list { padding: 6px; }
.doc-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 120px 120px 110px 40px; align-items: center; gap: 12px; padding: 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 9px; }
.doc-row:hover { background: var(--surface-2); }
.dr-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.dr-main { display: flex; flex-direction: column; min-width: 0; }
.dr-main span { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-date { color: var(--muted); font-size: 14px; }
.dr-total { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.doc-row .pill { justify-self: start; }
.doc-list-foot { padding: 10px; }
.doc-list .empty { padding: 26px; }

/* ---------- quote / receipt editor ---------- */
.doc-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.doc-form { gap: 0; }
.ed-sec { padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.ed-sec:last-child { border-bottom: 0; }
.ed-sec h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.doc-form > .seg { align-self: flex-start; margin-bottom: 18px; }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.items-ed { width: 100%; border-collapse: separate; border-spacing: 0 6px; min-width: 640px; }
.items-ed th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; text-align: left; padding: 0 4px; }
.items-ed th.r, .items-ed .c-amt { text-align: right; }
.items-ed td { padding: 0 3px; vertical-align: top; }
.items-ed input { height: 40px; padding: 0 9px; }
.items-ed textarea { height: 40px; padding: 9px 10px; resize: none; overflow: hidden; line-height: 1.4; display: block; }
.c-qty { width: 82px; } .c-unit { width: 104px; } .c-rate { width: 112px; } .c-amt { width: 110px; padding-top: 10px !important; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; } .c-rm { width: 40px; }
.items-actions { display: flex; gap: 8px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.presets > span { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.doc-side { position: sticky; top: 0; }
.totals-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: none; background: var(--surface-2); }
.totals-card h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tot-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.tot-row span { color: var(--ink-2); }
.tot-row.grand { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 10px; font-size: 18px; }
.tot-row.grand span { color: var(--ink); font-weight: 700; }
.tot-row.due strong { color: var(--s-in_progress); }
.tot-row.paid strong { color: var(--pos); }
#doc-totals { margin-bottom: 6px; }

/* ---------- settings ---------- */
.set-sec { padding: 20px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
.set-sec h2 { font-size: 16px; }
.settings { gap: 0; }
.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; margin: 0 0 22px; z-index: 5; }
.save-bar .btn { box-shadow: var(--shadow-lg); height: 46px; padding: 0 22px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--shell); color: var(--shell-ink); border: 1px solid rgba(255,255,255,.08); padding: 11px 12px 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 14px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-btn { background: rgba(255,255,255,.14); color: #fff; border: 0; padding: 6px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.toast:not(:has(.toast-btn)) { padding-right: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-editor { grid-template-columns: 1fr; }
  .doc-side { position: static; order: -1; }
  .totals-card { display: grid; grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .today-grid { grid-template-columns: 1fr; }
  .todo-card { position: static; }
  .doc-row { grid-template-columns: 70px minmax(0, 1fr) auto 36px; }
  .dr-date, .doc-row .pill { display: none; }
}
@media (max-width: 820px) {
  body { font-size: 15.5px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(0,0,0,.05); }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px 5px; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 10px; }
  .nav a:hover { background: transparent; color: var(--ink); }
  .nav a.active { background: transparent; color: var(--ink); box-shadow: none; }
  .nav a.active .ic { background: var(--brand-soft); border-radius: 999px; padding: 3px 14px; width: 50px; height: 28px; }
  .nav a .ic { padding: 3px 14px; width: 50px; height: 28px; }
  .view { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .banner { padding: 9px 16px; font-size: 13px; align-items: flex-start; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head h1 { font-size: 34px; }
  .head-actions .btn { height: 38px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .kv-grid { grid-template-columns: 1fr !important; }
  .hide-sm { display: none; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal, .size-sm .modal, .size-lg .modal, .size-full .modal { max-width: none; max-height: 94vh; height: auto; border-radius: 18px 18px 0 0; transform: translateY(30px); }
  .size-full .modal, .size-lg .modal { height: 94vh; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { padding: 0 12px; }
  .modal-body { padding: 18px 16px; }
  .modal-head { padding: 14px 10px 12px 16px; }
  .cal-toolbar .legend { order: 3; width: 100%; }
  .cal-head div { padding: 8px 0; text-align: center; font-size: 11px; letter-spacing: .04em; }
  .cal-cell { min-height: 58px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; }
  .cal-date { justify-content: center; margin: 0; }
  .cal-date span { font-size: 14px; min-width: 30px; height: 30px; border-radius: 50%; }
  .cal-cell.sel { box-shadow: none; background: var(--brand-soft); }
  .cal-add, .cal-evs { display: none; }
  .cal-dots { display: flex; gap: 3px; justify-content: center; margin-top: 4px; }
  .cal-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
  .day-job { flex-direction: column; gap: 8px; }
  .dj-side { flex-direction: row; align-items: center; }
  .client-grid, .bill-grid { grid-template-columns: 1fr; }
  .kpi strong { font-size: 24px; }
  .mchart { height: 150px; gap: 4px; }
  .mval { font-size: 11px; }
  .tabs { overflow-x: auto; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .save-bar { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .fld input, .fld select, .fld textarea, .add-row input, .search-bar input, .picker-search input, .items-ed input, .items-ed textarea { font-size: 16px; } /* stop iOS zoom */
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: 21px; }
  .seg.period { display: flex; overflow-x: auto; }
  .seg.period button { padding: 7px 10px; }
}

/* ===================== Print (quotes & receipts) ===================== */
#print-root { display: none; }
@media print {
  @page { size: letter; margin: 0.5in; }
  html, body { background: #fff !important; color: #1a1a1a !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
}
.pdoc { font: 10.5pt/1.45 var(--font); color: #1a1a1a; background: #fff; position: relative; max-width: 7.5in; margin: 0 auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pdoc h1 { font-size: 16pt; letter-spacing: -.01em; color: #2d2d2d; }
.pdoc p { margin: 0; }
.pd-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 3px solid #2d2d2d; }
.pd-co { display: flex; gap: 14px; align-items: flex-start; }
.pd-logo { max-width: 90px; max-height: 70px; object-fit: contain; }
.pd-brand { width: 2.4in; height: auto; display: block; margin-bottom: 8px; }
.pd-co.stack { flex-direction: column; gap: 0; }
.pd-tag { color: #6b6b6b; font-weight: 600; font-size: 9pt; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px !important; }
.pd-co p { font-size: 9.5pt; color: #444; }
.pd-title { text-align: right; }
.pd-title h2 { font-family: var(--font-display); font-size: 34pt; letter-spacing: .04em; color: #2d2d2d; font-weight: 400; line-height: 1; margin-bottom: 8px; }
.pd-meta { margin-left: auto; border-collapse: collapse; font-size: 9.5pt; }
.pd-meta th { text-align: right; padding: 1px 10px 1px 0; color: #666; font-weight: 500; }
.pd-meta td { text-align: right; font-weight: 600; }
.pd-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0; }
.pd-parties > div, .pd-project { background: #f3f2ee; border-radius: 6px; padding: 10px 12px; }
.pdoc h4 { font-size: 8pt; text-transform: uppercase; letter-spacing: .1em; color: #2d2d2d; margin-bottom: 4px; }
.pd-name, .pd-ptitle { font-weight: 700; font-size: 11pt; }
.pd-project { margin-bottom: 18px; }
.pd-items { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.pd-items th { background: #2d2d2d; color: #f5f4f0; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .06em; padding: 7px 8px; text-align: left; }
.pd-items td { padding: 8px; border-bottom: 1px solid #e3e0d6; vertical-align: top; }
.pd-items .r { text-align: right; white-space: nowrap; }
.pd-items tbody tr:nth-child(even) td { background: #fafaf7; }
.pd-blank { height: 60px; }
.pd-bottom { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; page-break-inside: avoid; }
.pd-left { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pd-totals { border-collapse: collapse; min-width: 260px; font-variant-numeric: tabular-nums; }
.pd-totals th { text-align: left; font-weight: 500; color: #444; padding: 4px 16px 4px 0; }
.pd-totals td { text-align: right; padding: 4px 0; font-weight: 600; }
.pd-totals tr.grand th, .pd-totals tr.grand td { border-top: 2px solid #2d2d2d; padding-top: 7px; font-size: 12.5pt; font-weight: 700; color: #2d2d2d; }
.pd-totals tr.grand.zero td { color: #1c7a4a; }
.pd-stamp { align-self: flex-start; margin: 4px 0 6px 6px; transform: rotate(-8deg); border: 3px solid #1c7a4a; color: #1c7a4a; font-weight: 800; font-size: 20pt; letter-spacing: .12em; padding: 4px 14px; border-radius: 8px; opacity: .8; }
.pd-fine { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-top: 22px; padding-top: 14px; border-top: 1px solid #e3e0d6; font-size: 9pt; color: #333; page-break-inside: avoid; }
.pd-block p { font-size: 9pt; }
.pd-sign { margin-top: 26px; page-break-inside: avoid; font-size: 9.5pt; }
.pd-lines { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 20px; margin-top: 36px; }
.pd-lines div { font-size: 8.5pt; color: #666; }
.pd-lines span { display: block; border-bottom: 1px solid #1a1a1a; margin-bottom: 4px; height: 1px; }
.pd-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid #e3e0d6; text-align: center; font-size: 8.5pt; color: #777; }

.pdoc-frame { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; overflow-x: auto; }
.pdoc-frame .pdoc { min-width: 640px; }

/* ---------- invoices, payments, expenses, HST ---------- */
.pill.st-unpaid { background: var(--s-scheduled-soft); color: var(--s-scheduled); }
.pill.st-overdue { background: var(--danger-soft); color: var(--danger); }
.mini-row .pill { font-size: 11px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.dr-main span.late { color: var(--danger); font-weight: 600; }
.type-hint { margin: -8px 0 16px; }
.pay-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pay-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 36px; gap: 10px; align-items: center; padding: 8px 6px 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.pay-row:last-child { border-bottom: 0; }
.pay-row span:nth-child(2) { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-add { display: grid; grid-template-columns: 150px 140px 150px minmax(0, 1fr) auto; gap: 10px; align-items: end; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.pay-add .btn { height: 42px; }
.paid-note { color: var(--pos); font-weight: 600; }
.kpi-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s; }
.kpi-btn:hover { border-color: var(--line-2); }
.kpi.warn { border-color: var(--danger); box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
.kpi.warn small { color: var(--danger); font-weight: 600; }
.tabs em.alert { background: var(--danger-soft); color: var(--danger); }
.tab-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exp-layout, .hst-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.hst-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.exp-list, .exp-side, .hst-card { padding: 18px; }
.exp-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.exp-side h3, .export-box h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.exp-side h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.exp-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.exp-row:hover { background: var(--surface-2); }
.er-date { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.er-main { display: flex; flex-direction: column; min-width: 0; }
.er-main span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.er-amt { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.er-amt span { font-size: 12px; color: var(--muted); }
.cat { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.cat-bars { display: flex; flex-direction: column; gap: 9px; }
.cb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cb-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cb-track i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.hst-line { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hst-line .ln { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; text-align: center; padding: 1px 0; }
.hst-line .lbl { color: var(--ink-2); }
.hst-line strong { font-size: 16px; }
.hst-line.total { border-bottom: 0; }
.hst-line.total .lbl { font-weight: 700; color: var(--ink); }
.hst-line.total strong { font-family: var(--font-display); font-weight: 400; font-size: 28px; letter-spacing: .01em; }
.hst-line.total.refund strong { color: var(--pos); }
.hst-card > .muted.small { margin-top: 10px; }
.warn-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink); font-size: 14px; }
.warn-box .ic { margin-top: 2px; flex: none; }
.warn-box .link-btn { padding: 0; font-size: inherit; text-decoration: underline; color: inherit; font-weight: 600; }
.export-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.late-card { background: var(--surface); border: 1px solid var(--danger); border-radius: var(--radius); box-shadow: inset 4px 0 0 var(--danger), var(--shadow); padding: 14px 16px; margin-bottom: 20px; }
.lc-head { display: flex; gap: 10px; align-items: flex-start; color: var(--danger); }
.lc-head div { display: flex; flex-direction: column; }
.lc-head strong { color: var(--ink); }
.lc-head span { color: var(--muted); font-size: 13.5px; }
.lc-list { display: flex; flex-direction: column; margin-top: 8px; }
.lc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 4px; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.lc-row:hover { background: var(--surface-2); }
.lc-row span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) {
  .exp-layout, .hst-layout { grid-template-columns: 1fr; }
  .exp-side { position: static; }
  .pay-add { grid-template-columns: 1fr 1fr; }
  .pay-add .btn { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .exp-row { grid-template-columns: minmax(0, 1fr) auto; }
  .er-date { grid-column: 1 / -1; order: -1; margin-bottom: -6px; }
  .exp-row .cat { display: none; }
  .pay-row { grid-template-columns: 90px minmax(0, 1fr) auto 32px; }
  .lc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lc-row .muted { grid-column: 1; grid-row: 2; font-size: 13px; }
  .lc-row strong { grid-row: 1 / 3; grid-column: 2; }
  .head-actions .btn { padding: 0 12px; }
}
#pay-box { display: flex; flex-direction: column; gap: 12px; }
.tabs button { white-space: nowrap; flex: none; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.seg.period button { white-space: nowrap; flex: none; }
.seg.period { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.dr-num { white-space: nowrap; }
@media (max-width: 960px) { .doc-row { grid-template-columns: auto minmax(0, 1fr) auto 36px; } }
