/* Team Shaw invoicing: staff screens. Light by default; dark when the system is. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #1f7a4d;
  --accent-hover: #186540;
  --accent-soft: #e7f3ec;
  --focus: #2563eb;
  --amber: #a16207;  --amber-bg: #fef6e0;  --amber-line: #f5dfa0;
  --red: #b42318;    --red-bg: #fdecea;    --red-line: #f5c2bd;
  --blue: #1d4ed8;   --blue-bg: #eaf1fe;   --blue-line: #c3d5fb;
  --violet: #6d28d9; --violet-bg: #f1ebfd; --violet-line: #d9c8f8;
  --green: #15803d;  --green-bg: #e8f6ed;  --green-line: #bfe3cc;
  --cyan: #0e7490;   --cyan-bg: #e6f6fa;   --cyan-line: #a9dde9;
  --fuchsia: #a21caf; --fuchsia-bg: #fbeefc; --fuchsia-line: #efc2f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1117; --surface: #151b23; --surface-2: #1a212b; --ink: #e6edf3; --ink-2: #c9d1d9;
    --muted: #8b949e; --line: #2a313c; --line-strong: #3a424e; --accent: #3fb37a; --accent-hover: #52c48b;
    --accent-soft: #15301f; --focus: #58a6ff;
    --amber: #e3b341; --amber-bg: #2d2410; --amber-line: #5a4613;
    --red: #f47067;   --red-bg: #321614;   --red-line: #6b2620;
    --blue: #6cb6ff;  --blue-bg: #122139;  --blue-line: #1f3f6b;
    --violet: #b392f0; --violet-bg: #231a38; --violet-line: #45326e;
    --green: #57d38c; --green-bg: #12291b;  --green-line: #1f4d31;
    --cyan: #56d4e8;  --cyan-bg: #0d2a31;  --cyan-line: #1b5562;
    --fuchsia: #e47cf0; --fuchsia-bg: #2c1530; --fuchsia-line: #5e2b66;
    --shadow: none; --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.num, .amount { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---- top bar ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; text-decoration: none; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; line-height: 1.2; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 550; }
.nav a.active { color: var(--ink); background: var(--bg); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.topbar-user form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-button:hover { color: var(--ink); }

/* ---- page ---- */
.page { max-width: 1320px; margin: 0 auto; padding: 28px 24px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 550 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red-line); }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- form controls ---- */
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: 14px var(--font); }
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
label.field { display: grid; gap: 5px; }
label.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
label.field > span em { font-style: normal; font-weight: 500; color: var(--muted); }
fieldset.field { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
fieldset.field > legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 5px; }
fieldset.field > label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
fieldset.checklist { border: 1px solid var(--amber-line); background: var(--amber-bg); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; display: grid; gap: 8px; }
fieldset.checklist > legend { font-size: 12px; font-weight: 600; color: var(--amber); padding: 0 4px; }
fieldset.checklist > label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.35; }
fieldset.checklist > label input { margin-top: 2px; flex: none; }
fieldset.checklist > p { margin: 0; }
fieldset.checklist[hidden], .callout[hidden] { display: none; }
.checklist-stale { margin: 0 0 12px; }
fieldset.checklist > .checklist-block { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--red-bg); border: 1px solid var(--red-line); color: var(--red); font-size: 13px; font-weight: 600; }
.address-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
fieldset.address { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
fieldset.address > legend { font-size: 13px; font-weight: 600; color: var(--ink); padding: 0; margin-bottom: 6px; }
.address-line { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field-grid .span-2 { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ---- 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: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 16px 18px; }

/* ---- queue: category switch, tabs, search ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.segmented a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.segmented a.active { background: var(--ink); color: var(--surface); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; }
.segmented a.active .count { background: color-mix(in srgb, var(--surface) 22%, transparent); color: var(--surface); }
.search { position: relative; width: 300px; max-width: 100%; }
.search input { padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.doc-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.doc-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; text-align: left; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: 13.5px var(--font); cursor: pointer; }
.doc-list button:hover { background: var(--surface-2); }
/* Whole file names (ZC, 2026-10-27): the name has its own row and wraps, even inside a
   long unbroken name; the folder and date go underneath. */
.doc-list .doc-name { grid-column: 1 / -1; overflow-wrap: anywhere; line-height: 1.35; }
.doc-list .doc-where { font-size: 12px; color: var(--muted); grid-row: 2; grid-column: 1; overflow-wrap: anywhere; }
.doc-list button > .muted { grid-row: 2; grid-column: 2; }
.doc-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.doc-split .doc-list { max-height: 640px; }
.doc-list button[aria-current="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.doc-preview { display: grid; grid-template-rows: auto 640px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.doc-preview[hidden] { display: none; }
.doc-preview .viewer-head { padding: 8px 10px; }
@media (max-width: 900px) { .doc-split { grid-template-columns: minmax(0, 1fr); } .doc-preview { grid-template-rows: auto 480px; } }
.subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.subs li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.subs li:last-child { border-bottom: 0; }
.subs-total { white-space: nowrap; }
.subs li > span:first-child { min-width: 0; }
.row-end { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.vendor-costs { max-height: 420px; overflow-y: auto; }
.vendor-costs li { align-items: center; }
.btn[hidden] { display: none; }
.psa-note { white-space: pre-wrap; font-size: 13px; line-height: 1.45; max-height: 360px; overflow-y: auto; }
dialog.viewer { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 48px); max-width: none; max-height: none; padding: 0; display: none; }
dialog.viewer[open] { display: grid; grid-template-rows: auto 1fr; }
.viewer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
/* A long name keeps a usable width; the buttons drop below it when there isn't room. */
.viewer-title { flex: 1 1 220px; min-width: 0; display: grid; }
.viewer-title b { overflow-wrap: anywhere; }
@media (max-width: 640px) { .viewer-title { flex-basis: 100%; } }
.viewer-body { position: relative; background: var(--surface-2); }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.viewer-empty[hidden], .viewer-body iframe[hidden] { display: none; }
@media (max-width: 640px) { .viewer-count { display: none; } }
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter { display: grid; gap: 4px; min-width: 170px; flex: 0 1 220px; }
.filter span { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter select:disabled { opacity: .6; }
.filter-clear { font-size: 13px; padding: 9px 4px; }
@media (max-width: 640px) { .filter { flex: 1 1 100%; } }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 0 11px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a.active .count { background: var(--accent-soft); color: var(--accent); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; }
.rows tbody tr { cursor: pointer; }
.rows tbody tr:hover td { background: var(--surface-2); }
.rows a.row-link { text-decoration: none; font-weight: 600; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-queued { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge-hold { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge-generated { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-line); }
.badge-pending_audit { color: var(--violet); background: var(--violet-bg); border-color: var(--violet-line); }
.badge-audited { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.badge-audit_hold { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge-noted { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge-discarded { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
/* Revision and void requests (ZC, 2026-10-29): queued like any other, marked. */
.badge-revision { color: var(--cyan); background: var(--cyan-bg); border-color: var(--cyan-line); }
.badge-void { color: var(--fuchsia); background: var(--fuchsia-bg); border-color: var(--fuchsia-line); }
.rows tbody tr.row-revision td { background: var(--cyan-bg); }
.rows tbody tr.row-void td { background: var(--fuchsia-bg); }
.rows tbody tr.row-revision td:first-child { box-shadow: inset 3px 0 var(--cyan); }
.rows tbody tr.row-void td:first-child { box-shadow: inset 3px 0 var(--fuchsia); }
.rows tbody tr.row-revision:hover td, .rows tbody tr.row-void:hover td { background: var(--surface-2); }
.checks { display: inline-flex; align-items: center; gap: 5px; color: var(--amber); font-size: 12.5px; font-weight: 600; }

/* ---- empty state ---- */
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---- callouts and flashes ---- */
.callout { display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.callout svg { flex: none; margin-top: 2px; }
.callout h3 { margin: 0 0 2px; font-size: 13.5px; }
.callout p, .callout ul { margin: 0; font-size: 13px; }
.callout ul { padding-left: 18px; }
.callout-amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.callout-red { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.callout-green { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.callout-blue { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue); }
.callout-revision { background: var(--cyan-bg); border-color: var(--cyan-line); color: var(--cyan); }
.callout-void { background: var(--fuchsia-bg); border-color: var(--fuchsia-line); color: var(--fuchsia); }
.callout-revision .body h3 { color: var(--cyan); } .callout-void .body h3 { color: var(--fuchsia); }
.callout .body { flex: 1; color: var(--ink-2); }
.callout .body h3 { color: inherit; }
.callout-amber .body h3 { color: var(--amber); } .callout-red .body h3 { color: var(--red); }
.callout-green .body h3 { color: var(--green); } .callout-blue .body h3 { color: var(--blue); }
.callout .actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid; font-size: 13.5px; }
.flash-success { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.flash-error { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.flash-warning { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }

/* ---- request page ---- */
.request-head { display: flex; justify-content: flex-start; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.request-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.meta b { color: var(--ink-2); font-weight: 600; }
.request-total { text-align: left; flex: none; padding-right: 20px; border-right: 1px solid var(--line); }
.request-total .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.request-total .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

.lines td { padding: 8px 10px; vertical-align: top; }
.lines th { padding: 9px 10px; }
.lines td:first-child, .lines th:first-child { padding-left: 18px; }
.lines td:last-child, .lines th:last-child { padding-right: 14px; }
.lines .col-product { width: 36%; }
.lines .col-class { width: auto; }
.lines .col-amount { width: 124px; }
/* Description and service date share the product cell's second row (ZC, 2026-10-30). */
.lines .line-sub { display: flex; gap: 6px; }
.lines .line-sub input[type="text"] { flex: 1; min-width: 0; }
.lines .line-sub input[type="date"] { flex: none; width: 140px; }
.lines td.stacked > * + * { margin-top: 6px; }
.new-lines .col-product { width: 30%; }
.lines .col-tax { width: 64px; text-align: center; }
.lines .col-x { width: 68px; }
.lines input.amount-input { text-align: right; }
.lines .why { margin-top: 4px; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.lines .why.warn { color: var(--amber); }
.lines .tax-cell { text-align: center; padding-top: 16px; }
.line-ro .product { font-weight: 600; }
.icon-btn { width: 30px; height: 30px; margin-top: 3px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--red-bg); color: var(--red); }
.icon-btn-dup:hover { background: var(--blue-bg); color: var(--blue); }
.line-actions { white-space: nowrap; }
.line-actions .icon-btn { display: inline-grid; vertical-align: top; }
.lines-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 28px; font-size: 13.5px; min-width: 260px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 15px; color: var(--ink); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.totals .hint { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); text-align: right; }
/* The tax dialog in a company that picks its rate (SC): the rate, the job site, PSA's tax. */
#tax-dialog .tax-site { font-size: 12.5px; color: var(--muted); }
.tax-suggestions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.tax-suggestions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.readonly-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.readonly-list dt { color: var(--muted); }
.readonly-list dd { margin: 0; }
.qbo-lines { list-style: none; margin: 14px 0; padding: 0; border-top: 1px solid var(--line); }
.qbo-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.qbo-lines .cell-sub { display: block; }
/* The invoices already on the job: one row each, opening to its lines. */
.job-invoice-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.job-invoice-totals dt { color: var(--muted); }
.job-invoice-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.job-invoice-totals .grand { font-weight: 700; color: var(--ink); font-size: 14px; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.job-invoice-count { margin: 6px 0 12px; }
.job-invoices { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.job-invoices > li { border-bottom: 1px solid var(--line); }
.job-invoices summary { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; cursor: pointer; list-style: none; }
.job-invoices summary::-webkit-details-marker { display: none; }
.job-invoices summary::before { content: "▸"; color: var(--muted); margin-right: -4px; }
.job-invoices details[open] summary::before { content: "▾"; }
.job-invoices summary > span:first-child { flex: 1; }
.job-invoices .qbo-lines { margin: 0 0 8px; }
.job-invoices details[open] { padding-bottom: 10px; }
.tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 600; color: var(--blue); background: var(--blue-bg); border: 1px solid var(--blue-line); text-decoration: none; }
.auto-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 9px; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; font-size: 13px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-top: 5px; }
.timeline .dot.generated, .timeline .dot.audited { background: var(--green); }
.timeline .dot.held, .timeline .dot.audit-exception, .timeline .dot.psa-note-failed { background: var(--red); }
.timeline .when { color: var(--muted); font-size: 12px; }
.timeline .note { margin-top: 2px; color: var(--ink-2); white-space: pre-line; }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 10; }
.actionbar-inner { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 10px; }
.actionbar .spacer { flex: 1; }
.actionbar .dirty { color: var(--amber); font-size: 13px; font-weight: 600; display: none; }
.actionbar.is-dirty .dirty { display: inline; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog form { padding: 20px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 17px; }
dialog p { margin: 0; color: var(--muted); }
dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.confirm-summary dt { color: var(--muted); }
.confirm-summary dd { margin: 0; text-align: right; font-weight: 600; }
/* .field and .confirm-summary set display, which would override [hidden]. */
#tax-dialog [hidden] { display: none; }
/* Inputs line up even when a label's tag wraps to a second line. */
.tax-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
@media (max-width: 480px) { .tax-fields { grid-template-columns: 1fr; } }
.link-btn { all: unset; display: inline-block; cursor: pointer; margin-top: 8px; font-size: 13px; color: var(--accent); }
.link-btn:hover, .link-btn:focus-visible { text-decoration: underline; }
.tax-error { margin: 0; font-size: 13px; color: var(--red); }

/* ---- new request ---- */
.new-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.job-preview { font-size: 13px; color: var(--muted); min-height: 20px; margin-top: 6px; }
.job-preview b { color: var(--ink); }
.steps { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; display: grid; gap: 8px; }

/* ---- sign-in ---- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card { width: min(400px, 100%); padding: 32px; text-align: center; }
.signin-logo { display: block; margin: 0 auto 18px; width: 170px; height: auto; }
.signin-card h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.signin-card p { margin: 0 0 22px; color: var(--muted); }
/* Microsoft's sign-in button: white in both themes, per their brand guidance. */
.btn-ms { width: 100%; height: 42px; font-size: 14.5px; background: #fff; color: #2b2b2b; border-color: #e3e5e9;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .08); transition: box-shadow .15s, transform .15s; }
.btn-ms:hover { background: #fff; box-shadow: 0 2px 4px rgba(16, 24, 40, .08), 0 6px 16px rgba(16, 24, 40, .12); transform: translateY(-1px); }
.btn-ms:active { transform: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
@media (prefers-color-scheme: dark) { .btn-ms { border-color: transparent; } }
.signin-card .dev { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }

@media (max-width: 980px) {
  .layout, .new-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar-inner, .page, .actionbar-inner { padding-left: 16px; padding-right: 16px; }
  .topbar-user .who { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .hide-sm { display: none; }
  .request-total { text-align: left; }
}
.audit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- users ---- */
.users-add { margin-bottom: 16px; }
.users-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.3fr) auto auto; gap: 12px 14px; align-items: end; }
.users-admin-check { height: 36px; }
.users-form-note { grid-column: 1 / -1; margin: 0; }
.users-table td { vertical-align: middle; }
.users-actions { text-align: right; white-space: nowrap; }
.users-actions form { display: inline; margin: 0; }
.badge-admin { color: var(--violet); background: var(--violet-bg); border-color: var(--violet-line); }
.users-removed { margin-top: 16px; }
.users-removed > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.users-removed[open] > summary { border-bottom: 1px solid var(--line); }
.users-removed > summary h2 { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 720px) { .users-form { grid-template-columns: 1fr; } }

/* ---- revising an earlier invoice ---- */
.revise-choice { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 14px; display: grid; gap: 8px; }
.revise-choice legend { padding: 0 4px; font-weight: 600; font-size: 13px; }
.revise-choice p { margin: 2px 0 0; }
.revise-choice .revise-matches { margin: 0 0 0 24px; padding: 8px 10px; font-size: 12.5px; }
.cost-basis { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.cost-basis .check input.cost-custom { width: 8em; height: auto; margin: 0 0 0 2px; padding: 3px 6px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, transparent); color: inherit; cursor: text; }
.revise-choice .cell-sub { display: block; margin-top: 2px; }
.revise-choice .check input.revise-number { width: 9em; height: auto; margin: 0 0 0 4px; padding: 3px 6px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, transparent); color: inherit; cursor: text; }

/* The job's roles in PSA, under the custom fields (ZC, 2026-11-13). */
.psa-team { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.psa-team ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.psa-team li .muted { margin-right: 4px; }

/* Estimated revenue against what's billed (ZC, 2026-11-13). */
.revenue dt.revenue-after, .revenue dd.revenue-after { font-weight: 600; color: var(--ink); padding-top: 4px; border-top: 1px solid var(--line); }
.revenue dd.warn { color: var(--amber); }
.revenue-check { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--amber); font-size: 13px; }

/* Audit logs tab (management): hold notes and audit exceptions to review. */
.logs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
             padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.logs-head p { margin: 0; color: var(--muted); flex: 1 1 320px; }
.logs-head a { white-space: nowrap; }
.rows.logs td { vertical-align: top; }
.log-note { margin-top: 6px; max-width: 46ch; white-space: normal; overflow-wrap: anywhere; }
.rows.logs form { margin: 0; }

/* ---- the request page in three columns (ZC, 2026-11-20) ----
   QuickBooks and money on the left, what goes on the invoice in the middle, the request
   and its history on the right. Narrower, it falls back to the two-column page (the
   invoice wide, the rest down the side); on a phone, one column. */
.page-wide { max-width: 1760px; }
.layout-3 { grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr;
            grid-template-areas: "main qbo" "main trail"; }
.layout-3 > .col-qbo { grid-area: qbo; }
.layout-3 > .col-main { grid-area: main; }
.layout-3 > .col-trail { grid-area: trail; }
@media (min-width: 1440px) {
  .layout-3 { grid-template-columns: 320px minmax(0, 1fr) 320px; grid-template-rows: auto; grid-template-areas: "qbo main trail"; }
  .request-head .request-total { width: 320px; box-sizing: border-box; }
}
@media (max-width: 980px) {
  .layout-3 { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "main" "qbo" "trail"; }
}
@media (max-width: 640px) { .request-total { border-right: 0; padding-right: 0; } }
.qbo-sub { margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600;
           text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* Vendor costs sit in a narrow column now: the vendor and its details on top, the amount and
   the buttons under them. */
.vendor-costs li { flex-wrap: wrap; row-gap: 6px; }
.vendor-costs li > span:first-child { flex: 1 1 100%; }
.vendor-costs .cell-sub { display: block; }
.vendor-costs .row-end { display: flex; flex: 1 1 100%; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; white-space: normal; }
.vendor-costs .row-end .num { margin-right: auto; font-weight: 600; }
/* The middle column is narrower than the old main one: fixed shares so the class and the
   amount stay readable, and the service date drops under the description when there's no room. */
@media (min-width: 981px) {
  .layout-3 .lines { table-layout: fixed; }
  .layout-3 .lines .col-product { width: 38%; }
  .layout-3 .lines .col-class { width: 22%; }
  .layout-3 .lines .col-amount { width: 120px; }
  .layout-3 .lines .line-sub { flex-wrap: wrap; }
  .layout-3 .lines .line-sub input[type="text"] { flex: 1 1 180px; }
  .layout-3 .lines th { white-space: normal; vertical-align: bottom; }
}

/* ---- AR Desk ---- */
.badge-ok { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.badge-bad { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge-info { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-line, var(--line)); }
.badge-warn { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge-muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.feed-grid { display: grid; gap: 20px; }
.feed-grid > * { min-width: 0; }
td .cell-title { white-space: nowrap; }
.feed-health { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.feed-health strong { color: var(--ink); font-weight: 600; }
.msg-body { max-width: 60ch; white-space: pre-wrap; overflow-wrap: anywhere; }
td form { margin: 0; }
@media (max-width: 720px) { td, th { padding: 10px 12px; } .topbar-inner, .page { padding-left: 16px; padding-right: 16px; } .topbar-inner { gap: 12px; } .brand span { display: none; } .page-head { flex-direction: column; align-items: flex-start; gap: 10px; } }
