/* ============================================================
   DW4 (2026-10-18): F24 — register cells are keyed by column
   class (.dw4x-c-*) now that Manage columns can hide any of
   them; the head carries Forward expenses by email + New ▾, so
   the page head reserves more room; Export moved into the
   toolbar (ghost). New rules: dw4-expenses.css.
   EXPENSES (M2 WS5) — .exp-* styles.
   A per-module sheet on the change-orders.css precedent:
   styles.css sits at the per-file upload ceiling, and the
   brief (§1) names the split convention for exactly this
   case. Loaded after change-orders.css in index.html. Tokens
   are the portal's own (styles.css :root); the warning
   palette is the quotes/CO sheets' (#ecd9ac / #fdf6e7 /
   #8a5a00). No figure on this surface is gold (§3.3).
   ============================================================ */

.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.exp-h { font-size: 15.5px; margin: 0; }
.exp-note { margin: 0 0 12px; max-width: 72ch; }
.exp-flash {
  border: 1px solid var(--line); border-left: 3px solid #2e7d32;
  border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; background: #fff;
  font-size: 13.5px; line-height: 1.5;
}

/* Kind sub-tabs (Billdr's sub-tab pattern; the portal's seg
   control carries it, §3.3). */
.exp-subtabs { margin: 2px 0 14px; }

/* The §5.2 summary strip: Billdr's five cards in order,
   inside one quiet card. */
.exp-strip { margin-bottom: 18px; }
.exp-strip-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 22px;
}
.exp-strip-grid > div { display: flex; flex-direction: column; gap: 2px; }
.exp-strip-k { font-size: 12px; color: var(--muted); }
.exp-strip-v { font-size: 17px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.exp-strip-note { margin: 10px 0 0; font-size: 12.5px; }

/* The list — one row shape across kinds (the .ptable anatomy).
   Wave 20 responsive pass: tables scroll sideways inside their
   card on narrow screens (the projects-table precedent). */
.exp-table-wrap { overflow-x: auto; }
.exp-table .exp-num, .exp-table th.exp-num { text-align: right; }
.exp-table td.exp-num { font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.exp-row-open { cursor: pointer; }
.exp-row-open:hover td { background: var(--bg); }
.exp-row-open:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* Status + badges. The status wears Billdr's pill: Pending
   orange, Approved green (six-pack capture §2 — the M2-era
   "word, not a chip" reading was the drift, corrected by
   Parity 6). Badges carry the actionable states (unallocated
   money, a missing receipt). */
.exp-status {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #fdf3e0; color: #8a5a12;
}
.exp-status.is-approved { background: #e3f5ea; color: #177348; }
.exp-status.is-pending { background: #fdf3e0; color: #8a5a12; }
.exp-badge {
  display: inline-block; padding: 1px 8px; margin-left: 4px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
  white-space: nowrap; vertical-align: middle;
}
.exp-badge-warn { background: #fdf6e7; color: #8a5a00; border-color: #ecd9ac; }
.exp-approve-btn { margin-left: 8px; height: 26px; padding: 0 9px; font-size: 12px; }

/* The record view. */
.exp-view-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.exp-view-title { flex: 1; min-width: 220px; }
.exp-view-title h3 { margin: 2px 0 2px; font-size: 17px; color: var(--ink); }
.exp-view-title p { margin: 0; font-size: 13px; }
.exp-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.exp-card { margin-bottom: 16px; }
.exp-alloc-table .exp-num, .exp-alloc-table th.exp-num { text-align: right; }
.exp-alloc-table td.exp-num { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.exp-alloc-table tfoot td { font-size: 13.5px; color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; }
.exp-events { list-style: none; margin: 6px 0 0; padding: 0; }
.exp-events li {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.exp-events li:last-child { border-bottom: 0; }
.exp-ev-kind { font-weight: 600; color: var(--ink); }
.exp-ev-note { color: var(--ink); }

/* The entry form dialog (fxDialog shell; the grid + labels
   come from styles.css .qm-form-grid). */
.exp-form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
  font-size: 14px; font-weight: 400; color: var(--ink); background: #fff;
}
.exp-form textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.exp-form > label > span { display: block; }
.exp-form label small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.45; }
.exp-form-note { margin: 10px 0 0; font-size: 13px; line-height: 1.5; }

.exp-mode-seg { margin-top: 5px; }
.exp-amt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; }
.exp-amt-grid > label > span { display: block; }
.exp-ro {
  display: block; margin-top: 5px; padding: 9px 2px; font-size: 15px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.exp-link-btn {
  appearance: none; background: none; border: 0; padding: 0; font: inherit;
  font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.exp-link-btn:hover { text-decoration-color: var(--ink); }
.exp-switch-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.exp-upload-row { display: flex; align-items: center; gap: 10px; }

/* The form's allocation editor: one repeated row shape —
   code dropdown | amount | remove. */
.exp-alloc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 18px 0 8px; flex-wrap: wrap; }
.exp-alloc-head h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
#exp-f-alloc-sum { font-size: 13px; font-variant-numeric: tabular-nums; }
#exp-f-alloc-sum.exp-alloc-off { color: #8a5a00; font-weight: 600; }
.exp-alloc-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.exp-alloc-row select {
  flex: 1; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--ink); background: #fff;
}
.exp-alloc-row input[type="text"] {
  width: 130px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; box-sizing: border-box;
  text-align: right; font-variant-numeric: tabular-nums;
}
.exp-alloc-row select:focus, .exp-alloc-row input[type="text"]:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 62, .18);
}
.exp-alloc-del { flex: none; }

/* ============================================================
   THE GLOBAL REGISTER (EXP-G1) — .expg-* styles. The cards
   and table reuse the project tab's .exp-strip / .exp-table
   dress whole; what is new here is only the filter bar and
   the context bar that frames a record opened from the
   register.
   ============================================================ */
.expg-filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  margin: 0 0 14px;
}
.expg-filters .dw4x-search {
  flex: 1 1 260px; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
  font-size: 14px; color: var(--ink); background: #fff; box-sizing: border-box;
}
.expg-filters label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.expg-filters label input[type="date"],
.expg-filters label select {
  height: 36px; padding: 0 8px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 400;
  color: var(--ink); background: #fff; box-sizing: border-box;
}
.expg-filters .dw4x-search:focus,
.expg-filters label input[type="date"]:focus,
.expg-filters label select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 62, .18);
}
.expg-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.expg-context {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 14px;
}

