/* Singer Dolan Partners — Singer Dolan OS (palette from cci_batch_runner.py) */
:root {
  --cream:       #EEE8CF;
  --cream-mid:   #D6CEAE;
  --cream-dark:  #8C8060;
  --charcoal:    #1C1C1C;
  --warm-gray:   #F5F2EA;
  --red:         #A0292A;
  --red-light:   #F5EAEA;
  --red-rule:    #EEDDDD;
  --amber:       #9A6210;
  --amber-light: #F5F0E6;
  --amber-rule:  #EEE5D5;
  --green:       #3D6B35;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--warm-gray);
  color: var(--charcoal);
}
a { color: inherit; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
#toolbar {
  /* above Leaflet's panes/controls, which go up to z-index ~1000 */
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--charcoal); color: var(--cream);
  padding: 10px 18px; gap: 14px; flex-wrap: wrap;
}
.tb-brand { flex-shrink: 0; display: flex; align-items: center; gap: 11px; }
/* currentColor on the paths + color here means one place to restyle the mark. */
.tb-logo { flex: none; height: 30px; width: auto; color: var(--cream); }
.tb-logo path { fill: currentColor; }
/* One line: SINGER DOLAN OS in capitals, medium weight, shorter than the mark
   beside it and centred on it (the line box is the mark's height). The name and the
   mark step down together on narrower windows, so the menus stay on the
   brand's row. */
.tb-wordmark { display: block; }
.tb-name { display: block; font-weight: 500; font-size: 16px; line-height: 30px; letter-spacing: 2.5px;
           text-transform: uppercase; white-space: nowrap; }
@media (max-width: 1100px) {
  .tb-logo { height: 24px; }
  .tb-name { font-size: 15px; line-height: 24px; letter-spacing: 2.2px; }
}
/* The brand on the left; on the right the four menus, then the sync status,
   Sync and the account initials. Wraps rather than overflow. */
.tb-links { display: flex; align-items: center; flex-wrap: wrap; flex: 1 1 auto;
  justify-content: flex-end; gap: 10px 20px; margin-left: 18px; }
.tb-health { margin-left: 6px; }
.tb-links a {
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  text-decoration: none; color: var(--cream-mid); padding: 4px 2px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tb-drop { position: relative; display: flex; align-items: center; }
/* Always-on sync health: a green dot states "healthy" rather than leaving it
   implied by the absence of a warning. */
#sync-health { display: flex; align-items: center; gap: 6px; background: transparent !important;
  border: none; padding: 4px 6px !important; cursor: pointer; border-radius: 3px; }
#sync-health:hover { background: #2c2c2c !important; }
#sync-time { font-size: 11px; color: var(--cream-mid); white-space: nowrap; text-transform: none;
  letter-spacing: 0; font-weight: 400; }
