/* Stone Surgeons CRM — Accountant page (#/accountant). Uses the app's tokens (--line, --ink, --muted, --ok, --err, --accent). */
.acct-head { margin-bottom: 12px; }
.acct-tabs { flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.acct-sub { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.acct-sub .chip { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ink); text-decoration: none; background: rgba(255, 255, 255, .6); }
.acct-sub .chip:hover { border-color: var(--accent, #2a78d6); }
.acct-sub .chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.acct-card { margin-bottom: 14px; }
.acct-card h3 { margin-top: 0; }
.acct-card h4 { margin: 14px 0 6px; font-size: 14px; }
.acct-warn { background: #fff6e5; border-color: #f3d79a; color: #6b4700; }
:not(.msg).ok { color: var(--ok, #1d7a46); font-weight: 600; }
.grow-r { margin-left: auto; }

/* phones: the CRM centres <main> with margin:auto, which makes it as wide as its widest table. Accountant tables
   scroll inside their own box instead of widening the page. */
#main.acct-main { width: 100%; min-width: 0; box-sizing: border-box; }
.acct-wrap, .tbl-wrap:has(> table.acct-tbl) { contain: inline-size; }
.acct-head .row-end, .acct-sub { min-width: 0; }
.filters.acct-filters { flex-wrap: wrap; min-width: 0; }   /* doubled class: glass.css loads after this file */
.acct-filters > *, .acct-filters .in, .acct-filters select, .acct-filters .f { min-width: 0; max-width: 100%; }
select.acct-sel { max-width: 100%; min-width: 0; text-overflow: ellipsis; }

/* tables: text columns wrap and read left to right (base .src-tbl right-aligns + no-wraps every column); money columns stay right */
.acct-tbl td:not(:first-child), .acct-tbl th:not(:first-child) { text-align: left; white-space: normal; }
.acct-tbl td.num, .acct-tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.acct-tbl tr.acct-total td { font-weight: 700; border-top: 1px solid var(--line); }
.acct-tbl tr.acct-grp td { padding-top: 14px; color: var(--ink); }
.acct-tbl tr.acct-neg td { background: #fff4f3; }
.acct-fs td:first-child { min-width: 240px; }
.acct-lines { margin: 8px 0; }
.acct-tbl .in-sm { width: 88px; min-width: 0; padding: 6px 8px; }
.acct-tbl td { vertical-align: middle; }
.acct-edit select.in { min-width: 220px; }
.acct-edit input.in-sm { width: 110px; }
.acct-totals { font-weight: 700; margin: 8px 0; }
.acct-budget input.in-sm { width: 82px; padding: 4px 6px; }
.acct-budget td:first-child { white-space: nowrap; }
.acct-sel { max-width: 100%; }

/* journal entries + bank lines */
.acct-entry { padding: 10px 14px; margin-bottom: 8px; }
.acct-entry > summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
.acct-entry > summary::-webkit-details-marker { display: none; }
.acct-entry.is-void { opacity: .6; }
.acct-entry-date { color: var(--muted); font-size: 13px; min-width: 96px; font-variant-numeric: tabular-nums; }
.acct-txn { padding: 12px 14px; margin-bottom: 10px; border-left: 4px solid var(--line); }
.acct-txn.is-out { border-left-color: var(--err); }
.acct-ai { margin: 2px 0 6px; font-size: 13px; }
.acct-ai.is-business { color: var(--ok, #1d7a46); font-weight: 600; }
.acct-ai.is-personal { color: var(--muted); }
.acct-txn.is-in { border-left-color: var(--ok, #1d7a46); }
.acct-txn-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.acct-txn-top .num { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.acct-matches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.acct-txn-form { margin-bottom: 6px; }
.acct-st { text-transform: capitalize; }
.acct-posted, .acct-paid, .acct-filed, .acct-sent, .acct-done, .acct-issued { background: #e7f6ee; color: #14633a; }
.acct-draft, .acct-open, .acct-to_issue { background: #eef2f7; color: #33475e; }
.acct-void, .acct-failed { background: #fdecea; color: #8a1f17; }
.acct-approved, .acct-replied { background: #fff6e5; color: #6b4700; }

/* receipts + letters */
.acct-receipt { display: grid; grid-template-columns: minmax(160px, 280px) 1fr; gap: 16px; align-items: start; }
.acct-receipt-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.acct-checks { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 3px; font-size: 14px; }
.acct-mail { background: rgba(255, 255, 255, .7); border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; font: 14px/1.5 inherit; }
.acct-json { font: 12.5px/1.45 ui-monospace, Consolas, monospace; width: 100%; }
.acct-person { align-self: center; min-width: 140px; }

/* overview */
.acct-alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.acct-alert { display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid var(--line); color: var(--ink); background: #f3f8fe; }
.acct-alert.warn { background: #fff6e5; border-color: #f3d79a; color: #6b4700; }
.acct-alert.bad { background: #fdecea; border-color: #f3b4ad; color: #8a1f17; }
.acct-alert:hover { filter: brightness(.97); }
.acct-deadlines, .acct-close { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.acct-check { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.acct-check li.bad strong { color: var(--err); }
.acct-deadlines li { display: flex; gap: 10px; align-items: baseline; }
.acct-deadlines li.soon .acct-entry-date { color: var(--err); font-weight: 700; }

.nav-badge.acct-badge-late { background: var(--err); color: #fff; }
.acct-home-alerts { margin: 0 0 14px; }

/* print sheets */
.acct-sheet-head h1 { margin: 0 0 4px; font-size: 22px; }
.acct-sheet-head p { margin: 0 0 2px; }
.acct-sheet h2 { font-size: 16px; margin: 18px 0 6px; }
.acct-sheet .tbl-wrap { overflow: visible; }

@media (max-width: 720px) {
  #main.acct-main .tile { min-width: 0; }
  #main.acct-main .tile b { font-size: clamp(19px, 6.2vw, 28px); overflow-wrap: anywhere; }
  .acct-receipt { grid-template-columns: 1fr; }
  .acct-fs td:first-child { min-width: 0; }
  .acct-entry-date { min-width: 0; }
}
@media print {
  .acct-sheet .acct-tbl td, .acct-sheet .acct-tbl th { padding: 3px 6px; font-size: 11px; }
}

/* Autopilot (acct-autopilot.js / acct-ask.js) + Snap a receipt (snap.js) */
.acct-sure, .acct-audit { margin: 6px 0 12px; padding-left: 18px; }
.acct-sure li, .acct-audit li { margin: 3px 0; }
.acct-audit li.warn a { color: #8a5a00; } .acct-audit li.late a { color: var(--err); }
.acct-chat { max-height: 52vh; overflow-y: auto; display: grid; gap: 10px; margin-bottom: 12px; }
.acct-msg { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); max-width: 92%; }
.acct-msg.me { justify-self: end; background: var(--ice); }
.acct-msg p, .acct-msg ul { margin: 4px 0; } .acct-msg ul { padding-left: 18px; }
/* The Surgeon (ask.js; was Ask the CRM) */
.ask-chat { max-height: 62vh; }
.ask-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ask-head h2 { margin-bottom: 0; }
.ask-tag { margin: 2px 0 12px; font-style: italic; }
.ask-usage { margin-top: 6px; white-space: nowrap; }
.ask-src { margin-top: 6px; }
.snap-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.snap-big { font-size: 18px; padding: 14px 22px; }
.snap-img { display: block; width: 100%; max-width: 420px; max-height: 60vh; object-fit: contain; margin: 0 auto 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.snap-list { list-style: none; padding: 0; margin: 0; }
.snap-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
/* e-receipts (ereceipt.js): text receipts, paste box, drag-and-drop, currency note */
.er-text { white-space: pre-wrap; word-break: break-word; max-height: 50vh; overflow: auto; margin: 0 0 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.er-kind { margin: -4px 0 10px; }
.er-paste-wrap { margin: 8px 0 4px; }
.er-paste-wrap summary { cursor: pointer; font-weight: 600; }
.er-paste { width: 100%; min-height: 110px; margin-top: 8px; font-size: 14px; }
.er-drop { outline: 2px dashed var(--blue); outline-offset: 4px; }
.er-fx { margin: -4px 0 10px; }
.er-note { margin: 0 0 12px; }
.er-logged li { flex-wrap: wrap; align-items: center; }
.er-acts { display: inline-flex; gap: 6px; }
.er-pdf { font-size: 15px; }

/* receipt details (receipt-kit.js): "More about this receipt", the split editor and the receipt page */
.rk-more { margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.rk-more summary { cursor: pointer; font-weight: 600; }
.rk-more[open] summary { margin-bottom: 8px; }
.rk-personal { margin-top: 4px; }
.rk-split { display: grid; gap: 6px; margin: 6px 0; }
.rk-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rk-row select, .rk-row input.in { flex: 1 1 130px; min-width: 0; }
.rk-row input[type=number] { flex: 0 1 110px; }
/* cost split (cost-split.js, migration 042) */
.cs { margin: 8px 0 10px; }
.cs-box { display: grid; gap: 6px; margin-top: 6px; }
.cs-rows { display: grid; gap: 6px; }
.cs-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cs-row select { flex: 1 1 140px; min-width: 0; }
.cs-money { display: inline-flex; align-items: center; gap: 3px; }
.cs-money input.cs-amt { width: 96px; }
.cs-money input.cs-pct { width: 66px; }
.rk-tbl th { text-align: left; white-space: nowrap; padding-right: 14px; color: var(--muted, #667); font-weight: 600; }
.rk-file { margin: 14px 0; }
.rk-img { display: block; width: 100%; max-width: 520px; max-height: 70vh; object-fit: contain; margin: 0 0 8px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.dur-box { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dur-box .dur-in { width: 7em; }

/* Accountant → Simulator (acct-sim.js) */
.sim-bar { align-items: flex-end; flex-wrap: wrap; }
.sim-status { align-self: center; }
.sim-range { width: 100%; margin: 10px 0 4px; accent-color: var(--brand, #1f7a3d); }
.sim-in > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.sim-in[open] > summary { margin-bottom: 10px; }
.sim-in .controls .f .in-sm { width: 5.5em; }
.sim-months td, .sim-months th { white-space: nowrap; }
.sim-split-ends { display: flex; justify-content: space-between; margin-top: 10px; }
.sim-split .sim-range { margin-top: 2px; }
.sim-picks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sim-pay td { vertical-align: top; }
.sim-pay td.num .sim-what, .sim-pay td.num .sim-flags { display: block; text-align: left; white-space: normal; min-width: 170px; max-width: 260px; }
.sim-pay .sim-flags { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.sim-pay tr.sim-sub td { padding-top: 14px; }
.sim-opt h4 { margin: 12px 0 2px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sim-opt .sim-flags { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.sim-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sim-kv > :last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sim-kv.is-total { border-bottom-width: 2px; }
.sim-sheet td:first-child .in { min-width: 150px; }
.sim-sheet td .in-sm { width: 6.5em; }
@media (max-width: 600px) { .sim-bar .btn { flex: 1 1 auto; } }

/* Accountant → Startup (097): the checklist */
.acct-startup-tbl td { vertical-align: middle; }
.acct-startup-tbl tr.is-done input[type="text"] { text-decoration: line-through; opacity: .75; }
.acct-startup-tbl .su-name .in { min-width: 190px; width: 100%; }
.acct-startup-tbl .su-qty .in { width: 72px; }
.acct-startup-tbl .su-price .in { width: 110px; }
.acct-startup-post td { padding: 6px 0 14px; }
.acct-startup-panel { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line, rgba(0, 0, 0, .12)); border-radius: 14px; max-width: 760px; white-space: normal; }
.acct-startup-panel .controls { display: flex; flex-wrap: wrap; gap: 10px; }
.acct-startup-panel .controls .f { flex: 1 1 180px; min-width: 0; }
.acct-startup-panel .msg:empty { display: none; }
/* No blur of its own inside the list, at any size. Every box, button and row here used to carry its own blur layer (165 in
   one list, re-blurred on every frame because the page background moves): iPhone Safari ran out of memory while scrolling
   and blanked or reloaded the page. The card under the list is already blurred, so the list looks the same without them.
   (.acct-startup doubles the class so these beat glass.css, which loads after this file.) */
.acct-startup .acct-startup-tbl tbody td:first-child::before,
.acct-startup .acct-startup-tbl .in, .acct-startup .acct-startup-tbl .btn { -webkit-backdrop-filter: none; backdrop-filter: none; }
/* A phone: one block per line, nothing scrolls sideways.
     [x] Name ......................
         Qty      Price      Delete
         status                      */
@media (max-width: 760px) {
  .acct-startup .tbl-wrap { overflow: visible; padding: 0; }
  .acct-startup .acct-startup-tbl, .acct-startup .acct-startup-tbl tbody { display: block; width: 100%; margin: 0; }
  .acct-startup .acct-startup-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .acct-startup .acct-startup-tbl tbody tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1.25fr) auto; align-items: end; gap: 8px 10px;
    grid-template-areas: "tick name name name" ". qty price act" ". state state state"; padding: 12px; margin: 0 0 10px; }
  .acct-startup .acct-startup-tbl td { display: block; padding: 0; min-width: 0; white-space: normal; text-align: left; }
  .acct-startup-tbl .su-tick { grid-area: tick; align-self: center; }
  .acct-startup-tbl .su-tick input { width: 24px; height: 24px; margin: 0; display: block; }
  .acct-startup-tbl .su-name { grid-area: name; align-self: center; }
  .acct-startup-tbl .su-qty { grid-area: qty; }
  .acct-startup-tbl .su-price { grid-area: price; }
  .acct-startup-tbl .su-act { grid-area: act; }
  .acct-startup-tbl .su-state { grid-area: state; overflow-wrap: anywhere; }
  .acct-startup-tbl td[data-l]::before { content: attr(data-l); display: block; margin: 0 0 3px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
  /* 16px: iPhone Safari zooms the whole page in when a box with smaller type is tapped */
  .acct-startup .acct-startup-tbl .in, .acct-startup .acct-startup-panel .in { width: 100%; min-width: 0; font-size: 16px; }
  .acct-startup-tbl .su-act .btn { min-height: 40px; }
  /* the "what was paid" panel: its own full-width block under the line */
  .acct-startup .acct-startup-tbl tbody tr.acct-startup-post { display: block; padding: 0; }
  .acct-startup-post .su-gap { display: none !important; }
  .acct-startup-panel { max-width: none; padding: 12px; }
  .acct-startup-panel .controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
  .acct-startup-panel .controls .f { margin: 0 0 10px; }
  .acct-startup-panel .acts .btn { min-height: 44px; flex: 1 1 auto; }
}

/* Accountant → Clawd: "Clawd asks you" (098) */
.clawd-ask { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line, rgba(0, 0, 0, .1)); }
.clawd-ask:first-of-type { border-top: 0; }
.clawd-ask-q { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.clawd-ask p { margin: 0; }
.clawd-ask textarea { width: 100%; max-width: 760px; min-height: 58px; resize: vertical; }
.clawd-ask.is-skipped { opacity: .7; }
.clawd-ask-group h4 { margin: 16px 0 0; }
/* UI redesign (Nov 2026): the Books check is one line ("Books check: all good" / "Books check: 2 issues"); a click opens it */
.acct-books { padding: 10px 16px; }
.acct-books > summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.acct-books > summary::-webkit-details-marker { display: none; }
.acct-books > summary::after { content: '▸'; margin-left: auto; color: var(--muted); transition: transform .15s ease; }
.acct-books[open] > summary::after { transform: rotate(90deg); }
.acct-books > summary h3 { margin: 0; font-size: 15px; }
.acct-books.bad > summary h3 { color: var(--err); }
.acct-books.ok > summary h3 { color: var(--ok); }
.acct-books[open] > summary { margin-bottom: 8px; }
.acct-books-sub { margin: 0 0 8px; }

/* 177 (Nov 25 2026): the Accountant as its own app (books.stonesurgeons.ca, <html class="books-app">). Its side menu lists
   every Accountant page, so the page's own two tab rows hide while that menu is on screen (phones keep them). The search
   box in the top bar searches CRM pages, so it goes too. */
@media (min-width: 861px) { html.books-app .acct-groups, html.books-app .acct-tabs { display: none; } }
html.books-app .top-search { visibility: hidden; }