/* The §7.6 duplicate warning + the warn-but-allow line. */
.exp-dup {
  border: 1px solid #ecd9ac; background: #fdf6e7; color: #8a5a00;
  border-radius: 10px; padding: 12px 16px; margin: 14px 0 0;
  font-size: 13.5px; line-height: 1.55;
}
.exp-dup p { margin: 0 0 6px; }
.exp-dup ul { margin: 0 0 8px; padding-left: 18px; }
.exp-dup-ok { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.exp-dup-ok input { margin-top: 3px; }
.exp-warn {
  border: 1px solid #ecd9ac; background: #fdf6e7; color: #8a5a00;
  border-radius: 10px; padding: 10px 14px; margin: 14px 0 0;
  font-size: 13.5px; line-height: 1.5;
}

/* ======================= DW1 · Expenses (design wave, 2026-10-17) ======================= */
/* Capture §2. Global register = #view-expenses / #exp-g-root
 * (expenses-global.js); the project tab = expenses.js (same .exp-*
 * classes, no #exp-g-root ancestor). Rules that differ are scoped by
 * #exp-g-root; the rest serve both. */

/* Global page head: the static H1 is the title (the register renders
 * no h3 of its own there — DW2 P07) and Export / New ▾ are pinned
 * top-right of the view, Billdr's two-action head. The project tab
 * keeps its h3 as the section title. */
body.skin-billdr #app #view-expenses { position: relative; }
body.skin-billdr #app #view-expenses:has(#exp-g-root .exp-actions) > .page-head { padding-right: 400px; }
body.skin-billdr #app #exp-g-root > .exp-head { margin: 0; min-height: 0; }
/* (DW2 P07, decision 19: the duplicate h3 is no longer rendered on the
 * global page, so DW1's visually-hidden rule for it is gone.) */
body.skin-billdr #app #exp-g-root > .exp-head > .exp-actions { position: absolute; top: 0; right: 0; gap: 12px; }
/* Project tab head: section title in navy, actions right. */
body.skin-billdr #app .exp-head { margin-bottom: 16px; }
body.skin-billdr #app .exp-h { font-size: var(--ds-fs-lg); font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app .exp-actions { gap: 12px; }
/* Export = Billdr's outlined secondary ("Forward expenses by email"
 * seat): the gold outline pill. New ▾ is already the gold primary. */

/* Kind sub-tabs: the shared .seg already; just the spacing. */
body.skin-billdr #app .exp-subtabs { margin: 0 0 20px; }

/* Filters (.expg-filters is this register's own bar, not .filterbar):
 * the shared filter look — search first with the magnifier, 40px white
 * controls, captions hidden from sight but kept as accessible names,
 * "Clear filters" as a gold text-link far right. The custom-range
 * From / To dates keep their words: two bare dates would be ambiguous. */
body.skin-billdr #app .expg-filters { align-items: center; gap: 12px; margin: 0 0 20px; }
body.skin-billdr #app .expg-filters .dw4x-search {
  flex: 1 1 240px; max-width: 520px; height: auto; min-height: var(--ds-ctl); padding: 0 14px 0 38px;
  font-size: var(--ds-fs-sm); border-color: var(--ds-line); border-radius: var(--ds-r-ctl);
}
body.skin-billdr #app .expg-filters > label:not(:has(input[type="date"])) { font-size: 0; line-height: 0; color: transparent; gap: 0; }
body.skin-billdr #app .expg-filters > label:has(input[type="date"]) { flex-direction: row; align-items: center; gap: 8px; font-size: var(--ds-fs-sm); font-weight: 500; color: var(--ds-muted); }
body.skin-billdr #app .expg-filters > label > :is(select, input[type="date"]) {
  height: auto; min-height: var(--ds-ctl); font-size: var(--ds-fs-sm); line-height: normal; font-weight: 500;
  color: var(--ds-ink); border-color: var(--ds-line); border-radius: var(--ds-r-ctl);
}
body.skin-billdr #app .expg-filters > label > select { min-width: 150px; padding: 0 34px 0 14px; }
body.skin-billdr #app .expg-filters > label > input[type="date"] { padding: 0 12px; }
body.skin-billdr #app .expg-filters > label > :is(select, input[type="date"]):hover { border-color: var(--ds-line-strong); }
body.skin-billdr #app .expg-filters #expg-clear {
  margin-left: auto; min-height: var(--ds-ctl); padding: 0 4px; background: none; border: 0;
  color: var(--ds-gold-ink); font-weight: 600; font-size: var(--ds-fs-sm);
}
body.skin-billdr #app .expg-filters #expg-clear:hover { background: none; color: var(--ds-gold-ink-hover); text-decoration: underline; text-underline-offset: 3px; }

