/* Barclay Project Manager — palette from the Barclay / DKI logo (shared with Scheduler and Consultant Response). */
:root {
  --navy: #153f60; --navy-text: #153f60; --navy-2: #0f304a; --blue: #23699a; --brand-blue: #1b7fc4; --red: #c5212b; --green: #1f7a4a; --amber: #9a6400;
  --bg: #f3f6f9; --surface: #fff; --surface-2: #f7fafc; --panel: #eef3f7; --ink: #1f3242; --muted: #5d7283; --faint: #8799a7;
  --line: #d9e3ea; --line-2: #e9eff3; --sel: #e6f1f9; --hover: #f1f6fa; --focus: #1b7fc4;
  --ok-bg: #e3f2ea; --wait-bg: #fbf0d9; --bad-bg: #fbe5e6; --dim-bg: #edf1f4;
  --radius: 6px; --shadow-pop: 0 8px 28px rgba(15, 48, 74, .18);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; --font-d: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --navy-text: #cfe0ee; --bg: #0f1a23; --surface: #16242f; --surface-2: #1a2b38; --panel: #1d303e; --ink: #e3ecf2; --muted: #9ab0bf; --faint: #74899a;
    --line: #2a3d4c; --line-2: #22333f; --sel: #1b3446; --hover: #1a2c39; --blue: #5aa9dc; --green: #4fbf83; --amber: #e0a842; --red: #ef5b62;
    --ok-bg: #173527; --wait-bg: #3a2e14; --bad-bg: #3c1d21; --dim-bg: #233441; color-scheme: dark;
  }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13.5px/1.45 var(--font); color: var(--ink); background: var(--bg); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--font-d); color: var(--navy-text); margin: 0; }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] h3 { color: #cfe0ee; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }
kbd { font: 11px var(--font); padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--surface-2); }
.muted { color: var(--muted); } .small { font-size: 12px; } .r, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; } .ok { color: var(--green); } .wait { color: var(--amber); } .bad { color: var(--red); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 4px; z-index: 50; background: var(--surface); padding: 6px 10px; }