.sh-dot { width: 7px; height: 7px; border-radius: 50%; background: #6b6355; flex: 0 0 auto; }
.sh-dot[data-level="good"], #sync-health[data-level="good"] .sh-dot { background: #6FA86B; }
.sh-dot[data-level="warn"], #sync-health[data-level="warn"] .sh-dot { background: #D9A441; }
.sh-dot[data-level="bad"],  #sync-health[data-level="bad"]  .sh-dot { background: #E06B6C; }
#sync-health[data-level="bad"] .sh-dot { animation: shpulse 1.6s ease-in-out infinite; }
@keyframes shpulse { 50% { opacity: .35; } }

/* Anchored to the button, so the panel drops directly beneath "Synced …"
   instead of the page corner. */
.tb-health { position: relative; display: flex; align-items: center; }
#sync-panel {
  /* Wide enough that "… · auto Sep 16, 5:02 AM PT" stays on one line instead of
     dropping "PT" to a line of its own on every row. */
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1200; width: 390px;
  max-width: calc(100vw - 24px);
  background: var(--charcoal); color: var(--cream); border: 1px solid #3a3a3a;
  border-radius: 5px; box-shadow: 0 8px 22px rgba(0,0,0,.4); padding: 6px 0;
  text-transform: none; letter-spacing: 0;
}
#sync-panel[hidden] { display: none; }
.sp-head { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--cream-dark); padding: 8px 14px 6px; }
.sp-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 14px; }
.sp-row + .sp-row { border-top: 1px solid #2c2c2c; }
.sp-row .sh-dot { margin-top: 5px; }
/* min-width:0 on both columns: a flex item defaults to min-width:auto, which
   refuses to shrink below its content, so one long error pushed the row — and
   the page — hundreds of px wider than the 330px panel. */
.sp-name { flex: 1 1 40%; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.sp-when { display: block; font-size: 9.5px; color: #7d7568; }
.sp-meta { flex: 1 1 55%; min-width: 0; text-align: right; font-size: 9.5px;
  color: var(--cream-dark); white-space: nowrap; }
/* The timestamp stays on one line; the note below it wraps. Errors arrive as
   unbroken JSON with no spaces to break at, hence anywhere rather than
   break-word. */
.sp-meta span { display: block; color: #7d7568; white-space: normal;
  overflow-wrap: anywhere; line-height: 1.45; }
.sp-meta .sp-err { color: #e0857f; }
/* ↻ Sync on each row of the panel: quiet until you want it. */
/* #toolbar button would otherwise dress it as the big cream Sync button. */
#toolbar #sync-panel .sp-act { font: inherit; font-size: 9.5px; font-weight: 400; margin: 5px 0 0 auto;
  display: block; padding: 2px 8px; border: 1px solid #4a4a4a; border-radius: 3px;
  background: transparent; color: var(--cream); cursor: pointer; text-transform: none; letter-spacing: 0; }
#toolbar #sync-panel .sp-act:hover:not(:disabled) { border-color: var(--cream-dark); background: transparent; }
#toolbar #sync-panel .sp-act:disabled { opacity: .5; cursor: default; }
.sp-foot { font-size: 9.5px; color: #7d7568; padding: 8px 14px 6px;
  border-top: 1px solid #2c2c2c; line-height: 1.5; }
@media print { #sync-health, #sync-panel { display: none !important; } }
.tb-links a.active { color: #fff; border-bottom-color: var(--cream-dark); }
#toolbar button {
  font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  background: var(--cream); color: var(--charcoal); border: none;
  padding: 7px 14px; border-radius: 3px; cursor: pointer; font-weight: 700;
}
#toolbar button:hover { background: var(--cream-mid); }
.tb-drop { position: relative; }
.tb-menu {
  display: none; position: absolute; top: 100%; left: -12px; z-index: 40;
  background: var(--charcoal); border: 1px solid #3a3a3a; border-radius: 4px;
  padding: 6px 0; min-width: 160px; box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.tb-drop:hover .tb-menu, .tb-drop:focus-within .tb-menu { display: block; }
.tb-menu a {
  display: block; padding: 8px 16px;
  border-bottom: none;
}
.tb-menu a:hover { background: #2c2c2c; color: #fff; }
/* The page you're on, inside its menu. */
.tb-menu a.current { color: #fff; box-shadow: inset 3px 0 0 var(--cream-dark); }
/* Group names inside a menu (Buyout, Invoices, …): labels, not links. */
.tb-menu-label { display: block; padding: 10px 16px 3px; font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--cream-dark); cursor: default; }
.tb-menu-label:first-child { padding-top: 4px; }
.tb-menu a + .tb-menu-label { margin-top: 4px; border-top: 1px solid #333; }
#toolbar #upload-btn { background: transparent; color: var(--cream-mid); border: 1px solid var(--cream-dark); font-weight: 400; }
#toolbar #upload-btn:hover { color: #fff; background: transparent; }
/* Manual upload is a fallback — hidden until a sync fails. */
#toolbar #upload-btn { display: none; }
#toolbar #upload-btn.show { display: inline-block; }
#toolbar #sync-btn { background: var(--cream); color: var(--charcoal); }
#toolbar #sync-btn:disabled { opacity: .6; cursor: default; }

#view { max-width: 1060px; margin: 26px auto 80px; padding: 0 18px; }

/* ── Report card (mirrors the PDF page) ─────────────────────────────────── */
.report {
  background: #fff; border-top: 4px solid var(--charcoal);
  box-shadow: 0 1px 4px rgba(28,28,28,.08);
  margin-bottom: 34px;
}
.rpt-head {
  background: var(--cream);
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 28px 14px;
}
.rpt-head .brand { font-size: 10px; font-weight: 700; letter-spacing: 3px; }
.rpt-head h1 { font-size: 24px; letter-spacing: .5px; margin: 6px 0 4px; text-transform: uppercase; }
.rpt-head h1 a { text-decoration: none; }
.rpt-head .sub { font-size: 10px; letter-spacing: 1.5px; color: var(--cream-dark); }
.rpt-dates { text-align: right; flex-shrink: 0; }
.rpt-dates .export-date { font-weight: 700; font-size: 13px; margin-top: 14px; }
.rpt-dates .gen { font-size: 10px; color: var(--cream-dark); margin-top: 4px; }
.rpt-dates .gen b { color: var(--charcoal); font-weight: 700; }
.rpt-dates .gen-at { display: block; margin-top: 1px; font-variant-numeric: tabular-nums; }

.ptable th.since, .ptable td.since { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable td.since:not(.dim) { font-weight: 600; }
.rpt-dates .gen b.gen-stale, .rpt-dates .gen-stale { color: #8A4F27; }
.rpt-dates select {
  font: inherit; font-size: 11px; margin-top: 8px;
  border: 1px solid var(--cream-mid); background: #fff; color: var(--charcoal);
  padding: 3px 6px; border-radius: 3px;
}

/* KPI band */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--warm-gray);
  border-top: 1px solid var(--cream-mid); border-bottom: 1px solid var(--cream-mid);
}
.kpi { padding: 14px 18px 16px; }
.kpi + .kpi { border-left: 1px solid var(--cream-mid); }
.kpi .lbl { font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark); }
.kpi .val { font-size: 23px; font-weight: 700; margin-top: 7px; white-space: nowrap; }
.kpi .pct { font-size: 10px; color: var(--cream-dark); margin-top: 8px; }
.kpi .bar { height: 4px; background: var(--cream-mid); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--cream-dark); border-radius: 2px; }
.kpi .delta { font-size: 10px; margin-top: 7px; font-weight: 700; }
.delta.up   { color: var(--red); }
.delta.down { color: var(--green); }
.delta.flat { color: var(--cream-dark); font-weight: 400; }

/* Summary strips */
.strips { padding: 12px 28px 4px; }
.strip {
  display: flex; align-items: baseline; gap: 14px;
  background: var(--cream); border-radius: 4px;
  padding: 7px 12px; margin-bottom: 7px;
  font-size: 11px;
}
.strip .s-lbl { font-weight: 700; letter-spacing: .8px; font-size: 10px; min-width: 185px; }
.strip .s-detail { color: var(--cream-dark); flex: 1; }
.strip .s-val { font-weight: 700; margin-left: auto; white-space: nowrap; }
.strip .s-val.red { color: var(--red); }
.strip .s-val.amber { color: var(--amber); }

/* Two-column body */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 12px 28px 24px; }
.col-head {
  border-radius: 4px; color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: .8px; padding: 7px 10px;
}
.ob  .col-head { background: var(--red); }
.unc .col-head { background: var(--cream-dark); }
.col table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 11px; }
.col th {
  text-align: left; font-size: 9px; letter-spacing: 1px; color: var(--cream-dark);
  border-bottom: 1px solid var(--cream-mid); padding: 0 4px 4px;
}
.col th:last-child, .col td:last-child { text-align: right; }
.col td { padding: 4px; border-bottom: 1px solid var(--red-rule); }
.unc td { border-bottom-color: var(--amber-rule); }
.ob  tbody tr:nth-child(odd) { background: var(--red-light); }
.unc tbody tr:nth-child(odd) { background: var(--amber-light); }
.col td.amt { font-weight: 700; white-space: nowrap; }
.ob  td.amt { color: var(--red); }
.unc td.amt { color: var(--amber); }
.col .code { white-space: nowrap; color: var(--charcoal); }
.col-total {
  display: flex; justify-content: space-between; align-items: center;
  border-radius: 4px; color: #fff; padding: 8px 10px; margin-top: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
}
.ob  .col-total { background: var(--red); }
.unc .col-total { background: var(--cream-dark); }
.col-total .t-val { font-size: 15px; }
.col .empty { padding: 14px 4px; color: var(--cream-dark); font-size: 11px; }

.rpt-foot {
  border-top: 1px solid var(--cream-mid);
  display: flex; justify-content: space-between; gap: 20px;
  padding: 9px 28px 12px; font-size: 9px; color: var(--cream-dark);
}
.rpt-foot b { letter-spacing: 1px; }

/* ── Portfolio table ─────────────────────────────────────────────────────── */
.ptable-wrap { background: #fff; box-shadow: 0 1px 4px rgba(28,28,28,.08); border-top: 4px solid var(--charcoal); margin-bottom: 34px; }
/* Wide tables scroll inside their own card rather than pushing the whole page
   sideways on narrower screens. Excludes the map (Leaflet manages its own
   overflow) and is never applied to .prpt-body, whose children include the
   vendor chart's overflowing tooltips. */
.ptable-wrap:not(.map-wrap), .tscroll { overflow-x: auto; }
.ptable-head { background: var(--cream); padding: 12px 28px; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
table.ptable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ptable th {
  text-align: right; font-size: 9px; letter-spacing: 1px; color: var(--cream-dark);
  padding: 10px 12px 8px; border-bottom: 1px solid var(--cream-mid); white-space: nowrap;
}
.ptable th:first-child { text-align: left; padding-left: 28px; }
.ptable td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--warm-gray); white-space: nowrap; }
.ptable td:first-child { text-align: left; padding-left: 28px; font-weight: 700; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover { background: var(--cream); }
.ptable td.neg { color: var(--red); font-weight: 700; }
.ptable td.amb { color: var(--amber); }
.ptable td.dim { color: var(--cream-dark); }
.ptable tfoot td { border-top: 2px solid var(--charcoal); font-weight: 700; padding: 10px 12px; }

.section-note { font-size: 11px; color: var(--cream-dark); margin: -22px 0 26px 2px; }

/* ── Job info (from Jobsites export) ─────────────────────────────────────── */
.job-meta { font-size: 10px; color: var(--cream-dark); margin-top: 6px; letter-spacing: .3px; }
.job-trench { font-size: 11px; font-weight: 700; color: var(--charcoal); margin-top: 5px; letter-spacing: .3px; }
.pending-body { padding: 22px 28px 28px; font-size: 12.5px; line-height: 1.6; }
.pending-body p { max-width: 560px; color: var(--cream-dark); }
.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px; margin-top: 18px;
}
.contact-grid > div {
  background: var(--warm-gray); border-radius: 4px; padding: 9px 12px; font-size: 12px;
}
.contact-grid span {
  display: block; font-size: 8.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--cream-dark); margin-bottom: 3px;
}

/* ── Assignment bar (phase + designer) ───────────────────────────────────── */
/* Two states for the same three fields: owned by the schedule (read-only, shown
   as data) or not yet in it (editable, flagged so nobody mistakes the value for
   something that will stick). */
.assign-field .lock-tag, .assign-field .unlisted-tag {
  font-size: 8px; letter-spacing: .4px; text-transform: uppercase; font-weight: 700;
  padding: 1px 4px; border-radius: 2px; margin-left: 4px; white-space: nowrap;
}
.assign-field .lock-tag { background: #ECE6D4; color: #8C8060; }
.assign-field .unlisted-tag { background: #F5EFE2; color: #9A6210; }
.assign-unlisted select { border-color: #D9C79B; }

/* Read-only because the construction schedule owns the value. Styled as data
   rather than as a disabled input — there is nothing to enable. */
.assign-locked .locked-val { font-size: 12px; color: var(--charcoal); font-weight: 600;
  padding: 6px 0 5px; white-space: nowrap; }
.assign-locked .locked-val .dim { font-weight: 400; }

.assign-bar {
  display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  background: var(--warm-gray);
  border-top: 1px solid var(--cream-mid); border-bottom: 1px solid var(--cream-mid);
  padding: 10px 28px;
}
/* Each label+control wraps together as a unit so a control never drops to its
   own line away from its label. */
.assign-field { display: flex; align-items: center; gap: 8px; }
.assign-bar label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark);
  white-space: nowrap;
}
.assign-bar select, .assign-bar input {
  font: inherit; font-size: 12px; color: var(--charcoal);
  background: #fff; border: 1px solid var(--cream-mid); border-radius: 3px;
  padding: 5px 8px;
}
.assign-bar select { max-width: 250px; }
.assign-bar input[list] { width: 150px; }
.assign-bar input[type="date"] { width: 140px; }
.assign-saved { font-size: 11px; color: var(--green); }
.feat-assign { flex-wrap: wrap; gap: 4px 10px; max-width: 380px; }
.feat-assign .feat-box { font-size: 11px; }
.archive-btn {
  font: inherit; font-size: 10px; letter-spacing: .5px; text-transform: uppercase;
  background: #fff; color: var(--cream-dark); border: 1px solid var(--cream-mid);
  border-radius: 3px; padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.archive-btn:hover { border-color: var(--cream-dark); color: var(--charcoal); }
.archive-btn.on { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }

/* ── Invoice review ──────────────────────────────────────────────────────── */
.inv-weekpick { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inv-weekpick label { font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark); }
.inv-weekpick select { font: inherit; font-size: 12px; border: 1px solid var(--cream-mid); border-radius: 3px; padding: 5px 8px; background: #fff; }
.inv-refresh { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.inv-refresh button { font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .5px; cursor: pointer;
  background: #fff; color: var(--charcoal); border: 1px solid var(--cream-mid); border-radius: 3px; padding: 6px 12px; }
.inv-refresh button:hover { border-color: var(--cream-dark); }
.inv-refresh button:disabled { opacity: .6; cursor: default; }
.inv-refresh button.inv-export { background: var(--red); color: #fff; border-color: var(--red); }
.inv-refresh button.inv-export:disabled { background: #fff; color: var(--cream-dark); border-color: var(--cream-mid); }
/* Shown while the tab is pulling invoices raised since the nightly sync. */
.inv-catchup { display: none; font-size: 10px; color: #9c5b2f; }
.inv-catchup.on { display: block; }
.inv-refreshed { font-size: 10px; color: var(--cream-dark); }
.inv-table td { vertical-align: middle; }
.inv-table .review { white-space: nowrap; text-align: center; }
.rv { font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; border-radius: 3px;
  border: 1px solid var(--cream-mid); background: #fff; width: 26px; height: 24px; margin: 0 1px; color: var(--cream-dark); }
.rv.ap:hover, .rv.ap.on { background: var(--green); border-color: var(--green); color: #fff; }
.rv.dn:hover, .rv.dn.on { background: var(--red); border-color: var(--red); color: #fff; }
/* Notes run long, so this is a textarea that grows to fit rather than a
   single-line input that hid everything past its right edge. The chrome stays
   out of the way — a written note reads as plain text, and the editing
   affordance only appears on hover/focus, so a column of mostly-empty cells
   doesn't turn into a wall of boxes. */
.notes-cell { width: 25%; white-space: normal !important; vertical-align: middle; }
.inv-notes {
  width: 100%; min-width: 180px; font: inherit; font-size: 11.5px; line-height: 1.5;
  border: 1px solid transparent; border-radius: 3px; padding: 4px 7px;
  background: transparent; resize: none; overflow: hidden; display: block;
  min-height: 24px; color: var(--charcoal);
  /* No max-height: the box grows to fit so it never scrolls internally. */
}
.inv-notes::placeholder { color: #bdb5a3; }
tr.inv-row:hover .inv-notes { border-color: var(--cream-mid); background: #fff; }
.inv-notes:focus { border-color: var(--charcoal); background: #fff; outline: none;
  box-shadow: 0 0 0 2px rgba(28,28,28,.06); }
/* Spreadsheet-style zebra striping per invoice (main row + its detail row share a shade) */
tr.inv-z0, tr.inv-z0 > td { background: #fff; }
tr.inv-z1, tr.inv-z1 > td { background: var(--warm-gray); }
tr.inv-row td { border-top: 1px solid var(--cream-mid); }
tr.inv-approved td.proj { box-shadow: inset 4px 0 var(--green); }
tr.inv-denied td.proj { box-shadow: inset 4px 0 var(--red); }
tr.inv-approved td.proj, tr.inv-denied td.proj { font-weight: 700; }
.inv-caret { display: inline-block; width: 14px; color: var(--cream-dark); font-size: 10px; }
.inv-toggle { cursor: pointer; }
.inv-toggle:hover { text-decoration: underline; }
tr.inv-open { background: var(--warm-gray); }
tr.inv-detail-row > td { padding: 4px 28px 14px 28px; }
.inv-meta { font-size: 11px; color: var(--cream-dark); margin: 4px 0 8px; }
.inv-loading, .inv-err { font-size: 12px; color: var(--cream-dark); padding: 8px 0; }
.inv-err { color: var(--red); }
table.inv-lines { width: 100%; border-collapse: collapse; font-size: 11.5px; background: #fff;
  border: 1px solid var(--cream-mid); border-radius: 4px; overflow: hidden; }
.inv-lines th { text-align: left; font-size: 9px; letter-spacing: 1px; color: var(--cream-dark);
  background: var(--cream); padding: 6px 10px; }
.inv-lines th.right, .inv-lines td.right { text-align: right; }
.inv-lines td { padding: 6px 10px; border-top: 1px solid var(--warm-gray); }
.inv-lines td.code { white-space: nowrap; font-weight: 700; }
.inv-lines tfoot td { border-top: 2px solid var(--cream-dark); font-weight: 700; }
/* The billed code's budget variance: under (positive), over (negative), even. */
.inv-var-under { color: #4a6b45; font-weight: 600; }
.inv-var-over { color: var(--red); font-weight: 700; }
.inv-var-even { color: var(--cream-dark); }

/* ── Project map ─────────────────────────────────────────────────────────── */
/* --map-h is set by sizeMapToLegend() when the overlaid legend needs more
   than the standard height; the narrow-screen rule below ignores it. */
#map { height: var(--map-h, 460px); background: var(--warm-gray); }
/* Inherit the FAMILY only. `font: inherit` also reset the size, which pushed
   Leaflet's 11px attribution to the body's 16px and scaled its inline logo
   with it. Controls set their own sizes below. */
.map-wrap .leaflet-container { font-family: inherit; font-size: 12px; }
.map-wrap .leaflet-control-attribution { font-size: 10px; line-height: 14px; padding: 1px 6px; background: rgba(255,255,255,.82); }
/* Credits sit in the bottom-left corner (see initMap), clear of the legend's
   column, so the legend keeps the same space below it as above. One line
   while the map is wide: mapFit reserves that line's height top and bottom. */
/* The exact complement of the legend's (max-width: 860px): with min-width:
   861px, a zoomed or scaled viewport of 860.5px matched neither. */
@media (width > 860px) {
  .map-wrap .leaflet-control-attribution { white-space: nowrap; }
}
.map-wrap .leaflet-control-attribution a { color: var(--cream-dark); }
.map-wrap .leaflet-control-zoom a { font-size: 18px; line-height: 26px; width: 26px; height: 26px; }
.ph-sub { font-weight: 400; color: var(--cream-dark); letter-spacing: .6px; }

/* Per-project permit detail. Sits below the financial report on a project page
   and nowhere else — All Projects stacks reports for the combined PDF and stays
   financial-only. */
.pp-card { margin-top: 18px; }
.pp-load { padding: 18px 22px; color: var(--cream-dark); font-size: 12px; }
.pp-head { display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 22px 10px; border-bottom: 1px solid var(--cream-mid); }
.pp-head h2 { margin: 0; font-size: 13px; letter-spacing: 1.6px; }
.pp-when { font-size: 10px; color: var(--cream-dark); }
.pp-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--cream-mid); }
.pp-kpi { padding: 12px 22px; border-right: 1px solid var(--cream-mid); }
.pp-kpi:last-child { border-right: 0; }
.pp-kpi .lbl { font-size: 8.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--cream-dark); }
.pp-kpi .val { font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.pp-kpi .val a { color: var(--charcoal); text-decoration: none; font-size: 14px; }
.pp-kpi .val a:hover { text-decoration: underline; }
.pp-kpi .sub { font-size: 10px; color: var(--cream-dark); margin-top: 2px; }
.pp-sec { padding: 12px 22px 4px; }
.pp-sec h3 { font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--cream-dark); margin: 0 0 6px; }
.pp-note { font-weight: 400; letter-spacing: .4px; text-transform: none; margin-left: 8px; }
.pp-table { width: 100%; font-size: 11.5px; }
.pp-table td { padding: 5px 10px; border-bottom: 1px solid #F0ECE2; vertical-align: middle; }
.pp-table td:nth-child(2) { width: 46%; }
.pp-table .pp-insp { color: var(--cream-dark); width: 20%; }
.pp-table td:first-child { padding-left: 0; }
.pp-table td:last-child { padding-right: 0; }
.pp-date { font-variant-numeric: tabular-nums; color: var(--cream-dark); width: 84px; white-space: nowrap; }
.pp-type { font-weight: 600; }
.pp-hist { max-height: none; }
.pp-foot { padding: 10px 22px 14px; font-size: 10px; color: var(--cream-dark);
  border-top: 1px solid var(--cream-mid); display: flex; align-items: center; gap: 8px; }
.pp-foot a { color: var(--cream-dark); }
.pp-empty { padding: 18px 22px; }
.pp-empty p { font-size: 12px; color: var(--cream-dark); margin: 8px 0 10px; }
@media (max-width: 760px) { .pp-strip { grid-template-columns: repeat(2, 1fr); } }
@media print { .pp-card { display: none; } }

/* Linking dialog: matching cannot resolve every address, so a person pins the
   permit once and the resolver stops guessing for that project. */
#perm-modal .pm-back { position: fixed; inset: 0; z-index: 2000; background: rgba(28,28,28,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.pm-box { background: #fff; border-radius: 6px; width: min(760px, 100%); max-height: 82vh;
  display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.3); overflow: hidden; }
.pm-head { padding: 14px 20px; border-bottom: 1px solid var(--cream-mid); font-weight: 700;
  font-size: 13px; letter-spacing: .5px; text-transform: uppercase; }
.pm-sub { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--cream-dark);
  margin-left: 10px; font-size: 12px; }
.pm-body { padding: 14px 20px; overflow-y: auto; }
.pm-row { display: flex; gap: 8px; margin-bottom: 12px; }
.pm-row .vend-search { flex: 1 1 auto; }
.pm-results { display: flex; flex-direction: column; gap: 6px; }
.pm-cand { display: grid; grid-template-columns: 150px 1fr; gap: 2px 12px; text-align: left;
  font: inherit; padding: 8px 10px; cursor: pointer; background: var(--warm-gray);
  border: 1px solid transparent; border-radius: 4px; }
.pm-cand:hover { border-color: var(--cream-dark); background: #fff; }
.pm-c1 { grid-row: 1 / span 2; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-c2 { font-size: 12px; font-weight: 600; }
.pm-c3, .pm-c4 { font-size: 10px; color: var(--cream-dark); }
.pm-c4 { grid-column: 2; }
.pm-c5 { grid-column: 2; font-size: 10px; color: #6b6355; }
.pm-cand { align-items: center; }
.pm-cact { grid-column: 2; justify-self: end; grid-row: 1; }
.pm-cand-on { opacity: .6; }

/* What is already attached to the project, above the search for more. A job is
   usually three or four permits — grading, building, MEP, sometimes a pool —
   and you cannot tell from one number which of them are on file. */
/* The permit number is the way through to the city's own record, so it looks
   like the link it is rather than like the bold label it was. */
.pp-permit { color: var(--charcoal); text-decoration: none; border-bottom: 1px solid var(--cream-mid); }
.pp-permit:hover { border-bottom-color: var(--charcoal); }
.pp-warn { margin: 0 0 12px; padding: 9px 14px; background: #FDF6EC;
  border-left: 3px solid #C98A3C; border-radius: 3px; font-size: 11px;
  line-height: 1.5; color: #6b5333; }
.pm-src { font-size: 10px; color: var(--cream-dark); margin-bottom: 6px; }
.pm-sect { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700;
  color: var(--cream-dark); margin: 4px 0 8px; }
.pm-sect + .pm-sect, #pm-linked + .pm-sect { margin-top: 20px; }
.pm-none { font-size: 12px; color: var(--cream-dark); background: var(--warm-gray);
  padding: 10px 12px; border-radius: 4px; margin-bottom: 4px; }
.pm-lrow { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-bottom: 1px solid var(--warm-gray); font-size: 12px; }
.pm-lrow:last-of-type { border-bottom: 0; }
.pm-lnbr { font-variant-numeric: tabular-nums; font-weight: 700; flex: none; }
.pm-ltag { font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  background: var(--warm-gray); color: var(--cream-dark); padding: 1px 5px; border-radius: 2px; flex: none; }
.pm-lmain { background: #EEF2EC; color: #3D6B35; }
.pm-lmeta { font-size: 10px; color: var(--cream-dark); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.pm-lno { font-size: 9px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
  color: #8A4F27; background: #F7EDE4; padding: 1px 5px; border-radius: 2px; flex: none; }
.pm-lerr { font-size: 10px; color: var(--red); flex: none; }
.pm-lacts { margin-left: auto; flex: none; white-space: nowrap; }

.pm-foot { padding: 12px 20px; border-top: 1px solid var(--cream-mid); display: flex;
  gap: 8px; justify-content: flex-end; }
.pm-foot .perm-linkbtn { margin-right: auto; }
.perm-linkbtn { font: inherit; font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  padding: 3px 8px; border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff;
  color: var(--cream-dark); cursor: pointer; }
.perm-linkbtn:hover { color: var(--charcoal); border-color: var(--cream-dark); }
.perm-linkbtn.sm { padding: 1px 5px; font-size: 11px; letter-spacing: 0; margin-left: 4px; }
.perm-checked { font-size: 12px; color: var(--charcoal); font-weight: 600; }

/* Status is the point of this page; the reconciliation gap is a footnote. */
.ps { display: inline-block; font-size: 9.5px; letter-spacing: .4px; text-transform: uppercase;
  font-weight: 700; padding: 2px 6px; border-radius: 2px; white-space: nowrap; }
.ps-good { background: #EEF2EC; color: #3D6B35; }
.ps-info { background: #E8EEF4; color: #2B5570; }
.ps-warn { background: #F7EDE4; color: #8A4F27; }
.ps-bad  { background: #F5EAEA; color: #A0292A; }
.ps-dim  { background: var(--warm-gray); color: var(--cream-dark); }
.ps-detail { display: block; font-size: 10px; color: var(--cream-dark); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; }

/* ── Permits & inspections ─────────────────────────────────────────────────── */
.perm-table { font-size: 11.5px; table-layout: fixed; width: 100%; }
.perm-table th:nth-child(1), .perm-table td:nth-child(1) { width: 15%; }
.perm-table th:nth-child(2), .perm-table td:nth-child(2) { width: 17%; }
.perm-table th:nth-child(3), .perm-table td:nth-child(3) { width: 22%; }
.perm-table th:nth-child(4), .perm-table td:nth-child(4) { width: 19%; }
.perm-table th:nth-child(5), .perm-table td:nth-child(5) { width: 15%; }
.perm-table th:nth-child(6), .perm-table td:nth-child(6) { width: 12%; }
.perm-table td { vertical-align: top; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-top: 7px; padding-bottom: 7px; }

/* The base .ptable right-aligns every cell for money columns. Nothing on these
   two tables is money — it is addresses, dates, inspection names and results —
   so right-aligning made every column start in a different place. Force left
   throughout, and neutralise the .ctr/.right helpers inside them so a stray
   class cannot reintroduce the patchwork. */
.perm-table th, .perm-table td,
.pp-table th, .pp-table td { text-align: left; }
.perm-table td.ctr, .perm-table td.right,
.pp-table td.ctr, .pp-table td.right { text-align: left; }
.perm-table th:first-child, .perm-table td:first-child { padding-left: 20px; }
.pp-table th:first-child, .pp-table td:first-child { padding-left: 0; }
/* Dates share a column, so they line up only if the digits do. */
.perm-table .ins-date, .perm-table .st-n, .pp-date { font-variant-numeric: tabular-nums; }

/* Two lines per cell: the fact on top, the interpretation under it. */
.ins-line { display: flex; align-items: baseline; gap: 6px; }
.ins-line2 { margin-top: 2px; }
.ins-date { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--charcoal);
  white-space: nowrap; flex: none; }
.ins-date.ins-soon { color: #2B5570; }
/* Booked, the date has passed, nothing recorded against it. */
.ins-date.ins-stale { color: #8A4F27; }
.ins-when.ins-when-stale { color: #8A4F27; }
/* Nothing booked and no one on site for over a month. The KPI counts these;
   this is how you see which rows it means without cross-referencing. */
/* Which permit an inspection belongs to. Quiet enough to sit inside a cell that
   already carries a date, a name and a result, distinct enough to read. */
.ins-perm { font-size: 9px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
  color: #5B6B7A; background: #EEF1F4; padding: 1px 5px; border-radius: 2px; white-space: nowrap; }
/* Scheduled and history are two tables stacked on the same page, read as one
   list. Auto layout sized each to its own content, so the permit tag under
   SCHEDULED landed beneath RESULT in the table below it. Fixed columns, shared
   by both, so a column means the same thing all the way down. */
.pp-grid { table-layout: fixed; }
.pp-grid th, .pp-grid td { overflow: hidden; text-overflow: ellipsis; }
.pp-grid th:nth-child(1), .pp-grid td:nth-child(1) { width: 96px; }
.pp-grid th:nth-child(2), .pp-grid td:nth-child(2) { width: auto; }
.pp-grid th:nth-child(3), .pp-grid td:nth-child(3) { width: 150px; }
.pp-grid th:nth-child(4), .pp-grid td:nth-child(4) { width: 120px; }
.pp-grid th:nth-child(5), .pp-grid td:nth-child(5) { width: 168px; }
/* One line per row, and "…" where the text is longer than its column: the
   permit list ran past the card at 1111 Fiske (every cell kept on one line,
   the table sized to the longest). On a phone the tables keep their columns
   and scroll sideways inside the card (below). */
.pp-card .pp-table:not(.pp-grid) { table-layout: fixed; }
.pp-card .pp-table:not(.pp-grid) td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-card .pp-table:not(.pp-grid) td:nth-child(1) { width: 190px; }
.pp-card .pp-table:not(.pp-grid) td:nth-child(2) { width: 150px; }
.pp-card .pp-table:not(.pp-grid) td:nth-child(3) { width: 96px; }
.pp-card .pp-table:not(.pp-grid) td:nth-child(4) { width: 150px; }
.pp-card .pp-table:not(.pp-grid) td:nth-child(5) { width: auto; }
.pp-grid .perm-res { display: inline-block; max-width: calc(100% - 5px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
/* A booking has no result yet; this is the same chip shape, stated neutrally. */
.perm-res.perm-info { background: #EAF0F6; color: #35566F; }
.pp-perm { white-space: nowrap; }
.pp-hist th { font-size: 9px; letter-spacing: 1px; }
.ins-when.ins-quiet { color: #8A4F27; font-weight: 700; }
.ins-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-ago, .ins-when { font-size: 10px; color: var(--cream-dark); }
.ins-when { font-weight: 700; color: #2B5570; }
.ins-line2 .perm-res { margin-left: 0; margin-right: 5px; }

/* Stage reads as a number and a name, not a code to look up. */
.st-n { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: 6px; }
.st-name { color: var(--cream-dark); }

.rec-to { font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-note { font-size: 10px; color: #8A4F27; }
/* Every muted phrase in this table reads the same. There was no rule for a
   span carrying .dim — only one for a td — so "prior permit", "none scheduled",
   "no inspections yet" and the em-dashes all rendered at full size in the body
   colour, i.e. as emphasis, sitting next to "agrees" which was correctly small
   and grey. They are all the same kind of remark and now look like it. */
.rec-ok, .perm-table td .dim { font-size: 10px; color: var(--cream-dark); }
.perm-tools { justify-content: flex-end; }
/* The morning LADBS read, before the search: what it's doing, and its button. */
.perm-reader { display: flex; align-items: center; gap: 10px; margin-right: 12px; font-size: 10.5px; color: #7d7568; }
.perm-reader .buy-export { margin-left: 0; }
.perm-reader .perm-reader-note.sp-err { color: #8A4F27; }
@media (max-width: 760px) { .perm-reader { display: none; } }
.perm-table td:first-child, .perm-table th:first-child { padding-left: 20px; }
.perm-table td:last-child, .perm-table th:last-child { padding-right: 20px; }
.perm-table td a { color: var(--charcoal); text-decoration: none; font-weight: 600; }
.perm-table td a:hover { text-decoration: underline; }
.perm-date { font-variant-numeric: tabular-nums; color: var(--cream-dark); margin-right: 5px; }
.perm-type { font-size: 9px; color: var(--cream-dark); margin-left: 5px; }
.perm-link { font-variant-numeric: tabular-nums; }
.perm-res { font-size: 9px; letter-spacing: .4px; text-transform: uppercase; font-weight: 700;
  padding: 1px 5px; border-radius: 2px; margin-left: 5px; white-space: nowrap; }
.perm-good { background: #EEF2EC; color: #3D6B35; }
.perm-warn { background: #F7EDE4; color: #8A4F27; }
.perm-bad  { background: #F5EAEA; color: #A0292A; }
.perm-dim  { background: var(--warm-gray); color: var(--cream-dark); }
.perm-needs { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  background: #F5EFE2; color: #9A6210; padding: 1px 5px; border-radius: 2px; margin-right: 6px; }
/* A PO that is out but unsigned. Amber like the other "someone needs to act"
   states, and it names the wait, because 3 days and 30 are different problems. */
.po-sent { font-size: 9px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
  color: #8A4F27; background: #F7EDE4; padding: 1px 5px; border-radius: 2px; margin-left: 6px;
  white-space: nowrap; }
/* The movement chip is the same box as the count chip beside it — same type
   size, same padding, same height — so the pair reads as one unit. Only the
   colour says which is which. */
.mlg-d { flex: none; margin-left: 5px; white-space: nowrap; }
.mlg-d.up { color: #2F6B3A; background: #E6F1E8; }
.mlg-d.dn { color: #8A4F27; background: #F7EDE4; }
.mlg-d.flat { color: var(--cream-dark); background: #EEE9DF; }
.mlg-moves { font-size: 10px; color: var(--cream-dark); padding: 7px 9px 5px; }
.mlg-moves b { color: var(--charcoal); }
.vend-wait { font-weight: 700; color: #8A4F27; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vend-sub-wait { color: #8A4F27; }
.vend-job-wait .vend-job-meta { color: var(--charcoal); }
/* Finished for this vendor: every PO paid in full. */
.vend-job-done { opacity: .6; }
.vt-wait { color: #8A4F27; }
/* The follow-up list: one block per vendor, plain enough to paste into an email. */
.vend-tabs button.vend-tab-warn:not(.on) { color: #8A4F27; }
.aw-none { color: var(--cream-dark); }
.aw-wrap { padding: 4px 0 8px; }
.aw-bar { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; padding: 0 14px; font-size: 11px; color: var(--cream-dark); }
.aw-bar b { color: var(--charcoal); }
.aw-export { margin-left: auto; font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 5px 12px; border: 1px solid var(--charcoal); border-radius: 4px; background: var(--charcoal);
  color: #fff; cursor: pointer; white-space: nowrap; }
.aw-export:hover { opacity: .85; }
.aw-export:disabled, .aw-pdf:disabled { opacity: .5; cursor: default; }
.aw-pdf { margin-left: auto; font: inherit; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 9px; border: 1px solid #d8d2c4; border-radius: 3px; background: transparent; color: var(--charcoal);
  cursor: pointer; white-space: nowrap; }
.aw-pdf:hover { border-color: var(--charcoal); }
.aw-vendor { padding: 10px 14px; border-bottom: 1px solid var(--warm-gray); }
.aw-vendor:last-child { border-bottom: 0; }
.aw-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.aw-head a { font-weight: 700; color: var(--charcoal); text-decoration: none; }
.aw-head a:hover { text-decoration: underline; }
.aw-head .aw-meta { font-size: 10px; color: var(--cream-dark); }
.aw-po { display: grid; grid-template-columns: 1fr 210px 110px 90px; gap: 10px; font-size: 11.5px;
  padding: 3px 0; align-items: baseline; }
.aw-po .aw-job a { color: var(--charcoal); text-decoration: none; }
.aw-po .aw-title { color: var(--cream-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-po .aw-cost { text-align: right; font-variant-numeric: tabular-nums; }
.aw-po .aw-days { text-align: right; }
@media (max-width: 720px) {
  .aw-po { grid-template-columns: 1fr 90px; }
  .aw-po .aw-title { grid-column: 1 / -1; white-space: normal; }
  .aw-po .aw-days { grid-column: 2; }
}
.perm-needs-bad { background: #F5EAEA; color: #A0292A; }
.ps-bad { background: #F5EAEA; color: #A0292A; }
.perm-stale { font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  background: #F5EAEA; color: #A0292A; padding: 1px 4px; border-radius: 2px; margin-left: 6px; }
.perm-hist { font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  background: var(--warm-gray); color: var(--cream-dark); padding: 1px 4px; border-radius: 2px; margin-left: 5px; }
.perm-unlinked td { opacity: .72; }
/* The figures below this are historical. Amber, not red: nothing is broken —
   somebody deliberately un-published the budget — but the numbers are frozen
   and reading them as current would be wrong. */
.bs-roll { display: flex; gap: 12px; align-items: baseline; margin: 0 0 14px;
  padding: 11px 16px; background: #FDF6EC; border-left: 3px solid #C98A3C;
  border-radius: 3px; font-size: 12px; line-height: 1.55; color: #6b5333; }
.bs-roll b { color: #4a3720; }
.row-tag { font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  color: #8A4F27; background: #F5E4CE; padding: 1px 5px; border-radius: 2px; margin-left: 7px;
  vertical-align: 1px; }
/* Figures that cannot move until someone republishes the budget. By class,
   not column position: adding SINCE TRENCH shifted a positional rule onto
   the trench column (which keeps moving) and off UNCONTRACTED. */
.row-frozen td.fig { opacity: .78; }
.bs-roll-tag { flex: none; font-size: 9px; text-transform: uppercase; letter-spacing: .6px;
  font-weight: 700; color: #8A4F27; background: #F5E4CE; padding: 2px 7px; border-radius: 2px; }
/* Information, not a warning: a city we don't read is a decision to make, not
   a fault to fix, and a red box would train people to ignore red boxes. */
.perm-note { margin: 14px 20px 0; padding: 10px 14px; background: var(--warm-gray);
  border-left: 2px solid var(--cream-mid); border-radius: 3px;
  font-size: 11px; line-height: 1.55; color: var(--cream-dark); }
.perm-note b { color: var(--charcoal); }
/* A job in plan check is not a job with no data — it is a job at a known,
   reportable stage of review. Marked, not dimmed. */
.pc-status { font-weight: 600; }
.perm-review .perm-link { color: var(--cream-dark); }
/* An outstanding clearance is the thing actually holding the permit up. */
.ins-ago.pc-block { color: #8A4F27; font-weight: 700; }
/* A linked row carries two lines in every cell and an unlinked one carries a
   single line, so the table stepped by 17px as you read down it. Every row is
   the taller height now, whatever it holds — the eye tracks a steady rhythm
   and the unlinked rows read as part of the same list rather than an aside. */
.perm-table tbody td { height: 52px; }

/* Legend overlays the map on the right: it is a property of the map, and
   putting it underneath pushed the whole portfolio table down a row. Click a
   phase to toggle it wholesale, a stage to toggle just that one, or either
   count to isolate it. */
/* The legend's width and inset; the map sizing reads the inset back. */
.map-shell { position: relative; --mlg-w: 194px; --mlg-inset: 12px; }
#map-legend {
  position: absolute; top: var(--mlg-inset); right: var(--mlg-inset); z-index: 1000; width: var(--mlg-w);
  display: flex; flex-direction: column; max-height: calc(100% - 2 * var(--mlg-inset));
  background: rgba(255,255,255,.96); border: 1px solid var(--cream-mid);
  border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.12); overflow: hidden;
}
.mlg-top { display: flex; align-items: baseline; justify-content: space-between;
  gap: 6px; padding: 7px 9px 5px; border-bottom: 1px solid var(--cream-mid); }
.mlg-title { font-size: 8.5px; letter-spacing: 1px; text-transform: uppercase;
  font-weight: 700; color: var(--cream-dark); }
.mlg-count { font-size: 9px; color: var(--cream-dark); font-variant-numeric: tabular-nums; }
.mlg-scroll { overflow-y: auto; padding: 4px 0; }
.mlg-group + .mlg-group { border-top: 1px solid #EFEADC; margin-top: 3px; padding-top: 3px; }
.mlg-head, .mlg-row {
  display: flex; align-items: center; gap: 6px; width: 100%; cursor: pointer;
  font: inherit; background: none; border: 0; text-align: left;
  padding: 3px 9px; color: var(--charcoal);
}
.mlg-head { font-size: 10px; font-weight: 700; }
.mlg-row { font-size: 9.5px; padding-left: 20px; color: #4A4A4A; }
.mlg-head:hover, .mlg-row:hover { background: var(--warm-gray); }
.mlg-head i, .mlg-row i { flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.mlg-head i { width: 10px; height: 10px; }
.mlg-row i { width: 8px; height: 8px; }
.mlg-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlg-n, .mlg-d { flex: none; font-variant-numeric: tabular-nums; font-size: 9px; font-weight: 700;
  line-height: 14px; border-radius: 2px; padding: 0 4px; }
.mlg-n { color: var(--cream-dark); background: var(--warm-gray); }
.mlg-n:hover { background: var(--cream-mid); color: var(--charcoal); }
.mlg-head.off, .mlg-row.off { opacity: .4; }
.mlg-head.off i, .mlg-row.off i { background: transparent !important;
  box-shadow: inset 0 0 0 1.5px var(--cream-dark); }
.mlg-foot { display: flex; gap: 4px; padding: 6px 9px; border-top: 1px solid var(--cream-mid); }
.mlg-foot button { flex: 1 1 0; font: inherit; font-size: 8.5px; letter-spacing: .7px;
  text-transform: uppercase; padding: 3px 0; cursor: pointer; color: var(--cream-dark);
  background: #fff; border: 1px solid var(--cream-mid); border-radius: 2px; }
.mlg-foot button:hover { color: var(--charcoal); border-color: var(--cream-dark); }
.mlg-note { font-size: 8.5px; color: var(--cream-dark); padding: 0 9px 7px; }

/* Too narrow to overlay without burying the map — drop it below instead. */
@media (max-width: 860px) {
  #map-legend { position: static; width: auto; max-height: none; border: 0;
    border-top: 1px solid var(--cream-mid); border-radius: 0; box-shadow: none; }
  .mlg-scroll { display: flex; flex-wrap: wrap; gap: 0 10px; }
  .mlg-group { flex: 1 1 150px; }
}

.map-tip {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
}
.map-tip { max-width: 210px; }
.map-tip b { display: block; font-size: 12px; margin-bottom: 2px; white-space: normal; }
.map-tip span { display: block; font-size: 10.5px; color: var(--cream-dark); line-height: 1.5; }
.map-tip .mt-stage { color: var(--charcoal); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.map-tip .mt-stage i { width: 8px; height: 8px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.map-tip .mt-neg { color: var(--red); }
@media (max-width: 760px) { #map { height: 300px; } .mleg-note { margin-left: 0; } }

/* ── Purchasing report views ─────────────────────────────────────────────── */
.prpt-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi-gold { background: var(--cream); }
.kpi-gold .val { color: var(--amber); }
.prpt-body { padding: 4px 0 10px; }
table.rtable { font-size: 11.5px; }
.rtable th { text-align: center; }
.rtable th.left { text-align: left; }
.rtable th.right, .rtable td.right { text-align: right; }
.rtable td { text-align: left; white-space: normal; }
.rtable td.ctr { text-align: center; white-space: nowrap; }
.rtable td.proj { font-weight: 700; white-space: nowrap; }
.rtable td.busts { line-height: 1.65; }
.rtable .focus-hot { color: var(--red); font-weight: 700; }
.rtable tr.proj-break td {
  background: var(--cream); font-weight: 700; font-size: 11px;
  border-top: 2px solid var(--cream-dark); padding: 7px 12px;
}
.rtable-note { padding: 12px 28px; font-size: 11px; color: var(--cream-dark); }
.designer-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.designer-pick label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark);
}
.designer-pick select {
  font: inherit; font-size: 12px; color: var(--charcoal);
  background: #fff; border: 1px solid var(--cream-mid); border-radius: 3px;
  padding: 6px 10px; min-width: 200px;
}

/* ── Estimator ───────────────────────────────────────────────────────────── */
.est-cta { font-weight: 700; color: var(--red); text-decoration: none; }
.est-back { display: inline-block; font-size: 11px; letter-spacing: .5px; color: var(--cream-dark); text-decoration: none; margin-bottom: 8px; }
.est-back:hover { color: var(--charcoal); }
.est-list tbody tr { cursor: pointer; }
/* "estimate →" on a portfolio row without a budget: the row opens the project,
   this opens the estimator. */
.est-link { color: var(--cream-dark); text-decoration: none; white-space: nowrap; }
.est-link:hover { color: var(--charcoal); text-decoration: underline; }
/* Designers page: one table — a row per project carrying its budget tracking,
   the items still needed indented beneath it. */
#view.view-designers { max-width: 1360px; }
.dsg-table tbody tr:not(.proj-break) td { font-size: 11px; }
.dsg-table td:nth-child(2) { white-space: nowrap; }
.dsg-table tbody tr:not(.proj-break) td:first-child { padding-left: 28px; font-weight: 400; }
.dsg-table tr.dsg-proj { cursor: pointer; }
.dsg-table tr.dsg-proj td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dsg-table tr.dsg-proj td:last-child { font-weight: 600; font-size: 10px; }
.dsg-stage { font-weight: 400; color: var(--cream-dark); margin-left: 12px; }
.dsg-table td.neg { color: #b23b3b; }
.dsg-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; font-size: 10px;
  color: var(--cream-dark); }
.dsg-tools label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.dsg-tools button, .designer-pick .dsg-all { font: inherit; font-size: 10.5px; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; color: var(--charcoal); }
.dsg-tools button:hover:not(:disabled), .designer-pick .dsg-all:hover:not(:disabled) { border-color: var(--charcoal); }
.dsg-tools button:disabled, .designer-pick .dsg-all:disabled { opacity: .5; cursor: default; }
.designer-pick .dsg-all { margin-left: 12px; }
@media print { .dsg-tools, .designer-pick { display: none !important; } }

/* Estimator: the save line and history controls under the total. */
.est-save { font-size: 10px; color: var(--cream-dark); margin-top: 8px; }
.est-save.err { color: #b23b3b; font-weight: 600; }
.est-hist { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.est-hist select { font: inherit; font-size: 10.5px; padding: 3px 5px; border: 1px solid var(--cream-mid);
  border-radius: 3px; background: #fff; color: var(--charcoal); max-width: 230px; }
.est-hist select:disabled { opacity: .6; }
.est-total .est-mini { font: inherit; font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: none;
  padding: 3px 8px; border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff;
  color: var(--charcoal); cursor: pointer; }
.est-total .est-mini:hover { border-color: var(--charcoal); }
@media print { .est-save, .est-hist { display: none !important; } }
.est-wrap { background: #fff; border-top: 4px solid var(--charcoal); box-shadow: 0 1px 4px rgba(28,28,28,.08); }
.est-head { display: flex; justify-content: space-between; align-items: flex-start; background: var(--cream); padding: 16px 28px; gap: 20px; }
.est-head h1 { font-size: 22px; letter-spacing: .5px; margin: 6px 0 4px; text-transform: uppercase; }
.est-total { text-align: right; flex-shrink: 0; }
.est-total .lbl { font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark); }
.est-total .val { font-size: 26px; font-weight: 700; margin: 4px 0 8px; }
.est-total button { font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  background: var(--charcoal); color: var(--cream); border: none; padding: 8px 14px; border-radius: 3px; cursor: pointer; }
.est-controls { display: flex; flex-wrap: wrap; gap: 18px 28px; padding: 16px 28px; border-bottom: 1px solid var(--cream-mid); }
.est-group { display: flex; flex-direction: column; gap: 8px; }
.est-gh { font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--cream-dark); margin-bottom: 2px; }
.est-group .assign-field { gap: 6px; }
.est-group .assign-field label { font-size: 8.5px; }
.est-controls select, .est-controls input { font: inherit; font-size: 12px; border: 1px solid var(--cream-mid); border-radius: 3px; padding: 4px 6px; background: #fff; }
.feat-row { display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 320px; }
.feat-box { font-size: 12px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.est-comps { padding: 14px 28px; border-bottom: 1px solid var(--cream-mid); }
.comp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 18px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.comp-row { font-size: 12px; padding: 3px 0; }
.comp-row.on { background: var(--warm-gray); border-radius: 3px; }
.comp-pick { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.comp-sqft { display: inline-flex; gap: 6px; margin: 2px 0 4px 24px; font-size: 11px; color: var(--cream-dark); align-items: center; }
.comp-sqft input { width: 56px; font-size: 11px; padding: 2px 4px; border: 1px solid var(--cream-mid); border-radius: 3px; margin-left: 2px; }
.est-table .small { font-size: 9px; }
.est-table .line-input { width: 92px; text-align: right; font: inherit; font-size: 11.5px; border: 1px solid transparent; border-radius: 3px; padding: 2px 4px; background: transparent; }
.est-table .line-input:hover, .est-table .line-input:focus { border-color: var(--cream-mid); background: #fff; }
.est-table tr.ovr .line-input { border-color: var(--red); color: var(--red); font-weight: 700; }
.est-table .ovr-x { cursor: pointer; color: var(--red); margin-left: 4px; text-decoration: none; }
.est-table tfoot td { border-top: 2px solid var(--charcoal); font-weight: 700; font-size: 13px; }

/* ── Upload UX ───────────────────────────────────────────────────────────── */
#drop-overlay {
  position: fixed; inset: 0; z-index: 1200; display: none;
  background: rgba(28,28,28,.82); color: var(--cream);
  align-items: center; justify-content: center;
  font-size: 20px; letter-spacing: 1px;
}
#drop-overlay > div { border: 2px dashed var(--cream-dark); border-radius: 10px; padding: 40px 60px; }
body.dragging #drop-overlay { display: flex; }

#toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 1300;
  display: none; max-width: 380px;
  background: var(--charcoal); color: var(--cream);
  border-radius: 6px; padding: 14px 18px; font-size: 12px; line-height: 1.7;
  box-shadow: 0 4px 18px rgba(0,0,0,.3);
}
#toast.show { display: block; }
#toast .t-ok::before  { content: "✓  "; color: #9CBF8E; }
#toast .t-err::before { content: "✗  "; color: #E08A8B; }

/* "Stay fresh" bar — prompts a reload when the deployed code or the synced data
   is newer than what this tab is running. Bottom-center so it clears the
   bottom-right #toast. */
#update-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 1290;
  display: flex; align-items: center; gap: 14px;
  background: #2d4a34; color: var(--cream);
  border-radius: 8px; padding: 10px 12px 10px 18px; font-size: 12.5px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
#update-bar[hidden] { display: none; }
#update-bar button {
  font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; border-radius: 3px; font-weight: 700;
}
#update-reload { background: var(--cream); color: var(--charcoal); border: none; padding: 5px 13px; }
#update-reload:hover { background: var(--cream-mid); }
#update-dismiss { background: transparent; color: var(--cream-mid); border: none;
  font-size: 17px; line-height: 1; padding: 2px 6px; }
#update-dismiss:hover { color: #fff; }

/* ── Vendors ─────────────────────────────────────────────────────────────── */
.vend-loading { padding: 60px 30px; text-align: center; color: var(--cream-dark); font-size: 13px; }
/* Vendor views set their own edge inset so text never runs to the card edge.
   --vp-pad is the single knob; it matches .ptable's built-in 28px first-column
   inset so controls line up with the table below them. Tables are NOT wrapped
   in this padding — they carry their own and should run the card's full width. */
.prpt-body { --vp-pad: 28px; }
.vend-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 var(--vp-pad) 14px; border-bottom: 1px solid #e3ded2; margin: 6px 0 2px; }
.vend-tabs button {
  font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  background: transparent; color: var(--cream-dark); border: 1px solid #d8d2c4;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
}
.vend-tabs button.on { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }
.vend-search {
  font: inherit; font-size: 12px; padding: 6px 10px; border: 1px solid #d8d2c4;
  border-radius: 3px; min-width: 210px; margin-left: auto;
}
.vend-only { font-size: 11px; color: var(--cream-dark); display: flex; align-items: center; gap: 5px; }
.vend-table td, .vend-table th { vertical-align: middle; }
/* The trade column reads as text, beside the vendor. */
.vend-table th.left, .vend-table td.left { text-align: left; }
.vend-row { cursor: pointer; }
.vend-row:hover { background: #f0ece2 !important; }
.vend-tag { font-size: 9px; letter-spacing: .5px; text-transform: uppercase;
  background: #e6e0d2; color: #6b6355; padding: 2px 6px; border-radius: 3px; margin-left: 8px; }
.vend-detail > td { padding: 0 !important; }
.vend-jobs { padding: 4px 18px 14px 30px; }
.vend-sub { font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--cream-dark); margin: 10px 0 4px; }
.vend-sub-open { color: #9c5b2f; }
.vend-job { padding: 6px 0; border-bottom: 1px solid #ece7dc; }
.vend-job:last-child { border-bottom: none; }
.vend-job-addr { font-size: 12.5px; font-weight: 600; color: var(--charcoal); text-decoration: none; }
.vend-job-addr:hover { text-decoration: underline; }
.vend-job-meta { font-size: 11px; color: var(--cream-dark); margin-left: 10px; }
.vend-codes { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 5px; }
.vend-chip { font-size: 10.5px; background: #efeadf; color: #4a4438;
  padding: 2px 8px; border-radius: 10px; }
.vend-open-n { color: #9c5b2f; font-weight: 700; }
/* The month a line of jobs was on site (vendor row, opened). */
.vend-mo { display: inline-block; min-width: 110px; font-size: 11px; color: var(--cream-dark); }
.vend-open-amt { color: #9c5b2f; }
.vend-empty { text-align: center; color: var(--cream-dark); padding: 26px; font-size: 12px; }
.vend-count { font-size: 11px; color: var(--cream-dark); padding: 10px var(--vp-pad) 0; }
/* No wrapper padding — the table supplies its own 28px inset and should use the
   card's full width. */
#vend-table { padding: 0 0 6px; }

/* Sortable headers */
.vend-th { cursor: pointer; user-select: none; white-space: nowrap; }
.vend-th:focus-visible { outline: 2px solid var(--charcoal); outline-offset: -3px; }
.vend-th:hover { color: var(--charcoal); }
.vend-th-on { color: var(--charcoal); }
.vend-arrow { font-size: 8px; margin-left: 4px; }

/* Row → vendor page */
.vend-go-th { width: 30px; }
.vend-go-td { text-align: right; padding-right: 10px !important; }
.vend-go {
  display: inline-block; text-decoration: none; color: var(--cream-dark);
  font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 3px;
}
.vend-go:hover { color: #fff; background: var(--charcoal); }
.vend-chip-link { text-decoration: none; }
.vend-chip-link:hover { background: var(--charcoal); color: var(--cream); }

/* ── One vendor's page ───────────────────────────────────────────────────── */
.vend-loading { padding: 60px 30px; }
/* Shared page-level back button (vendor pages, project pages). */
.vp-back, .back-link {
  display: inline-block; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; font-weight: 700; color: var(--charcoal);
  text-decoration: none; margin-bottom: 12px;
  border: 1px solid #d8d2c4; border-radius: 3px; padding: 6px 14px; background: #fff;
}
.vp-back:hover, .back-link:hover { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }
/* Screen-only: the printed copy shows the week as text instead (see @media print). */
.inv-week-print { display: none; }

.vt-summary { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 0 var(--vp-pad) 4px;
  font-size: 11.5px; color: var(--cream-dark); }
.vt-summary b { color: var(--charcoal); font-weight: 700; }
.vt-stale { color: #9c5b2f; font-style: normal; }

/* One vendor's jobs: one row each, a bar for how far along they are. */
.vt-summary { margin: 4px 0 10px; }
.vp-jobs td { vertical-align: middle; }
.vp-jobs .vend-row a { color: var(--charcoal); text-decoration: none; font-weight: 700; }
.vp-jobs .vend-row a:hover { text-decoration: underline; }
.vp-pct { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.vp-pct b { min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.vp-bar { flex: 1 1 auto; height: 6px; background: #e6e0d2; border-radius: 3px; overflow: hidden; }
.vp-bar i { display: block; height: 100%; background: var(--charcoal); border-radius: 3px; }
.vp-paid-toggle td { cursor: pointer; font-size: 11.5px; color: var(--cream-dark); }
.vp-paid-toggle:hover td { color: var(--charcoal); }

/* A job's POs, opened from its row. Fixed layout + explicit widths keep the
   columns in register from one job to the next. */
.vp-po { font-size: 11.5px; table-layout: fixed; background: #fbf9f4; }
.vp-po th:nth-child(1), .vp-po td:nth-child(1) { width: 8%; }
.vp-po th:nth-child(3), .vp-po td:nth-child(3) { width: 22%; }
.vp-po th:nth-child(4), .vp-po td:nth-child(4) { width: 12%; }
.vp-po th:nth-child(5), .vp-po td:nth-child(5) { width: 9%; }
.vp-po th:nth-child(6), .vp-po td:nth-child(6) { width: 11%; }
.vp-po th:nth-child(7), .vp-po td:nth-child(7) { width: 8%; }
/* Fixed columns can't grow, so long values clip cleanly instead of overflowing. */
.vp-po td { overflow: hidden; text-overflow: ellipsis; }
.vp-cc, .vp-status { font-size: 10.5px; color: #6b6355; }
.vp-open-pill, .vp-done-pill { font-size: 9px; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.vp-open-pill { background: #f7ede4; color: #8a4f27; font-weight: 700; }
.vp-done-pill { background: #eef0ec; color: #6b7566; }

/* Sync health banner — the nightly phases fail silently otherwise. */
#sync-alert {
  display: flex; align-items: flex-start; gap: 11px;
  background: #4a2020; color: #f5e9e9;
  padding: 11px 22px; font-size: 12px; line-height: 1.5;
}
#sync-alert[hidden] { display: none; }
#sync-alert b { display: block; font-size: 10px; letter-spacing: 1.2px;
  text-transform: uppercase; color: #f0c9c9; margin-bottom: 2px; }
.sa-dot { width: 7px; height: 7px; border-radius: 50%; background: #e08a8b;
  flex: 0 0 auto; margin-top: 6px; }
/* Same failure as the health panel: an upstream error is unbroken JSON, so the
   banner needs to be able to shrink and to break mid-token. */
.sa-msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
#sync-alert button { background: transparent; border: none; color: #d9b3b3;
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
#sync-alert button:hover { color: #fff; }
@media print { #sync-alert { display: none !important; } }

/* Closed-out comparables stay selectable but are marked so an estimate built on
   historical jobs is never mistaken for one built on active work. */
.comp-arch { font-size: 8.5px; letter-spacing: .5px; text-transform: uppercase;
  background: #e6e0d2; color: #6b6355; padding: 1px 5px; border-radius: 3px; margin-left: 5px; }

/* Scope caption for the portfolio KPI band. Lives with the numbers (and prints)
   so "all-time incl. archived" can't be mistaken for the active-only counts
   shown in the header beside it. */
.kpi-scope { font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--cream-dark); background: #fff; line-height: 1.3;
  /* Even padding — .kpis has a border-top, so an unpadded bottom left the text
     sitting on that line and reading as vertically off-centre. */
  padding: 11px 28px; }

.empty-state {
  background: #fff; border-top: 4px solid var(--charcoal);
  padding: 70px 30px; text-align: center; color: var(--cream-dark);
}
.empty-state h2 { color: var(--charcoal); font-size: 18px; letter-spacing: 1px; margin-bottom: 12px; }

/* ── Print: one report per letter page, no chrome ───────────────────────── */
@media print {
  #toolbar, #update-bar, #drop-overlay, #toast, .rpt-dates select, .section-note, .map-wrap,
  .assign-bar, .designer-pick, .vend-tabs,
  /* Controls are meaningless on paper. */
  .inv-refresh, .vend-go-th, .vend-go-td, .est-back, .vp-back, .back-link { display: none !important; }
  /* …but the week the printout covers must survive the hidden <select>. */
  .inv-week-print { display: inline !important; }
  /* Notes must print their full text, not a form control. */
  .inv-notes { border: none !important; background: transparent !important;
    resize: none; overflow: visible !important; }
  /* Expanded vendor/cost-code detail shouldn't split across pages. */
  .vend-detail, .vend-job { break-inside: avoid; }
  body { background: #fff; }
  #view { max-width: none; margin: 0; padding: 0; }
  .report, .ptable-wrap { box-shadow: none; margin: 0; page-break-after: always; }
  .report { border: none; }
  .kpis, .rpt-head, .strip, .col-head, .col-total, .ob tbody tr:nth-child(odd),
  .unc tbody tr:nth-child(odd) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: none; }
  .cols { grid-template-columns: 1fr; }
  .rpt-head { flex-direction: column; gap: 8px; }
  .rpt-dates { text-align: left; }
}

/* ── Buyout reports ──────────────────────────────────────────────────────── */
.buy-tabs { flex-wrap: wrap; }
.buy-filter { font: inherit; font-size: 11px; padding: 5px 8px; border: 1px solid #d8d2c4;
  border-radius: 3px; background: #fff; max-width: 190px; }
.buy-table { font-size: 11.5px; }
/* Closeout: one job at a time, one line a row. The columns are fixed (they
   used to size to each job's contents and jump about from job to job); the
   notes take whatever the canvas has left. A narrow screen scrolls the table
   rather than squeezing it. */
.closeout-wrap { overflow-x: auto; }
/* Specific enough to outrank the phone rule that gives every report table a
   640px floor: fixed columns at 640 squeezed the description and notes to nothing. */
table.ptable.closeout-table { table-layout: fixed; width: 100%; min-width: 1100px; }
table.closeout-table col.co-c-code { width: 96px; }
table.closeout-table col.co-c-desc { width: 26%; }
table.closeout-table col.co-c-num { width: 108px; }
table.closeout-table > thead > tr > th, table.closeout-table > tbody > tr > td { white-space: nowrap; }
/* The description wraps rather than hiding the code's other mismatches past an ellipsis. */
table.closeout-table > tbody > tr > td.co-desc { white-space: normal; }
.co-desc .co-also { display: block; }
/* Only a code's own row opens its trail: the bucket headings and the trail aren't clickable. */
table.closeout-table > tbody > tr.co-bucket, table.closeout-table > tbody > tr.co-trail { cursor: default; }
table.closeout-table > tbody > tr.co-bucket:hover, table.closeout-table > tbody > tr.co-trail:hover { background: none; }
table.closeout-table > tbody > tr.co-trail > td { font-weight: 400; }
table.closeout-table .inv-notes { min-width: 0; }
.inv-notes.co-unsaved, .inv-notes.co-unsaved:focus { border-color: var(--red); background: #fff; }
.co-lines tr.co-draft td { color: var(--cream-dark); font-style: italic; }
.co-warn { color: var(--red); }
.co-job { font-size: 13px; font-weight: 700; letter-spacing: .3px; margin-top: 6px; }
/* The scrollbar's room kept on this page, so a short job doesn't shift the columns. */
html.co-route { scrollbar-gutter: stable; }
/* On paper: the job named in the header (the bar above the table isn't
   printed), and the table fitted to the page. */
@media print {
  table.ptable.closeout-table { min-width: 0; }
  .closeout-wrap { overflow: visible; }
  table.closeout-table col.co-c-code { width: 62px; }
  table.closeout-table col.co-c-num { width: 74px; }
  table.closeout-table col.co-c-desc { width: 30%; }
}
.co-also { font-size: 10.5px; color: var(--cream-dark); font-weight: 400; }
table.closeout-table td.co-hot { font-weight: 700; }
tr.co-bucket .co-bucket-name { letter-spacing: 1px; }
tr.co-bucket .co-bucket-what { font-weight: 400; color: var(--cream-dark); }
table.closeout-table > tbody > tr.co-bucket > td, table.closeout-table > tbody > tr.co-trail > td { white-space: normal; }
.co-trail-h { font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--cream-dark); margin: 10px 0 5px; }
.co-trail-h .dim { font-weight: 400; letter-spacing: 0; }
table.co-lines { margin-bottom: 4px; }
.co-nav { align-items: center; gap: 8px; }
.co-filter { max-width: none; min-width: 320px; }
.co-nav .buy-export { margin-left: 0; }
.co-step { min-width: 34px; }
.co-step:disabled { opacity: .35; cursor: default; }
.co-pos { font-size: 11px; color: var(--cream-dark); }
@media (max-width: 760px) { .co-filter { min-width: 0; flex: 1; } .co-pos { flex-basis: 100%; } }
/* The row count, with the export of exactly those rows at its right. */
.buy-count { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.buy-export { margin-left: auto; font: inherit; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 4px 10px; border: 1px solid #d8d2c4; border-radius: 3px; background: #fff; color: var(--charcoal); cursor: pointer; white-space: nowrap; }
.buy-export:hover { border-color: var(--charcoal); }
.buy-export:disabled { opacity: .5; cursor: default; }
@media print { .buy-export { display: none !important; } }
.buy-table td, .buy-table th { vertical-align: middle; }
.buy-stage { font-variant-numeric: tabular-nums; color: #6b6355; }
.buy-period { font-size: 10px; color: var(--cream-dark); }
.buy-pill { display: inline-block; font-size: 9px; letter-spacing: .5px; text-transform: uppercase;
  font-weight: 700; padding: 3px 8px; border-radius: 3px; white-space: nowrap; }
.buy-bad  { background: #f5eaea; color: #a0292a; }
.buy-warn { background: #f7ede4; color: #8a4f27; }
.buy-good { background: #eef2ec; color: #4a6b45; }
.buy-dim  { background: #f0ece2; color: #6b6355; font-weight: 400; }
.buy-crit { display: inline-block; white-space: nowrap; font-size: 8.5px; letter-spacing: .5px; text-transform: uppercase;
  background: #a0292a; color: #fff; padding: 1px 5px; border-radius: 3px; }
.buy-cond { display: inline-block; white-space: nowrap; font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px;
  background: #e6e0d2; color: #6b6355; padding: 1px 5px; border-radius: 3px; }
/* Flags sit in their own column rather than stacked under the status pill,
   which made every row a different height and shrank them to unreadable. */
.buy-flags { white-space: nowrap; }
.buy-flags > * + * { margin-left: 3px; }
.buy-flag { font-size: 8.5px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
            display: inline-block; padding: 1px 5px; border-radius: 2px;
            background: #f0ece2; color: #6b6355; }
.buy-flags .dim { font-size: 10px; }
/* Invoiced share is the number Jason scans for, so it reads as data, not a footnote. */
.buy-pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--charcoal); }

/* Two lines on every tab, so the table below never shifts when you switch. */
.buy-sched { display: flex; align-items: center; gap: 8px; justify-content: flex-end;
             margin-top: 6px; font-size: 10px; }
/* The header's date column never shrinks, so a long Box error would squeeze the
   report title into three lines. Cap it and let the message wrap instead. */
.rpt-dates .buy-sched { max-width: 460px; margin-left: auto; line-height: 1.45; }
.buy-sched > span { text-align: right; }
.buy-sched .bs-note { flex: none; white-space: nowrap; cursor: help; }
.buy-sched .bs-ok { color: var(--cream-dark); }
.buy-sched .bs-warn { color: #8a4f27; font-weight: 600; }
.buy-sched .bs-bad { color: #b23b3b; font-weight: 600; }

.buy-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 10px 20px 12px;
              border-bottom: 1px solid var(--cream-mid); min-height: 41px; box-sizing: border-box; }
.bl-item { font-size: 10px; color: var(--cream-dark); display: flex; align-items: center; gap: 6px; }
.bl-item > span:first-child { flex: none; }
.buy-foot { font-size: 10.5px; color: var(--cream-dark); padding: 12px 20px 4px; line-height: 1.6; }
.buy-note { font-size: 11px; color: #8a4f27; background: #fdf6ee; border-left: 3px solid #d9a441;
  padding: 8px 12px; margin: 8px var(--vp-pad); border-radius: 3px; }
.buy-table td a { color: var(--charcoal); text-decoration: none; font-weight: 600; }
.buy-table td a:hover { text-decoration: underline; }
@media print { .buy-tabs { display: none !important; }
  .buy-legend { break-inside: avoid; } }

/* Buyout tables are 8–9 columns of dense data — they need more room than the
   1060px narrative reports, which is what was pushing the table past its card. */
#view.view-wide { max-width: 1560px; }
#view.view-mid { max-width: 1240px; }

/* The report description runs 1–3 lines depending on the view. Reserve the
   height of the longest so the controls beneath never shift as you switch tabs. */
/* Reserve the tallest description so the controls below never shift between
   views. Measured on the widened canvas: all three fit one line (12px) at
   1280px+ and wrap to two (24px) at tablet width, so 24px is the worst case. */
.prpt .rpt-head .job-meta { min-height: 24px; }

/* Fixed columns stop the sprawl and keep the three tabs in register. */
.buy-table { table-layout: fixed; width: 100%; }
.buy-table th, .buy-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buy-table td:first-child, .buy-table th:first-child { padding-left: 20px; }
.buy-table td:last-child, .buy-table th:last-child { padding-right: 20px; }
.buy-table .buy-period { font-size: 9.5px; }
/* Contracting: project | PM | stage | code | period | by | po | budget | status | flags */
.buy-contract th:nth-child(1), .buy-contract td:nth-child(1) { width: 12%; }
.buy-contract th:nth-child(2), .buy-contract td:nth-child(2) { width: 8%; }
.buy-contract th:nth-child(3), .buy-contract td:nth-child(3) { width: 4%; }
.buy-contract th:nth-child(4), .buy-contract td:nth-child(4) { width: 20%; }
.buy-contract th:nth-child(5), .buy-contract td:nth-child(5) { width: 11%; }
.buy-contract th:nth-child(6), .buy-contract td:nth-child(6) { width: 4%; }
.buy-contract th:nth-child(7), .buy-contract td:nth-child(7) { width: 14%; }
.buy-contract th:nth-child(8), .buy-contract td:nth-child(8) { width: 8%; }
.buy-contract th:nth-child(9), .buy-contract td:nth-child(9) { width: 9%; }
.buy-contract th:nth-child(10), .buy-contract td:nth-child(10) { width: 10%; }
/* Payment: project | PM | stage | code | vendor | committed | invoiced | % | remaining | by | status | flags */
.buy-payment th:nth-child(1), .buy-payment td:nth-child(1) { width: 12%; }
.buy-payment th:nth-child(2), .buy-payment td:nth-child(2) { width: 7%; }
.buy-payment th:nth-child(3), .buy-payment td:nth-child(3) { width: 4%; }
.buy-payment th:nth-child(4), .buy-payment td:nth-child(4) { width: 16%; }
.buy-payment th:nth-child(5), .buy-payment td:nth-child(5) { width: 10%; }
.buy-payment th:nth-child(6), .buy-payment td:nth-child(6) { width: 9%; }
.buy-payment th:nth-child(7), .buy-payment td:nth-child(7) { width: 9%; }
.buy-payment th:nth-child(8), .buy-payment td:nth-child(8) { width: 5%; }
.buy-payment th:nth-child(9), .buy-payment td:nth-child(9) { width: 9%; }
.buy-payment th:nth-child(10), .buy-payment td:nth-child(10) { width: 4%; }
.buy-payment th:nth-child(11), .buy-payment td:nth-child(11) { width: 8%; }
.buy-payment th:nth-child(12), .buy-payment td:nth-child(12) { width: 7%; }


/* ── Sign-in, who's signed in, people & access ───────────────────────────── */
/* Signed out: no navigation at all. Signed in without a role: only the name
   menu (so they can sign out) — the pages would all answer 403. */
body.signed-out .tb-links > :not(.tb-user) { display: none; }
.auth-form input[hidden] { display: none; }
/* A PM's toolbar: My Projects and their initials, nothing else. */
.tb-links a.tb-mine { display: none; }
body.role-pm .tb-links a.tb-mine { display: inline-block; }
body.role-pm .tb-links > :not(.tb-mine):not(.tb-user) { display: none !important; }
.tb-brand { text-decoration: none; color: inherit; }
/* The account menu: initials on the bar, the full name inside (and on phones). */
.tb-user .tb-menu { left: auto; right: -8px; min-width: 240px; }
.tb-user #user-name { color: var(--cream); border-bottom: none; padding: 0; }
.u-initials { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--cream-dark); font-size: 11px; letter-spacing: .5px; font-weight: 700; color: var(--cream); }
#user-name:hover .u-initials, .tb-user:focus-within .u-initials, #user-name.active .u-initials { background: var(--cream); color: var(--charcoal); border-color: var(--cream); }
.u-full { display: none; }
.um-who { padding: 8px 16px 10px; font-size: 10px; color: var(--cream-dark); letter-spacing: 0; text-transform: none;
  border-bottom: 1px solid #3a3a3a; margin-bottom: 4px; line-height: 1.5; word-break: break-all; }
.um-who b { display: block; color: var(--cream); font-size: 12px; font-weight: 700; margin-bottom: 2px; word-break: normal; }
.auth-card { max-width: 400px; margin: 60px auto 0; background: #fff; border-top: 4px solid var(--charcoal);
  box-shadow: 0 1px 4px rgba(28,28,28,.08); padding: 34px 38px 30px; }
.auth-brand { font-weight: 700; font-size: 12px; letter-spacing: 2px; margin-bottom: 26px; }
.auth-brand span { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--cream-dark); margin-top: 3px; font-weight: 400; }
.auth-card h2 { font-size: 18px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px; }
.auth-card p { font-size: 12.5px; line-height: 1.55; margin: 0 0 10px; }
.auth-google { display: block; width: 100%; font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
  background: var(--charcoal); color: var(--cream); border: none; border-radius: 3px; padding: 12px 14px; cursor: pointer; }
.auth-google:hover { background: #2c2c2c; }
.auth-retry { margin-top: 16px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: var(--cream-dark); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--cream-mid); }
.auth-form input { display: block; width: 100%; font: inherit; font-size: 13px; padding: 9px 10px; margin-bottom: 8px;
  border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; }
.auth-form input:focus { outline: none; border-color: var(--charcoal); }
.auth-form button { display: block; width: 100%; font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
  background: var(--cream); color: var(--charcoal); border: none; border-radius: 3px; padding: 11px 14px; cursor: pointer; margin-top: 4px; }
.auth-form button:hover:not(:disabled) { background: var(--cream-mid); }
.auth-form button:disabled, .auth-google:disabled { opacity: .6; cursor: default; }
.auth-links { font-size: 11px; color: var(--cream-dark); margin: 12px 0 0 !important; }
.auth-links a { color: var(--charcoal); }
.auth-msg { font-size: 11.5px; color: var(--green); margin: 10px 0 0 !important; min-height: 1em; }
.auth-msg.err, .auth-err { color: var(--red); font-weight: 600; }
.auth-err { font-size: 11.5px; background: var(--red-light); border: 1px solid var(--red-rule); padding: 8px 10px; margin-bottom: 14px !important; }
.auth-legacy { margin: 22px 0 0 !important; font-size: 10.5px; color: var(--cream-dark); text-align: center; }
.auth-legacy a { color: var(--cream-dark); }
.auth-legacy form { display: flex; gap: 6px; margin-top: 8px; }
.auth-legacy input { flex: 1; font: inherit; font-size: 12px; padding: 7px 9px; border: 1px solid var(--cream-mid); border-radius: 3px; }
.auth-legacy button { font: inherit; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 6px 12px; cursor: pointer;
  background: var(--cream); border: none; border-radius: 3px; }
.admin-body { padding: 18px 28px 26px; }
.admin-note { font-size: 11.5px; color: var(--cream-dark); margin: 0 0 14px; line-height: 1.5; }
.admin-note.warn { color: var(--amber); background: var(--amber-light); border: 1px solid var(--amber-rule); padding: 8px 10px; }
table.admin { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 26px; }
table.admin th { text-align: left; font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--cream-dark);
  padding: 6px 8px; border-bottom: 2px solid var(--charcoal); white-space: nowrap; }
table.admin td { padding: 8px; border-bottom: 1px solid var(--cream-mid); vertical-align: middle; }
table.admin td.who b { display: block; font-weight: 600; }
table.admin td.who span { font-size: 10.5px; color: var(--cream-dark); word-break: break-all; }
table.admin td.muted { color: var(--cream-dark); font-size: 11px; }
table.admin select, table.admin input { font: inherit; font-size: 12px; padding: 5px 7px; border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; max-width: 100%; }
table.admin select:disabled { background: var(--warm-gray); color: var(--cream-dark); }
table.admin .x { font: inherit; font-size: 14px; line-height: 1; background: transparent; border: none; color: var(--cream-dark); cursor: pointer; padding: 2px 6px; }
table.admin .x:hover { color: var(--red); }
table.admin tr.adding td { background: var(--warm-gray); }
table.admin .add { font: inherit; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; padding: 6px 12px; cursor: pointer;
  background: var(--charcoal); color: var(--cream); border: none; border-radius: 3px; }
table.admin .add:hover { background: #2c2c2c; }
table.admin code { font-size: 11px; color: var(--cream-dark); }
.admin-body h3 { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; margin: 0 0 8px; }
@media (max-width: 720px) { .auth-card { margin: 24px auto 0; padding: 26px 22px; } .admin-body { padding: 14px 12px; } }

/* ── PM pages ───────────────────────────────────────────────────────────── */
table.admin .who-name { display: block; width: 100%; margin-bottom: 3px; font-weight: 600; }
table.admin .who em { font-size: 10px; color: var(--cream-dark); font-style: normal; margin-right: 6px; }
table.admin .adm-warn { display: block; font-size: 10px; color: var(--amber); font-style: normal; margin-top: 3px; }
.pmp-ok { color: var(--green); font-weight: 700; }
.pmp-due { color: var(--amber); font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; font-weight: 700; }
.pmp-dim { color: var(--cream-dark); font-weight: 400; }
/* The PM tables align left (the base .ptable rule right-aligns for money columns),
   so a bar starts at the same place on every row whatever the count beside it says. */
table.pmp-table th.left, table.pmp-table td.left { text-align: left; }
table.pmp-table th.center, table.pmp-table td.center { text-align: center; }
.pmp-count { display: inline-block; min-width: 44px; font-variant-numeric: tabular-nums; }
/* The full track shows, so the fill reads as progress rather than a bar of its own length. */
.pmp-prog { display: inline-block; width: 64px; height: 8px; background: #E4DDC6; box-shadow: inset 0 0 0 1px #D2CAAE; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.pmp-prog i { display: block; height: 100%; background: var(--charcoal); }
table.pmp-table tr.pmp-head td { background: var(--cream); padding: 10px 12px 8px; font-size: 11px; border-top: 2px solid var(--charcoal); }
table.pmp-table tr.pmp-head a { text-decoration: none; }
table.pmp-table tr.pmp-head b { font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase; margin-right: 8px; }
table.pmp-table tr.pmp-head span { color: var(--cream-dark); }
table.pmp-table tr.pmp-head .pmp-openlink { float: right; font-size: 10.5px; color: var(--charcoal); }
table.pmp-table tr.pmp-row { cursor: pointer; }
table.pmp-table tr.pmp-row:hover td { background: var(--warm-gray); }
table.pmp-table td, table.pmp-table th { padding: 8px 12px; }
.pmp-page { max-width: 1240px; margin: 0 auto; }
.pmp-hero { background: var(--charcoal); color: var(--cream); padding: 22px 28px 18px; border-radius: 4px; margin-bottom: 18px; }
.pmp-hero h1 { font-size: 22px; letter-spacing: 1px; text-transform: uppercase; margin: 2px 0 4px; }
.pmp-hero p { font-size: 12px; color: var(--cream-mid); margin: 0; }
.pmp-hero p b { color: #fff; }
.pmp-back { display: inline-block; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cream-mid); text-decoration: none; margin-bottom: 6px; }
.pmp-back:hover { color: #fff; }
.pmp-savebar { font-size: 11px; color: var(--cream-dark); margin-top: 10px; min-height: 1em; }
.pmp-savebar.err { color: #E08A8B; font-weight: 600; }
.pmp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.pmpc { display: block; background: #fff; border-top: 4px solid var(--charcoal); box-shadow: 0 1px 4px rgba(28,28,28,.08);
  padding: 16px 18px 14px; text-decoration: none; color: inherit; }
.pmpc:hover { box-shadow: 0 3px 10px rgba(28,28,28,.14); }
.pmpc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.pmpc-meta { font-size: 11px; color: var(--cream-dark); margin-bottom: 12px; }
.pmpc-bar { display: block; width: 100%; margin: 0 0 8px; }
.pmpc-foot { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; gap: 8px; flex-wrap: wrap; }
.pmp-card { background: #fff; border-top: 4px solid var(--charcoal); box-shadow: 0 1px 4px rgba(28,28,28,.08); padding: 18px 24px 20px; margin-bottom: 18px; }
.pmp-card h2 { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--cream-mid); }
.pmp-hint { font-size: 11px; color: var(--cream-dark); margin: 0 0 12px; line-height: 1.5; }
.pmp-ck-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; }
.pmp-ck-group h3 { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; background: var(--cream); padding: 6px 10px; margin: 14px 0 2px; border-radius: 2px; }
/* A line: its name, its state, the day that goes with it, a note. Fixed
   columns, so the states and days line up down the list. */
.pmp-ck { display: grid; grid-template-columns: minmax(0, 1fr) 108px 172px 28px; grid-template-areas: "label sel when note" "memo memo memo memo";
  align-items: center; column-gap: 8px; min-height: 38px; border-bottom: 1px solid var(--warm-gray); padding: 2px 2px 2px 6px; }
.pmp-ck-label { grid-area: label; font-size: 12.5px; padding: 6px 0; min-width: 0; }
.pmp-ck-sel, .pmp-ck-ro { grid-area: sel; }
.pmp-ck-when { grid-area: when; display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 11px; white-space: nowrap; }
.pmp-ck-note-btn { grid-area: note; }
.pmp-ck-note { grid-area: memo; padding: 2px 0 8px; }
.pmp-ck-note[hidden] { display: none; }
.pmp-ck.st-done .pmp-ck-label { color: var(--cream-dark); }
.pmp-ck.na .pmp-ck-label { text-decoration: line-through; color: var(--cream-dark); }
select.pmp-ck-sel { font: inherit; font-size: 11px; font-weight: 600; width: 100%; padding: 4px 4px; border: 1px solid var(--cream-mid); border-radius: 3px;
  background: #fff; color: var(--cream-dark); cursor: pointer; }
select.pmp-ck-sel:focus { outline: none; border-color: var(--charcoal); }
.st-scheduled select.pmp-ck-sel { color: #35566F; background: #EFF4F9; border-color: #C9D7E4; }
.st-started select.pmp-ck-sel { color: var(--amber); background: var(--amber-light); border-color: var(--amber-rule); }
.st-done select.pmp-ck-sel { color: var(--green); background: #EEF2EC; border-color: #CFDCC9; }
.na select.pmp-ck-sel { font-weight: 400; }
.pmp-ck-ro { font-size: 11px; font-weight: 600; color: var(--cream-dark); }
.st-scheduled .pmp-ck-ro, .st-scheduled .pmp-ck-when { color: #35566F; }
.st-started .pmp-ck-ro, .st-started .pmp-ck-when { color: var(--amber); }
.st-done .pmp-ck-ro, .st-done .pmp-ck-when { color: var(--green); }
.pmp-ck.ro .pmp-ck-when { font-weight: 600; }
/* The word says what the day is: Planned, Started or Completed. */
.pmp-ck-when .w { flex: none; width: 64px; font-size: 11px; font-weight: 400; color: var(--cream-dark); }
/* The day is a picker: same look as a stamp, a border on hover; dashed while a plan has no day. */
input.pmp-ck-datepick { font: inherit; font-size: 11px; font-weight: 600; color: inherit; background: transparent; border: 1px solid transparent;
  border-radius: 3px; padding: 2px 4px; width: 108px; min-width: 0; cursor: pointer; }
input.pmp-ck-datepick.empty { border: 1px dashed var(--cream-mid); color: var(--cream-dark); font-weight: 400; }
input.pmp-ck-datepick:hover, input.pmp-ck-datepick:focus { border: 1px solid var(--cream-mid); outline: none; background: #fff; }
input.pmp-ck-datepick::-webkit-calendar-picker-indicator { opacity: .45; }
.pmp-ck-note-btn { font: inherit; font-size: 11px; background: transparent; border: 1px solid transparent; color: var(--cream-dark); border-radius: 3px; padding: 4px 6px; cursor: pointer; min-width: 28px; }
.pmp-ck-note-btn:hover { border-color: var(--cream-mid); color: var(--charcoal); }
.pmp-ck-note-btn.has { color: var(--charcoal); font-weight: 600; }
.pmp-ck-note textarea { display: block; width: 100%; font: inherit; font-size: 12px; padding: 8px 10px;
  border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; resize: vertical; }
.pmp-ck-note textarea:focus { outline: none; border-color: var(--charcoal); }
textarea:disabled, input:disabled { background: var(--warm-gray); color: var(--charcoal); }
/* Under the checklist: the target completion date and the last update. */
.pmp-ck-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px 20px; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 2px solid var(--charcoal); }
.pmp-target { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 400; }
.pmp-target input { font: inherit; font-size: 12px; font-weight: 600; padding: 6px 8px; border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; }
.pmp-target input:focus { outline: none; border-color: var(--charcoal); }
.pmp-target b { font-size: 12.5px; font-weight: 600; }
.pmp-stamp { font-size: 11px; color: var(--cream-dark); margin: 0; }
.pmp-hrow { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; font-size: 11px; padding: 5px 0; border-bottom: 1px solid var(--warm-gray); }
.pmp-hrow span { color: var(--cream-dark); white-space: nowrap; }
.pmp-hrow i { color: var(--cream-dark); font-style: normal; }
/* One column below a laptop's width; on a phone the day goes under its line. */
@media (max-width: 1099px) { .pmp-ck-cols { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .pmp-ck { grid-template-columns: minmax(0, 1fr) 112px 34px; grid-template-areas: "label sel note" "when when when" "memo memo memo"; column-gap: 6px; }
  select.pmp-ck-sel { min-height: 32px; }
  input.pmp-ck-datepick { min-height: 30px; }
  .pmp-ck-when { padding: 0 0 6px; }
  .pmp-ck-when:empty { display: none; }
  .pmp-ck-foot { align-items: flex-start; flex-direction: column; }
  .pmp-card { padding: 14px 14px 16px; }
  .pmp-hero { padding: 16px 16px 14px; }
  .pmp-hero h1 { font-size: 18px; }
  .pmp-hrow { grid-template-columns: 1fr; gap: 2px; }
  #view { padding: 0 12px; }
  table.pmp-table { font-size: 11px; }
}
@media print { .pmp-savebar, .pmp-ck-note-btn, .pmp-back, #ct-form-host { display: none !important; } .pmp-ck-cols { grid-template-columns: 1fr 1fr; } }

/* ── Requests (materials & subcontracts) ────────────────────────────────── */
/* One status label, one button, two text sizes — on the project page, the
   contracts panel and Jason's queue alike. Labels read like the checklist's
   status dropdowns beside them: normal case, coloured by what they mean —
   red overdue, amber waiting on someone, blue under way, green done, grey
   closed without it. Uppercase is for section headings only. */
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; line-height: 1.25; letter-spacing: 0; text-transform: none;
  padding: 3px 8px; border: 1px solid transparent; border-radius: 3px; white-space: nowrap; }
.chip + .chip { margin-left: 6px; }
.tone-red { color: var(--red); background: var(--red-light); border-color: var(--red-rule); }
.tone-amber { color: var(--amber); background: var(--amber-light); border-color: var(--amber-rule); }
.tone-blue { color: #35566F; background: #EFF4F9; border-color: #C9D7E4; }
.tone-green { color: var(--green); background: #EEF2EC; border-color: #CFDCC9; }
.tone-grey { color: var(--cream-dark); background: var(--warm-gray); border-color: var(--cream-mid); }
select.chip-sel { font: inherit; font-size: 11px; font-weight: 600; padding: 3px 4px; cursor: pointer; }
select.chip-sel:focus { outline: none; border-color: var(--charcoal); }
.rq-btn { font: inherit; font-size: 11px; font-weight: 600; line-height: 1.25; letter-spacing: 0; text-transform: none; background: var(--charcoal); color: var(--cream);
  border: 1px solid var(--charcoal); border-radius: 3px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.rq-btn:hover { background: #2c2c2c; }
.rq-btn.rq-quiet { background: #fff; color: var(--charcoal); border-color: var(--cream-mid); }
.rq-btn.rq-quiet:hover { border-color: var(--charcoal); }
.rq-btn.rq-plain { background: transparent; color: var(--cream-dark); border-color: transparent; }
.rq-btn.rq-plain:hover { color: var(--charcoal); }
.rq-btn.armed { background: var(--red); border-color: var(--red); color: #fff; }
.rq { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 4px 10px 10px;
  border-bottom: 1px solid var(--warm-gray); border-left: 3px solid transparent; }
.rq-u-now:not(.rq-closed) { border-left-color: var(--red); }
.rq-main { min-width: 0; font-size: 12.5px; }
.rq-main b { font-weight: 600; }
.rq-code { font-size: 11px; color: var(--cream-dark); }
.rq-guess { font-style: normal; color: var(--amber); font-weight: 600; cursor: help; }
.rq-meta { font-size: 11px; color: var(--cream-dark); margin-top: 3px; }
.rq-urg-now { color: var(--red); font-weight: 600; }
/* How a closed request ended — who, when — above its Reopen. */
.rq-ended { font-size: 11px; color: var(--charcoal); margin-top: 3px; }
.rq-reply { margin-top: 6px; font-size: 11px; background: var(--warm-gray); border-left: 3px solid var(--cream-mid); padding: 5px 8px; }
.rq-reply i { color: var(--cream-dark); font-style: normal; margin-left: 4px; }
.rq-side { flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
/* Jason's note, like Ted's invoice notes: reads as text, a box on hover. */
.rq-note.inv-notes { margin-top: 6px; min-width: 0; font-size: 12px; }
.rq:hover .rq-note, tr.rq-tr:hover .rq-note { border-color: var(--cream-mid); background: #fff; }
.rq-note-by { display: block; font-size: 11px; color: var(--cream-dark); font-style: normal; margin: 1px 0 0 8px; }
.rq-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rq-add input[type="text"] { flex: 1 1 220px; font: inherit; font-size: 12px; padding: 7px 10px; border: 1px solid var(--cream-mid); border-radius: 3px; min-width: 0; background: #fff; }
.rq-add select { font: inherit; font-size: 12px; padding: 6px 8px; border: 1px solid var(--cream-mid); border-radius: 3px; background: #fff; max-width: 100%; }
.rq-add input:focus, .rq-add select:focus { outline: none; border-color: var(--charcoal); }
.rq-kind-fixed { font-size: 11px; color: var(--charcoal); padding: 0 4px; }
.rq-edit input[type="text"] { flex: 1 1 260px; }
.rq-count { display: inline-block; min-width: 22px; padding: 2px 6px; border-radius: 10px; background: var(--charcoal); color: var(--cream); font-weight: 700; font-size: 10.5px; text-decoration: none; text-align: center; }
/* The PM closing a request: the day it happened, then Save. */
.rq-close { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rq-close-day { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--charcoal); }
.rq-close-day input.pmp-ck-datepick { border-color: var(--cream-mid); background: #fff; }
/* Jason's queue: Open, In progress, Escalated, Not needed, Closed — filtered. */
.rq-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 28px 10px; }
.rq-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.rq-filter { font: inherit; font-size: 12px; padding: 6px 10px; border: 1px solid var(--cream-mid); border-radius: 3px; min-width: 280px; background: #fff; }
.rq-filter:focus { outline: none; border-color: var(--charcoal); }
table.rq-table th, table.rq-table td { text-align: left; vertical-align: top; white-space: nowrap; }
table.rq-table td { font-size: 12.5px; }
table.rq-table td.rq-cell { white-space: normal; min-width: 280px; width: 38%; }
table.rq-table td.rq-ended-cell { white-space: normal; font-size: 11px; min-width: 180px; }
table.rq-table td.rq-note-cell { min-width: 220px; }
/* The day a request closed: the Closed list's first column, labelled on phones. */
.rq-day-lbl { display: none; }
.rq-how { margin-left: 4px; }
table.rq-table tr.rq-u-now td:first-child { box-shadow: inset 4px 0 0 var(--red); }
/* Page usage: pages nobody opened in 30 days read grey. */
table.usage-table td.usage-who { white-space: normal; font-size: 11px; }
table.usage-table tr.usage-idle td { color: var(--cream-dark); }
table.usage-table tr.usage-idle td b { font-weight: 400; }
/* Inside a report card the note sits under the table, not pulled up over its last row. */
.report > .section-note { margin: 0; padding: 12px 28px 18px; }
td.buy-pm { white-space: nowrap; }
@media (max-width: 720px) {
  .rq { flex-direction: column; }
  .rq-side { max-width: none; justify-content: flex-start; }
  .rq-bar { padding: 12px 16px 8px; }
  .rq-filter { min-width: 0; flex: 1 1 100%; }
}
@media print { .rq-add, .rq-btn { display: none !important; } }

/* ── Badges, inspection nudges, client email ────────────────────────────── */
.tb-badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 5px; margin-left: 5px; border-radius: 8px;
  background: var(--cream-dark); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: 0; text-align: center; vertical-align: 1px; }
.tb-badge-red { background: var(--red); }
.pmp-loading h2 { color: var(--cream-dark); }
.pmp-nudge { background: #fff; border-top: 4px solid var(--green); box-shadow: 0 1px 4px rgba(28,28,28,.08); padding: 12px 20px 10px; margin-bottom: 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; }
.pmp-nudge b { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--green); margin-right: 4px; }
.pmp-nudge-item { display: inline-flex; align-items: center; gap: 8px; background: var(--warm-gray); border-radius: 3px; padding: 5px 6px 5px 10px; }
.pmp-nudge-item i { font-style: normal; color: var(--cream-dark); font-size: 10.5px; }
.pmp-mail textarea { display: block; width: 100%; font: inherit; font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--cream-mid); border-radius: 3px; resize: vertical; }
.pmp-mail textarea:focus { outline: none; border-color: var(--charcoal); }
.pmp-mail-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; font-size: 11px; }

/* ── Phones ─────────────────────────────────────────────────────────────────
   One pass for every page. The toolbar folds into a Menu button; wide tables
   scroll sideways inside their card instead of squashing; two-column
   layouts stack; inputs are 16px so iOS doesn't zoom into them. */
#nav-btn { display: none; font: inherit; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
  background: transparent; color: var(--cream); border: 1px solid var(--cream-dark); border-radius: 3px; padding: 7px 12px; cursor: pointer; }
@media (max-width: 860px) {
  #toolbar { padding: 8px 12px; gap: 8px 10px; }
  #nav-btn { display: inline-block; margin-left: auto; }
  body.signed-out #nav-btn { display: none; }
  body.nav-open #nav-btn { background: var(--cream); color: var(--charcoal); }
  .tb-links { display: none; flex-basis: 100%; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; gap: 0;
    border-top: 1px solid #3a3a3a; padding: 4px 0 6px; margin-left: 0; }
  /* One column from the top that scrolls when it's taller than the screen
     (fitNav in app.js caps it) — the desktop row's wrap and right alignment
     would push it into a second column, or up out of reach. */
  .tb-links > * { flex-shrink: 0; }
  .tb-health, body.role-pm .tb-user { margin-left: 0; }
  body.role-pm .tb-links a.tb-mine { display: block; }
  .u-initials { display: none; }
  .u-full { display: inline; }
  .tb-menu-label { padding: 10px 6px 3px; }
  .tb-menu a + .tb-menu-label { border-top: none; }
  body.nav-open .tb-links { display: flex; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .tb-links > a, .tb-drop > a { display: block; padding: 12px 6px; border-bottom: 1px solid #2c2c2c; font-size: 12px; }
  .tb-links a.active { border-bottom-color: #2c2c2c; }
  .tb-drop { flex-direction: column; align-items: stretch; }
  .tb-menu, .tb-drop:hover .tb-menu, .tb-user .tb-menu { display: block; position: static; box-shadow: none; border: none;
    background: transparent; padding: 0 0 6px 16px; min-width: 0; left: auto; right: auto; }
  .tb-menu a { padding: 9px 6px; font-size: 11.5px; border-bottom: 1px solid #262626; }
  .um-who { padding: 8px 6px 8px; border-bottom: 1px solid #262626; }
  .tb-health { padding: 8px 0; border-bottom: 1px solid #2c2c2c; flex-wrap: wrap; }
  #toolbar #sync-panel { position: static; flex-basis: 100%; width: auto; max-width: none; margin: 6px 0 4px; box-shadow: none; }
  #toolbar > .tb-links > button, #toolbar > .tb-links > #upload-btn.show { margin: 8px 0 0; width: 100%; padding: 11px 14px; }
}
@media (max-width: 720px) {
  #view { padding: 0 12px; margin-top: 14px; }
  #view.view-wide, #view.view-mid, #view.view-designers { max-width: none; }
  .pmp-ck-note-btn { min-height: 32px; min-width: 34px; }
  /* Wide tables scroll inside their card. */
  .report, .ptable-wrap:not(.map-wrap), .tscroll, #buy-table, .admin-body, .vend-wrap, .prpt, .est-list-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.ptable, table.rtable, table.vend-table, table.buy-table, table.perm-table, table.dsg-table, table.inv-lines, table.admin, table.pmp-table, table.rq-table, table.est-list { min-width: 640px; }
  table.buy-table { min-width: 960px; }
  /* Any other report table wider than a phone scrolls too; the two-column
     code tables inside a project's financial report are narrow and stay put. */
  .report > table, .report > div > table, .ptable-wrap > table { min-width: 640px; }
  /* The per-project permit card and the financial report's code tables are
     narrow and stay put. */
  .report table.pp-table, .pp-card table.pp-table, .report .cols table, .report .col table, .sp-row table { min-width: 0; }
  /* Budget busts: the codes column lists many codes; give it room and let the table scroll. */
  td.busts { min-width: 360px; white-space: normal; }
  /* The permit card's tables keep their columns and one line a row, and
     scroll sideways inside the card. */
  .pp-card table.pp-grid { min-width: 720px; }
  .pp-card .pp-table:not(.pp-grid) { min-width: 760px; }

  table.pmp-table, table.rq-table, table.dsg-table, table.perm-table { min-width: 820px; }
  .rpt-head, .rpt-foot, .est-head, .pp-head, .mlg-top { flex-wrap: wrap; gap: 8px 14px; }
  .rpt-head { padding: 14px 16px 12px; }
  .rpt-head h1 { font-size: 18px; }
  .rpt-dates { text-align: left; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 10px 12px 12px; }
  .strips, .cols { padding-left: 16px; padding-right: 16px; }
  .cols { grid-template-columns: 1fr; gap: 12px; }
  .strip { flex-wrap: wrap; gap: 4px 10px; }
  .strip .s-lbl { min-width: 0; flex-basis: 100%; }
  .aw-po { grid-template-columns: 1fr; gap: 2px; }
  .comp-list { grid-template-columns: 1fr; }
  .est-controls { padding: 12px 14px; gap: 12px 18px; }
  .pp-strip { grid-template-columns: repeat(2, 1fr); }
  .assign-bar, .designer-pick, .dsg-tools, .inv-weekpick, .inv-refresh, .buy-sched, .aw-bar, .bs-roll { flex-wrap: wrap; }
  .assign-bar select, .assign-bar input[list] { max-width: 100%; width: 100%; }
  .empty-state { padding: 36px 16px; }
  #toast { left: 12px; right: 12px; max-width: none; }
  #update-bar { left: 12px; right: 12px; transform: none; flex-wrap: wrap; }
  .pmp-hero h1, .auth-card h2 { font-size: 18px; }
  .pmpc { padding: 14px 14px 12px; }
  .admin-body { padding: 12px 10px; }
  .section-note { margin-left: 0; }
}
@media (max-width: 480px) {
  .tb-logo { height: 20px; }
  .tb-name { font-size: 14px; line-height: 20px; letter-spacing: 2px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* iOS zooms into a field smaller than 16px when it's tapped. The app stops
   that through the viewport on iPhones and iPads (top of app.js), so fields
   keep the sizes of the text around them. The sign-in form is 16px anyway. */
@media (max-width: 1024px) { .auth-form input { font-size: 16px; } }

/* ── The project form's folded cards (client email, history) ────────────── */
.prpt-body .section-note { margin: 0; padding: 12px 28px 18px; }
.prpt-body > table.pmp-table { margin-top: 0; }
details.pmp-card > summary { cursor: pointer; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; list-style: none; }
details.pmp-card > summary::before { content: "▸ "; color: var(--cream-dark); }
details[open].pmp-card > summary::before { content: "▾ "; }
details.pmp-card > summary::-webkit-details-marker { display: none; }
details.pmp-card[open] > summary { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--cream-mid); }

/* ── Contracts & requests on the project form ───────────────────────────── */
/* Contracts due, then the requests, then everything else folded — every
   section under the same heading, the same way the checklist groups are. */
.pmp-contracts h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#ct-form-host .ct-form { margin: 0 0 14px; padding: 12px; background: var(--warm-gray); border-radius: 3px; }
#ct-form-host .ct-form select[name=code] { flex: 1 1 100%; }
.ct-h { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; background: var(--cream); padding: 7px 10px; margin: 14px 0 2px; border-radius: 2px; }
.ct-title { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; color: var(--charcoal); }
.ct-note { font-size: 11px; color: var(--cream-dark); }
details.ct-fold > summary.ct-h { cursor: pointer; list-style: none; }
details.ct-fold > summary::-webkit-details-marker { display: none; }
details.ct-fold > summary .ct-title::before { content: "▸ "; color: var(--cream-dark); }
details.ct-fold[open] > summary .ct-title::before { content: "▾ "; }
.ct-empty { font-size: 11px; color: var(--cream-dark); margin: 8px 10px 4px; }
.ct-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 210px minmax(0, 1fr); grid-template-areas: "name state vendor";
  align-items: center; gap: 4px 12px; padding: 7px 4px 7px 10px; border-bottom: 1px solid var(--warm-gray); font-size: 12.5px; min-height: 38px; }
.ct-due-row { grid-template-columns: minmax(0, 1fr) auto 110px; grid-template-areas: "name state act"; }
.ct-name { grid-area: name; min-width: 0; }
.ct-name b { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.ct-state { grid-area: state; white-space: nowrap; }
.ct-vendor { grid-area: vendor; font-size: 11px; color: var(--charcoal); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-act { grid-area: act; text-align: right; }
.ct-group { font-size: 11px; font-weight: 600; color: var(--cream-dark); padding: 12px 10px 4px; }
@media (max-width: 720px) {
  .ct-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "state vendor"; }
  .ct-due-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name act" "state act"; }
  .ct-vendor { white-space: normal; }
}

/* A link in a report header's right column (PM Pages ⇄ Requests). */
.rpt-dates .rpt-link { display: inline-block; margin-top: 12px; font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
  color: var(--charcoal); text-decoration: none; border: 1px solid var(--cream-dark); border-radius: 3px; padding: 6px 10px; }
.rpt-dates .rpt-link:hover { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }

/* The permits & inspections card on a PM's project form. */
.pmp-permit .pp-card { margin: 0 0 18px; border-top: 4px solid var(--charcoal); }
.pmp-permit .pp-hist tbody tr:nth-child(n+13) { display: none; }
.pmp-permit .pp-hist.pmp-all tbody tr { display: table-row; }
.pmp-permit .pmp-more { display: block; font-size: 11px; color: var(--cream-dark); margin: 6px 22px 12px; cursor: pointer; text-decoration: underline; }
body.role-pm .perm-linkbtn { display: none !important; }
@media print { .pmp-permit .pp-hist tbody tr { display: table-row; } }


/* ── PM pages and requests: the same type on a phone as on a laptop ─────────
   Fields are sized like the text around them (see the iOS note above); what
   changes on a phone is only room: touch-sized controls, Jason's requests as
   stacked cards instead of a table wider than the screen, and the permit
   card's smallest labels brought up to the details size. */
table.rq-table td:first-child { font-weight: 400; }
table.rq-table b { font-weight: 600; }
.pmp-permit .pp-head h2 { font-size: 12px; letter-spacing: 1.5px; }
@media (max-width: 720px) {
  .rq-btn { min-height: 32px; }
  select.chip-sel { min-height: 30px; }
  .rq-add input[type="text"], .rq-add select, .rq-filter { min-height: 34px; }
  /* Jason's queue: one card per request — urgency or how it closed, the job,
     what was asked, the status, the note. */
  .report table.rq-table { min-width: 0; }
  table.rq-table thead { display: none; }
  table.rq-table, table.rq-table tbody, table.rq-table tr, table.rq-table td { display: block; width: auto; }
  table.rq-table tr { padding: 10px 14px; border-bottom: 1px solid var(--warm-gray); }
  table.rq-table td, table.rq-table td:first-child { padding: 2px 0; border: 0; min-width: 0; white-space: normal; text-align: left; }
  table.rq-table tr.rq-u-now { box-shadow: inset 3px 0 0 var(--red); }
  table.rq-table tr.rq-u-now td:first-child { box-shadow: none; }
  table.rq-table td.rq-status { padding-top: 6px; }
  table.rq-table td:empty { display: none; }
  /* Urgency is in the card's details line; its column would say it twice. */
  table.rq-table td.rq-urg-cell { display: none; }
  .rq-day-lbl { display: inline; }
  table.rq-table td.rq-day { font-size: 11px; color: var(--cream-dark); }
  /* The permit card: nothing under 10px, and the permit number on one line. */
  .pp-card .pp-kpi .lbl, .pp-card .pp-sec h3, .pp-card .pp-grid th { font-size: 10px; }
  .pp-card .pp-note, .pp-card .pp-kpi .sub, .pp-card .pp-when, .pp-card .pp-foot { font-size: 11px; }
  .pp-card .perm-res, .pp-card .ps, .pp-card .perm-hist, .pp-card .ins-perm { font-size: 10px; }
  .pp-card .pp-kpi .val { font-size: 16px; }
  .pp-card .pp-kpi .val a { font-size: 13px; white-space: nowrap; }
}

/* ── Dropdowns ───────────────────────────────────────────────────────────────
   Every <select> draws its own chevron, inset from the right edge: the
   browser's arrow sat flush against the border (Michael, 2026-10-09), and
   differently in each browser. The chevron is a background image laid over
   each dropdown's own colours (the checklist states, the status chips), and
   the !important is only on what it needs — many rules set `background:` or
   `padding:` shorthand, which would otherwise wipe the image or let the text
   run under it. */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235b554b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 10px 6px !important;
  padding-right: 28px !important;
}
select::-ms-expand { display: none; }
/* The status chips are small pills: a smaller inset keeps them pill-sized. */
select.chip-sel { background-position: right 7px center !important; background-size: 8px 5px !important; padding-right: 20px !important; }
select:disabled { cursor: default; }