/* KPI strip (rule 7): the wrapping card turns transparent and each
 * figure becomes its own white card with a 4px left accent —
 * excl. = gold (indigo's seat), tax = orange, incl. = green; on the
 * project tab Total approved = green, Total pending = orange. The
 * results note becomes the grey meta line under the cards. */
body.skin-billdr #app .sum-card.exp-strip { background: transparent; border: 0; border-radius: 0; padding: 0; margin: 0 0 20px; }
body.skin-billdr #app .exp-strip-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
body.skin-billdr #app .exp-strip-grid > div {
  background: var(--ds-card); border: 1px solid var(--ds-line); border-left: 4px solid var(--ds-k-navy);
  border-radius: var(--ds-r); padding: 16px 20px; gap: 6px; min-width: 0; justify-content: space-between;
}
body.skin-billdr #app .exp-strip-grid > div:nth-child(1) { border-left-color: var(--ds-k-gold); }
body.skin-billdr #app .exp-strip-grid > div:nth-child(2) { border-left-color: var(--ds-k-orange); }
body.skin-billdr #app .exp-strip-grid > div:nth-child(3) { border-left-color: var(--ds-k-green); }
body.skin-billdr #app .exp-strip-grid > div:nth-child(4) { border-left-color: var(--ds-k-green); }
body.skin-billdr #app .exp-strip-grid > div:nth-child(5) { border-left-color: var(--ds-k-orange); }
body.skin-billdr #app .exp-strip-k { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ds-muted); }
body.skin-billdr #app .exp-strip-v { font-size: var(--ds-fs-kpi); font-weight: 700; color: var(--ds-navy); line-height: 1.15; }
body.skin-billdr #app .exp-strip-note { margin: 16px 0 0; font-size: var(--ds-fs-sm); color: var(--ds-muted); }