/* ── buttons ─────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; border-radius: var(--radius); padding: 5px 10px; cursor: pointer; white-space: nowrap; min-height: 30px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--blue); color: #fff; } .btn.primary:hover { background: var(--navy); }
.btn.outline { border-color: var(--line); background: var(--surface); } .btn.outline:hover { border-color: #b5c7d5; }
.btn.danger { background: var(--red); color: #fff; } .btn.danger-text { color: var(--red); }
.btn.ghost { color: inherit; } .btn:disabled { opacity: .45; cursor: default; }
.btn.sm { min-height: 26px; padding: 2px 8px; font-size: 12.5px; }
.icon-btn { border: 0; background: transparent; padding: 4px; border-radius: 5px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ── top bar ─────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 14px; padding: 7px 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 4; }
.topbar .logo { height: 34px; display: block; }
.topbar .vsep { width: 1px; height: 28px; background: var(--line); }
.jobpick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 10px; min-width: 320px; max-width: 460px; background: var(--surface); cursor: pointer; text-align: left; }
.jobpick b { color: var(--navy-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobpick .muted { white-space: nowrap; }
.jobpick .i { margin-left: auto; color: var(--muted); }
.jobmeta { color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; flex: 1; }
.topbar .right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.save-state { font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.save-state.err { color: var(--red); font-weight: 600; }

/* ── layout ──────────────────────────────── */
.layout { display: flex; min-height: 0; min-width: 0; max-width: 100vw; }   /* never wider than the window: wide content (the schedule chart) scrolls inside its own pane */
.rail { width: 64px; background: var(--navy); display: flex; flex-direction: column; padding-top: 6px; flex: none; }
.rail a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; color: #b9d2e6; text-decoration: none; font-size: 10.5px; position: relative; }
.rail a:hover { color: #fff; background: #ffffff14; }
.rail a.on { color: #fff; background: #ffffff1f; box-shadow: inset 3px 0 0 var(--red); }
.rail a .i { width: 20px; height: 20px; }
.rail a .badge { position: absolute; top: 4px; right: 9px; background: var(--amber); color: #fff; font-size: 9.5px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.rail a .badge.bad { background: var(--red); }
.rail .rsep { height: 1px; background: #ffffff22; margin: 6px 10px; }
.rail[aria-disabled="true"] a.jobonly { opacity: .35; pointer-events: none; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.statusbar { display: flex; justify-content: space-between; gap: 12px; padding: 3px 12px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface-2); }
.statusbar a { color: var(--blue); }

/* ── page (full-width screens) ───────────── */
.page { flex: 1; overflow: auto; padding: 18px 24px 40px; }
.page-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); }
.page-head .tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card > h2, .card-h { font-size: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.card-b { padding: 12px 14px; }
.cards { display: grid; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile small { display: block; font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tile b { display: block; font: 600 19px var(--font-d); color: var(--navy-text); margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.tile b.ok { color: var(--green); } .tile b.wait { color: var(--amber); } .tile b.bad { color: var(--red); }
:root[data-theme="dark"] .tile b { color: #cfe0ee; }

/* ── grid tables ─────────────────────────── */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { position: sticky; top: 0; z-index: 1; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tbody tr { cursor: default; }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid tr.sel td, table.grid tr.sel:hover td { background: var(--sel); }
table.grid tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
table.grid tr.grp td { background: var(--panel); font-weight: 600; color: var(--navy-text); }
table.grid tr.tot td { font-weight: 600; border-top: 1px solid var(--line); background: var(--surface-2); }
table.grid td.title { font-weight: 600; }
table.grid td .sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
table.grid.clickable tbody tr { cursor: pointer; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--green); } .pill.wait { background: var(--wait-bg); color: var(--amber); }
.pill.bad { background: var(--bad-bg); color: var(--red); } .pill.dim { background: var(--dim-bg); color: var(--muted); }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.ok { color: var(--green); } .dot.wait { color: var(--amber); } .dot.bad { color: var(--red); } .dot.dim { color: var(--muted); }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--navy); }

/* ── ledger (list + detail) ──────────────── */
.ledger { flex: 1; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(460px, 44%); min-height: 0; }
.ledger.wide-detail { grid-template-columns: minmax(280px, 340px) 1fr; }
.lg-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.lg-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.lg-head h1 { font-size: 17px; margin-right: auto; }
.chips { display: flex; gap: 6px; padding: 2px 12px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--ink); }
.chip b { font-weight: 600; color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; } .chip.on b { color: #cfe0ee; }
.lg-scroll { flex: 1; overflow: auto; }
.lg-table tbody tr { cursor: pointer; }
.lg-table tbody tr:focus { outline: none; }
.lg-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.lg-foot { padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 22px; flex-wrap: wrap; font-size: 12.5px; }
.lg-foot b { font-variant-numeric: tabular-nums; }
.lg-detail { overflow: auto; background: var(--surface-2); min-width: 0; }
.lg-detail:focus { outline: none; }
.empty-detail { padding: 60px 30px; text-align: center; color: var(--muted); }
.dt-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px 10px; }
.dt-kicker { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dt-title { font: 600 18px var(--font-d); color: var(--navy-text); margin: 2px 0 8px; overflow-wrap: anywhere; }
:root[data-theme="dark"] .dt-title { color: #cfe0ee; }
.dt-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dt-actions .spacer { flex: 1; }
.dt-body { padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.dt-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.dt-sec > h3 { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); padding: 9px 12px 0; font-family: var(--font); display: flex; align-items: center; gap: 8px; }
.dt-sec > h3 .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
.dt-sec .grid2 { padding: 10px 12px 12px; }
.banner { border-radius: 6px; padding: 8px 12px; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; }
.banner.wait { background: var(--wait-bg); color: var(--ink); } .banner.ok { background: var(--ok-bg); } .banner.bad { background: var(--bad-bg); } .banner.info { background: var(--sel); }
.banner .i { margin-top: 1px; }
.revtabs { display: flex; gap: 4px; flex-wrap: wrap; }
.revtabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 1px 8px; font-size: 12px; cursor: pointer; }
.revtabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── form fields ─────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field > span em { font-weight: 400; font-style: normal; color: var(--faint); }
.field input, .field select, .field textarea, .cell-in { border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: var(--surface); min-height: 32px; width: 100%; }
.field textarea { resize: vertical; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus, .cell-in:focus { border-color: var(--focus); outline: 1px solid var(--focus); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field .ro { padding: 6px 0; min-height: 32px; }
.field.has-pfx input { padding-left: 20px; } .field .pfx { position: absolute; left: 8px; bottom: 7px; font-style: normal; color: var(--muted); }
.field.has-sfx input { padding-right: 34px; } .field .sfx { position: absolute; right: 8px; bottom: 7px; font-style: normal; color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; min-height: 32px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
input.r { text-align: right; font-variant-numeric: tabular-nums; }

/* editable line grids */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); text-align: left; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lines td { padding: 3px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lines .cell-in { min-height: 30px; padding: 4px 6px; border-color: transparent; background: transparent; }
.lines .cell-in:hover { border-color: var(--line); background: var(--surface); }
.lines textarea.cell-in { resize: none; overflow: hidden; display: block; }
.lines td.amt { padding-top: 9px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines tr.sec td { background: var(--panel); }
.lines tr.sec .cell-in { font-weight: 600; color: var(--navy-text); }
.lines .row-tools { opacity: 0; display: flex; } .lines tr:hover .row-tools, .lines tr:focus-within .row-tools { opacity: 1; }
/* estimate, CCO and draw lines: item column capped at about a fifth of the table; figures centred under their headings */
:is(#estLines, #ccoLines, #drawLines) th.item { width: 21%; min-width: 200px; }
:is(#estLines, #ccoLines, #drawLines) th:not(.item) { text-align: center; }
:is(#estLines, #ccoLines, #drawLines) td.amt { text-align: center; }
:is(#estLines, #ccoLines, #drawLines) td > input.cell-in.r, :is(#estLines, #ccoLines, #drawLines) td > select { text-align: center; display: block; margin: 0 auto; }
/* estimate, CCO and draw lines: every column sizes to what is in it; the table no longer stretches to fill the pane */
:is(#estLines, #ccoLines, #drawLines) { width: auto; }
:is(#estLines, #ccoLines, #drawLines) th.item { width: auto; min-width: 0; }
:is(#estLines, #ccoLines, #drawLines) th, :is(#estLines, #ccoLines, #drawLines) td.amt { white-space: nowrap; }
:is(#estLines, #ccoLines, #drawLines) td > input.cell-in.r, :is(#estLines, #ccoLines, #drawLines) td > select.cell-in { width: auto; min-width: 5ch; }
:is(#estLines, #ccoLines, #drawLines) textarea.cell-in { width: 300px; }
@supports (field-sizing: content) {
  :is(#estLines, #ccoLines, #drawLines) td > input.cell-in.r, :is(#estLines, #ccoLines, #drawLines) td > select.cell-in { field-sizing: content; }
  :is(#estLines, #ccoLines, #drawLines) textarea.cell-in { width: auto; min-width: 180px; max-width: 360px; }
}
#drawLines th:first-child { text-align: left; }
#drawLines .itm { min-width: 180px; max-width: 360px; white-space: normal; }
#drawLines td > input.cell-in.r { display: inline-block; }
#drawLines td:has(> input.cell-in.r) { text-align: center; white-space: nowrap; }
/* totals as footer rows of the lines table, so each figure sits under its column */
.lines tfoot td { border-bottom: 0; padding-top: 3px; padding-bottom: 3px; }
.lines tfoot td.amt { padding-top: 3px; }
.lines tfoot td.tot-label { text-align: right; padding-right: 14px; white-space: nowrap; }
.lines tfoot tr.first td { border-top: 2px solid var(--line); padding-top: 8px; }
.lines tfoot tr.big td { font-weight: 700; font-size: 14px; color: var(--navy-text); border-top: 1px solid var(--line); padding-top: 6px; }
.lines tfoot tr.muted td { color: var(--muted); font-size: 12px; }
.lines tfoot tr.gmrow em { display: block; font-size: 12px; }
table.grid th.c, table.grid td.c { text-align: center; font-variant-numeric: tabular-nums; }
.lines-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.totals { min-width: 260px; margin-left: auto; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.totals td { padding: 3px 12px; } .totals td:last-child { text-align: right; }
.totals tr.big td { font-weight: 700; font-size: 14px; border-top: 1px solid var(--line); padding-top: 6px; color: var(--navy-text); }
.totals .muted td { color: var(--muted); font-size: 12px; }

/* ── job overview ────────────────────────── */
.moneybar { display: flex; height: 26px; border-radius: 5px; overflow: hidden; margin: 10px 0 10px; background: var(--line-2); font-size: 11px; font-weight: 600; color: #fff; }
.moneybar div { display: flex; align-items: center; padding-left: 8px; white-space: nowrap; overflow: hidden; min-width: 0; }
.money-legend { display: flex; gap: 28px; flex-wrap: wrap; font-size: 12px; }
.money-legend b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.attn { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.attn:last-child { border-bottom: 0; }
.attn .acts { margin-top: 6px; display: flex; gap: 6px; }
.cov { padding: 8px 14px; } .cov .bar { margin: 5px 0 2px; }
.activity { list-style: none; margin: 0; padding: 0; } .activity li { padding: 6px 14px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; display: flex; gap: 10px; }
.activity li span:first-child { color: var(--muted); white-space: nowrap; min-width: 120px; }

/* ── jobs list ───────────────────────────── */
.searchbox { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 8px; background: var(--surface); min-width: 260px; }
.searchbox input { border: 0; outline: 0; background: transparent; flex: 1; min-height: 26px; }
.welcome { max-width: 560px; margin: 60px auto; text-align: center; }
.welcome h1 { font-size: 24px; margin-bottom: 8px; }
.welcome p { color: var(--muted); }
.welcome img { height: 70px; margin-bottom: 14px; }

/* ── files ───────────────────────────────── */
.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); margin: 10px 12px; }
.dropzone.over { border-color: var(--blue); background: var(--sel); color: var(--ink); }
body.dragging::after { content: "Drop files to attach them to this job"; position: fixed; inset: 0; background: #153f60cc; color: #fff; display: grid; place-items: center; font: 600 20px var(--font-d); z-index: 90; pointer-events: none; }

/* ── dialogs, menus, toasts ──────────────── */
dialog.dlg { border: 0; border-radius: 10px; padding: 0; width: min(480px, 92vw); box-shadow: var(--shadow-pop); background: var(--surface); color: var(--ink); }
dialog.dlg.wide { width: min(760px, 94vw); }
dialog.dlg::backdrop { background: #0f304a66; }
dialog.dlg h2 { font-size: 17px; padding: 16px 20px 0; }
.dlg-body { padding: 10px 20px 4px; max-height: 70vh; overflow: auto; }
.dlg-body p { margin: 0 0 10px; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.popmenu button span { white-space: normal; }
.popmenu { max-width: 460px; position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 4px; min-width: 220px; max-height: 70vh; overflow: auto; }
.popmenu button { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 5px; cursor: pointer; }
.popmenu button:hover, .popmenu button:focus { background: var(--hover); outline: none; }
.popmenu button.danger { color: var(--red); } .popmenu button kbd { margin-left: auto; }
.popmenu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.popmenu .mlabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 6px 10px 2px; }
#toasts { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 95; }
.toast { background: #173b55; color: #fff; padding: 8px 14px; border-radius: 6px; box-shadow: var(--shadow-pop); display: flex; gap: 12px; align-items: center; }
.toast.err { background: var(--red); }
.toast .btn { color: #fff; border-color: #ffffff55; }
.jobsearch-list { max-height: 50vh; overflow: auto; margin: 8px -8px 0; }
.jobsearch-list button { display: flex; width: 100%; gap: 10px; border: 0; background: transparent; padding: 8px; border-radius: 5px; text-align: left; cursor: pointer; }
.jobsearch-list button:hover, .jobsearch-list button.on { background: var(--sel); }
.jobsearch-list b { color: var(--navy-text); }

/* ── segmented tabs (Estimate / Subtrade review) ── */
.segtabs { display: inline-flex; background: var(--panel); border-radius: 6px; padding: 3px; gap: 2px; }
.segtabs button { border: 0; background: transparent; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.segtabs button.on { background: var(--surface); color: var(--navy-text); font-weight: 600; box-shadow: 0 1px 2px #0002; }
.segtabs button b { font-weight: 600; color: var(--muted); margin-left: 3px; }

/* ── subtrade review ── */
.subsheet > h3 { padding: 8px 10px 0; }
.subsheet .sheet-name { font: 600 14px var(--font-d); color: var(--navy-text); text-transform: none; letter-spacing: 0; max-width: 320px; }
.subtable th.sub-col { min-width: 120px; vertical-align: bottom; }
.subtable th.sub-col .cell-in { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 12.5px; }
.subtable th.sub-col .check { min-height: 22px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.subtable .awarded { background: color-mix(in srgb, var(--green) 9%, transparent); }
.subtable td.low .cell-in, .subtable td.low b { color: var(--green); font-weight: 700; }
.subtable tr.parent td { background: var(--surface-2); }
.subtable tr.child td:first-child { padding-left: 22px; }
.subtable .sub-title { display: flex; flex-direction: column; }
.subtable .sub-title .small { padding-left: 7px; }
.subtable tfoot td { border-top: 1px solid var(--line); }

/* Text boxes grow with their text natively (Edge/Chrome) — no script measuring, so big tables open instantly. */
@supports (field-sizing: content) {
  .field textarea, textarea.cell-in { field-sizing: content; max-height: 420px; }
  .field textarea { min-height: 54px; }
  .field textarea[rows="1"] { min-height: 32px; }
  textarea.cell-in { min-height: 30px; }
}

/* ── paste from Excel preview ── */
.paste-opts { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.paste-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.paste-table th { padding: 4px; background: var(--panel); }
.paste-table th select { width: 100%; min-width: 110px; font-size: 12px; padding: 3px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.paste-table td { padding: 4px 8px; font-size: 12px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.paste-table td.ign { color: var(--faint); text-decoration: line-through; }
.paste-table tr.is-head td { color: var(--faint); font-style: italic; text-decoration: none; }

/* ── follow-ups ── */
.lvl { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.lvl.bad { background: var(--red); } .lvl.wait { background: var(--amber); } .lvl.ok { background: var(--green); }
table.follow td .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
table.follow tbody tr { cursor: pointer; }

/* ── schedule-linked billing ── */
dialog.dlg.xwide { width: min(1100px, 96vw); }
.sched-hint { display: block; font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; }
.sched-hint.diff { color: var(--blue); font-weight: 600; }
.sched-hint.ahead { color: var(--red); font-weight: 600; }
.bl-table td .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.bl-table select.cell-in { min-width: 140px; border-color: var(--line); background: var(--surface); }

/* ── estimate sub-lines ── */
.parts-tog { border: 0; background: none; color: var(--blue); font-size: 11.5px; padding: 0 7px 2px; cursor: pointer; }
.parts-tog:hover { text-decoration: underline; }
.lines tr.part td { background: var(--surface-2); padding-top: 1px; padding-bottom: 1px; }
.lines tr.part td:first-child { padding-left: 22px; border-left: 3px solid var(--line); }
.lines tr.part .cell-in { min-height: 26px; font-size: 12.5px; }

/* ── status dropdown in a detail header ── */
.status-pick { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 0 0 10px; background: var(--surface); }
.status-pick span { font-size: 12px; color: var(--muted); }
.status-pick select { border: 0; background: transparent; font-weight: 600; padding: 5px 8px; min-height: 30px; cursor: pointer; }
.status-pick.st-Accepted { border-color: var(--green); } .status-pick.st-Accepted select { color: var(--green); }
.status-pick.st-Submitted { border-color: var(--amber); } .status-pick.st-Submitted select { color: var(--amber); }
.status-pick.st-Declined { border-color: var(--red); } .status-pick.st-Declined select { color: var(--red); }
.status-pick:is(.st-Approved, .st-Answered) { border-color: var(--green); } .status-pick:is(.st-Approved, .st-Answered) select { color: var(--green); }
.status-pick.st-Issued { border-color: var(--amber); } .status-pick.st-Issued select { color: var(--amber); }
.status-pick:is(.st-Void, .st-Closed) select { color: var(--muted); }
.status-pick select option { color: var(--ink); background: var(--surface); }

/* sortable table headings */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable.sorted { color: var(--navy-text); }

/* ── money line: before GST · incl. GST · gross margin ── */
.mline { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-size: 12.5px; }
.mline b { font-variant-numeric: tabular-nums; }
.mline em { font-style: normal; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mline .ml-label { font-weight: 600; color: var(--navy-text); }
.mline .gm { color: var(--green); } .mline .gm.bad { color: var(--red); }
.dt-money { margin: -2px 0 8px; padding: 6px 10px; background: var(--panel); border-radius: 6px; }
.lg-foot .mline + .mline { padding-left: 16px; border-left: 1px solid var(--line); }
.money-sticky { position: sticky; top: -18px; z-index: 3; margin: -18px -24px 14px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; box-shadow: 0 2px 6px #153f6012; }
:root[data-theme="dark"] .mline .ml-label { color: #cfe0ee; }

/* ── light / dark toggle ─────────────────── */
.theme-btn .t-sun { display: none; }
:root[data-theme="dark"] .theme-btn .t-sun { display: block; }
:root[data-theme="dark"] .theme-btn .t-moon { display: none; }
:root[data-theme="dark"] .topbar .logo { background: #fff; border-radius: 5px; padding: 2px 6px; }

/* ── jobs list: estimate filter + fold-out estimates ── */
.jl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 10px; }
.jl-sep { width: 1px; height: 20px; background: var(--line); }
#jfold .i { transform: rotate(-90deg); transition: transform .15s; } #jfold.open .i { transform: none; }
.jl-fold { border: 0; background: transparent; padding: 2px; margin: 0 4px 0 -4px; border-radius: 4px; cursor: pointer; color: var(--muted); vertical-align: middle; display: inline-grid; place-items: center; }
.jl-fold:hover { background: var(--hover); color: var(--ink); }
.jl-fold .i { width: 15px; height: 15px; transform: rotate(-90deg); transition: transform .15s; }
.jl-fold[aria-expanded="true"] .i { transform: none; }
.jl-fold-sp { display: inline-block; width: 23px; }
table.grid tr.jl-open td { border-bottom-color: transparent; }
table.grid tr.jl-sub > td { background: var(--surface-2); padding-top: 2px; padding-bottom: 10px; cursor: default; }
.jl-ests { border-collapse: collapse; width: auto; min-width: 560px; font-size: 12.5px; }
.jl-ests th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; padding: 4px 14px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.jl-ests th.r, .jl-ests td.r { text-align: right; }
.jl-ests td { padding: 5px 14px 5px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.jl-ests tbody tr { cursor: pointer; } .jl-ests tbody tr:hover td { color: var(--blue); }

/* ── Job details: labelled panels, label beside the field; side by side when wide, stacked when narrow ── */
.jd { --jd-label: 128px; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; max-width: 1600px; }
.jd-sec { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; background: var(--surface); display: grid; gap: 8px; min-width: 0; }
.jd-sec h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 4px; padding-bottom: 7px; border-bottom: 1px solid var(--line-2); font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .5px; color: var(--navy-text); }
.jd-sec h4 .i { width: 15px; height: 15px; color: var(--blue); }
.jd-sec > .field { display: grid; grid-template-columns: var(--jd-label) minmax(0, 1fr); align-items: center; gap: 10px; }
.jd-sec > .field > span { font-weight: 500; font-size: 12.5px; }
.jd-sec > .field.has-pfx .pfx { left: calc(var(--jd-label) + 18px); }
.jd-sec.jd-stack > .field { display: flex; }
.jd-sec.jd-stack > .field > span { display: none; }
.jd-sec #covTbl { width: 100%; }
.jd-note { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ── start-up: online / Data folder chooser, sign-in ── */
.mode-pick { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.mode-card { width: 250px; display: grid; justify-items: center; gap: 6px; padding: 18px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: center; color: var(--ink); }
.mode-card:hover { border-color: var(--blue); background: var(--hover); }
.mode-card .i { width: 26px; height: 26px; color: var(--blue); }
.mode-card b { font-size: 15px; color: var(--navy-text); }
.mode-card span { font-size: 12.5px; color: var(--muted); }
.signin { display: grid; gap: 10px; width: 300px; margin: 14px auto 8px; text-align: left; }
.signin .btn { justify-content: center; }
.signin #si-err { color: var(--red); margin: 0; }
.signin #si-err:empty { display: none; }