/* The table (rule 5) — .ptable already carries the card, header and
 * hairlines. Here: grey ref first (global), the two-line Project /
 * Client cell (first line bold navy), money right-aligned bold navy. */
body.skin-billdr #app .exp-table-wrap { border-radius: var(--ds-r); }
body.skin-billdr #app .exp-row-open:hover td { background: var(--ds-tint); }
body.skin-billdr #app .exp-row-open:focus-visible { outline: 2px solid var(--ds-gold); outline-offset: -2px; }
body.skin-billdr #app .exp-table td.dw4x-c-iref { color: var(--ds-muted); font-weight: 500; white-space: nowrap; }
body.skin-billdr #app .exp-table td.dw4x-c-project { white-space: nowrap; line-height: 1.45; }
body.skin-billdr #app .exp-table td:is(.dw4x-c-date, .dw4x-c-customref) { white-space: nowrap; }
body.skin-billdr #app .exp-table td .muted { font-size: var(--ds-fs-sm); }
body.skin-billdr #app .exp-table :is(th, td).exp-num { text-align: right; white-space: nowrap; }
body.skin-billdr #app .exp-table td.exp-num { font-weight: 700; color: var(--ds-navy); font-size: var(--ds-fs); }

/* Status pills (rule 6) + badges: Approved pale green, Pending pale
 * orange; badges are neutral pills, the due-date one orange. */
body.skin-billdr #app .exp-status { padding: 3px 10px; border-radius: var(--ds-r-pill); font-size: 12px; font-weight: 600; background: var(--ds-orange-bg); color: var(--ds-orange-ink); }
body.skin-billdr #app .exp-status.is-approved { background: var(--ds-ok-bg); color: var(--ds-ok-ink); }
body.skin-billdr #app .exp-status.is-pending { background: var(--ds-orange-bg); color: var(--ds-orange-ink); }
body.skin-billdr #app .exp-badge { border: 0; border-radius: var(--ds-r-pill); padding: 3px 10px; margin: 2px 0 2px 4px; background: var(--ds-neutral-bg); color: var(--ds-neutral-ink); font-size: 12px; font-weight: 600; letter-spacing: 0; }
body.skin-billdr #app .exp-badge-warn { background: var(--ds-orange-bg); color: var(--ds-orange-ink); }
body.skin-billdr #app .btn.exp-approve-btn { min-height: 28px; height: 28px; padding: 0 10px; margin: 4px 0 0 4px; font-size: 12px; border-radius: var(--ds-r-sm); }

/* Record view + flash: navy title, quiet cards. */
body.skin-billdr #app .exp-view-title h3 { font-size: var(--ds-fs-xl); font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app .exp-flash { border-color: var(--ds-line); border-left: 4px solid var(--ds-k-green); border-radius: var(--ds-r); }
body.skin-billdr #app .exp-alloc-table td.exp-num { color: var(--ds-navy); }
body.skin-billdr #app .exp-ev-kind { color: var(--ds-navy); }

@media (max-width: 760px) {
  body.skin-billdr #app #view-expenses:has(#exp-g-root .exp-actions) > .page-head { padding-right: 0; }
  body.skin-billdr #app #exp-g-root > .exp-head > .exp-actions { position: static; margin: 0 0 16px auto; }
  body.skin-billdr #app .expg-filters > label:not(:has(input[type="date"])) { flex: 1 1 100%; }
  body.skin-billdr #app .expg-filters > label > select { width: 100%; }
}
/* (DW1 addendum) the search box keeps room for its placeholder. */
body.skin-billdr #app .expg-filters .dw4x-search { min-width: 240px; }

/* ======================= DW2 P07 · Expenses row menu + footer (2026-10-18) ======================= */
.exp-table :is(th, td).exp-menu-cell { width: 44px; text-align: right; padding-left: 4px; }
.exp-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.exp-menu .i-btn { width: 18px; height: 18px; }
.exp-menu .i-btn { stroke-width: 3.2; }

/* wave41 parity: Billdr's vendor-credit warning sits above the form
 * fields (its .exp-warn box, un-hidden and repositioned). */
.exp-vc-warn { margin: 0 0 14px; }
