/* Layout idea: a working ledger. Quote lines on the left, a sticky running total on the right. */
:root {
  --bg: #f1f4f1; --surface: #ffffff; --ink: #16231e; --muted: #5a6a63; --line: #d5ddd8;
  --accent: #1c6b57; --accent-soft: #e0efe9; --on-accent: #ffffff;
  --warn: #8f5500; --warn-soft: #fbeed3;
  --eq: #2f5d8c; --eq-soft: #e2ecf7; --tp: #76498d; --tp-soft: #f0e5f6;
  --font-display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613; --surface: #17211d; --ink: #e5eeea; --muted: #9aaea6; --line: #2a3933;
    --accent: #63c7a8; --accent-soft: #1c3a31; --on-accent: #0c1512;
    --warn: #f0b757; --warn-soft: #3a2b0f;
    --eq: #92b8e6; --eq-soft: #1b2a3c; --tp: #cfa8e2; --tp-soft: #2f2138;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1613; --surface: #17211d; --ink: #e5eeea; --muted: #9aaea6; --line: #2a3933;
  --accent: #63c7a8; --accent-soft: #1c3a31; --on-accent: #0c1512;
  --warn: #f0b757; --warn-soft: #3a2b0f;
  --eq: #92b8e6; --eq-soft: #1b2a3c; --tp: #cfa8e2; --tp-soft: #2f2138;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font-body); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 { font-size: 20px; line-height: 1.2; }
h2 { font-size: 14px; font-family: var(--font-body); font-weight: 600; }
h3 { font-size: 12px; font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 9px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--font-display); font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand .tag { font: 500 11px var(--font-body); color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 99px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.top nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.top nav a:hover { color: var(--ink); background: var(--bg); }
.top nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

#view { padding: 20px 24px 48px; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }

button, .btn, select, input { font: inherit; color: inherit; }
button, .btn { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-block; font-weight: 500; }
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover:not(:disabled), .btn.primary:hover { color: var(--on-accent); filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.icon { padding: 2px 8px; color: var(--muted); line-height: 1.3; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 500; }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0; }
input:disabled, select:disabled { opacity: .7; }
input[readonly] { background: var(--bg); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: span 2; }
.field.tpl { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; }
.field label, .addsec label { font-size: 12px; font-weight: 600; color: var(--muted); }
.hint, .cap { font-size: 12px; color: var(--muted); }
.cap { display: block; }
.warn { color: var(--warn); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row select { flex: 1 1 220px; }

.confirm { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 10px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

.sec { padding: 0; overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stage { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.sec-title { flex: 1 1 240px; font-weight: 600; border-color: transparent; padding-left: 4px; }
.sec-title:hover:not(:disabled) { border-color: var(--line); }
.sec-sub { font-weight: 600; font-variant-numeric: tabular-nums; }
.sec-tools { display: flex; gap: 4px; }
.sec-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg); }

table { border-collapse: collapse; width: 100%; }
th { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
.lines { min-width: 700px; }
.lines th, .lines td { padding: 7px 8px; vertical-align: top; }
.lines th:first-child, .lines td:first-child { padding-left: 14px; }
.lines tbody tr + tr td { border-top: 1px solid var(--line); }
.lines td.num { padding-top: 12px; font-weight: 600; }
.lines .empty { color: var(--muted); padding: 14px; }
.pick { display: flex; gap: 6px; }
.pick select { flex: 1 1 0; width: 100%; }
.days { margin-top: 5px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.days input { width: 58px; padding: 3px 6px; }
.days input.cost { width: 84px; }
.qty { white-space: nowrap; }
.qty input { width: 72px; text-align: right; }
.unit { font-size: 12px; color: var(--muted); margin-left: 4px; }
.rate input { width: 92px; text-align: right; }
.rate .sell { display: block; text-align: right; width: 92px; padding: 5px 8px; font-variant-numeric: tabular-nums; }
.rate .cap { margin-top: 3px; }

.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.chip-fee { color: var(--accent); background: var(--accent-soft); }
.chip-eq { color: var(--eq); background: var(--eq-soft); }
.chip-tp { color: var(--tp); background: var(--tp-soft); }

.addsec { display: flex; flex-direction: column; gap: 4px; }

.summary { position: sticky; top: 16px; }
.sum-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; }
.pill { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; border: 1px solid currentColor; }
.pill-draft { color: var(--muted); }
.pill-sent { color: var(--eq); background: var(--eq-soft); }
.pill-accepted { color: var(--accent); background: var(--accent-soft); }
.total { display: flex; flex-direction: column; margin: 12px 0 8px; }
.total span { font-size: 12px; font-weight: 600; color: var(--muted); }
.total strong { font: 600 30px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.mini td, .mini th { padding: 5px 0; vertical-align: top; }
.mini tbody tr + tr td { border-top: 1px solid var(--line); }
.mini td.num { font-weight: 600; padding-left: 8px; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.actions .btn { text-align: center; }
.note { font-size: 12px; color: var(--muted); }
.note.ok { color: var(--accent); }

.est-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; max-width: 860px; width: 100%; margin: 0 auto; }
.check { display: flex; gap: 6px; align-items: center; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 40px clamp(16px, 5vw, 48px); max-width: 860px; width: 100%; margin: 0 auto; }
.est-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.est-kind { font-size: 20px; color: var(--muted); text-align: right; margin-bottom: 8px; }
.est-meta { width: auto; min-width: 250px; }
.est-meta th, .est-meta td { padding: 5px 10px; background: var(--bg); border-bottom: 2px solid var(--surface); font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.est-meta td { text-align: right; font-weight: 600; }
.est-for { margin: 20px 0 16px; }
.sheet h1 { font-size: 24px; margin-bottom: 4px; }
.sheet h2 { font-size: 15px; margin: 22px 0 8px; }
.est-lines { min-width: 520px; }
.est-lines th, .est-lines td { padding: 7px 6px; }
.est-lines thead th { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 12px; }
.est-lines tbody tr:last-child td { border-bottom: 1px solid var(--ink); }
.est-lines tfoot td { padding-top: 10px; }
.est-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 24px; margin: 28px 0 20px; }
.est-total strong { font-size: 17px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 6px 0 6px 24px; font-variant-numeric: tabular-nums; }
.est-terms { font-size: 12px; color: var(--muted); max-width: 65ch; }

.blank { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: 560px; }
.jobhead { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: flex-end; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 0; }
.tiles dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.tiles dd { margin: 0; font: 600 20px var(--font-display); font-variant-numeric: tabular-nums; }
.job { min-width: 860px; }
.job th, .job td { padding: 7px 8px; vertical-align: top; }
.stage-row td { border-top: 1px solid var(--line); background: var(--bg); }
.budget-row td { color: var(--muted); font-size: 13px; }
.budget-row td:first-child { padding-left: 20px; color: var(--ink); }
.bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--line); vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.job + .note, .card > .note { margin-top: 12px; }

.lib th, .lib td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lib th .cap { text-transform: none; letter-spacing: 0; font-weight: 400; }
.card > h1 + .muted { margin: 2px 0 12px; }
.card > h1 { margin-bottom: 4px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 8px; }
.cols h2 { margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
}
@media (max-width: 720px) {
  #view, .top { padding-left: 16px; padding-right: 16px; }
  .head { grid-template-columns: minmax(0, 1fr); }
  .field.wide { grid-column: auto; }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  button, .btn, .top nav a { transition: color .12s, border-color .12s, background-color .12s; }
}

/* ---- Additions for the full app ---- */
a { color: var(--accent); }
.brand { text-decoration: none; color: var(--ink); gap: 12px; flex-wrap: nowrap; }
.logo { display: block; }
.signin-logo { margin-bottom: 8px; }
/* The logo is black line art: turn it light on the dark theme. */
:root[data-theme="dark"] .logo { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { filter: invert(1); } }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.pagehead { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.pagehead h1 { font-size: 22px; }
.back { font-size: 13px; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); text-decoration: none; padding: 6px 14px; border-radius: 6px; font-weight: 500; border: 1px solid transparent; }
.tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.card > h2 { font: 600 16px var(--font-display); margin-bottom: 4px; }
.card > h2 + .muted { margin-bottom: 12px; }
.card h3 { margin-top: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flash { border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid; }
.flash-error { background: var(--warn-soft); border-color: var(--warn); }
.flash-ok { background: var(--accent-soft); border-color: var(--accent); }

.list th, .list td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tbody tr:hover { background: var(--bg); }
.list { min-width: 760px; }
.list a { text-decoration: none; }
.empty { color: var(--muted); padding: 14px 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 10px; }
.filters button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filters .check { margin-left: auto; color: var(--muted); }
.card.tiles { padding: 14px 16px; }
.newquote { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.newquote .wide { grid-column: 1 / -1; }

.pill-declined, .pill-lapsed, .pill-superseded { color: var(--muted); background: var(--bg); }
.savestate { font-size: 12px; color: var(--muted); min-height: 18px; margin-top: 8px; }
.actions input { width: 100%; }
.actions .row > button { flex: 1; }
button.danger { background: var(--warn); border-color: var(--warn); color: var(--on-accent); }
button.danger-link { color: var(--warn); align-self: flex-start; }
.actions .confirm { flex-direction: column; align-items: stretch; }

.signin { max-width: 420px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.signin h1 { font-size: 28px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack button { text-align: left; }

.admin input, .admin select, .admin textarea { width: 100%; min-width: 110px; }
.admin input.short { min-width: 70px; width: 70px; }
.admin input[type="checkbox"] { width: auto; min-width: 0; }
textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; resize: vertical; }
.rateform { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.rategrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 16px; margin-bottom: 14px; }
.rateform input, .rateform select, .rategrid input { width: 100%; }
.card > .primary + .note { margin-top: 10px; }
@media (max-width: 720px) { .newquote { grid-template-columns: minmax(0, 1fr); } .filters .check { margin-left: 0; } }

/* ---- Timesheets and job tracking ---- */
:root { --crit: #b42318; --crit-soft: #fde7e5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --crit: #ff8a7f; --crit-soft: #3c1a17; } }
:root[data-theme="dark"] { --crit: #ff8a7f; --crit-soft: #3c1a17; }
.small { font-size: 12px; }
.ts-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ts-top h1 { font-size: 22px; }
.ts-top-right { align-items: center; gap: 12px; }
.ts-top .savestate { margin: 0; min-height: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 16px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.ts-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.track { padding: 9px 18px; font-size: 15px; }
.datenav { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.datenav .navbtn { border: 0; background: none; padding: 8px 14px; text-decoration: none; color: var(--ink); font-size: 16px; }
.datenav .navbtn:hover { color: var(--accent); }
.datenav .navlabel { padding: 0 10px; min-width: 200px; text-align: center; }
.today-link { font-size: 14px; }
.ts { padding: 0; overflow: hidden; }
.timesheet { min-width: 980px; }
.timesheet th, .timesheet td { padding: 10px 6px; vertical-align: middle; }
.timesheet th:first-child, .timesheet td:first-child { padding-left: 18px; }
.timesheet thead th { border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.timesheet thead .dname { display: block; font-weight: 600; }
.timesheet .ts-row td { border-top: 1px solid var(--line); }
.timesheet td.task { min-width: 280px; }
.timesheet .taskname, .entry .taskname { display: block; margin-top: 2px; }
.timesheet .noteicon { width: 40px; }
.timesheet .noteicon button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.timesheet .hrs { position: relative; width: 82px; }
.timesheet .hrs input { width: 74px; text-align: right; padding: 7px 8px; }
.timesheet input.bad { border-color: var(--crit); background: var(--crit-soft); }
.timesheet th.today, .timesheet td.today { background: var(--accent-soft); }
.timesheet .dot { position: absolute; top: 12px; right: 10px; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.timesheet .notes td { padding-top: 0; vertical-align: top; }
.timesheet .notes textarea { width: 74px; min-height: 56px; font-size: 12px; padding: 4px; }
.timesheet tfoot td { border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 600; }
.ts-foot { gap: 10px; }

.daytabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); overflow-x: auto; }
.daytabs button { flex: 1 1 0; min-width: 76px; border: 0; border-radius: 0; background: none; text-align: left;
  padding: 12px 16px 10px; border-bottom: 3px solid transparent; display: flex; flex-direction: column; gap: 2px; }
.daytabs button[aria-selected="true"] { border-bottom-color: var(--accent); font-weight: 600; }
.daytabs button.is-today span:first-child { color: var(--accent); font-weight: 600; }
.daytabs .tot { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.daytabs .weektot { margin-left: auto; padding: 12px 18px 10px; text-align: right; display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.dayentries .entry { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px; gap: 12px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dayentries .entry-note { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; white-space: pre-line; }
.dayentries .entry-hours { font: 600 20px var(--font-display); text-align: right; font-variant-numeric: tabular-nums; }
.dayentries .entry-foot { border-bottom: 0; }
.dayentries .entry-foot .link { justify-self: start; font-size: 15px; }
.dayentries .entry-total { grid-column: 2 / 4; text-align: left; font-size: 16px; }
.dayentries .empty { padding: 20px 18px; }

.modal-backdrop { position: fixed; inset: 0; background: rgb(10 20 16 / 0.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 8vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: min(560px, 100%); padding: 0 20px 20px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font: 600 15px var(--font-body); text-align: center; background: var(--bg); margin: 0 -20px; padding: 12px 20px;
  border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.modal textarea, .modal input { width: 100%; }
.modal .field.hours { max-width: 180px; }
.modal .field.hours input { font-size: 18px; text-align: right; }
.modal-actions { margin-top: 4px; align-items: center; }
.modal-actions .push { margin-left: auto; }
.pk-button { width: 100%; text-align: left; display: flex; flex-direction: column; padding: 8px 12px; min-height: 44px; justify-content: center; }
.pk-button[aria-expanded="true"] { border-color: var(--accent); }
.pk-panel { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; padding: 8px; background: var(--surface); }
.pk-panel input { margin-bottom: 6px; }
.pk-panel ul { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.pk-group { font-weight: 600; padding: 8px 10px 4px; color: var(--ink); }
.pk-panel li[role="option"] { padding: 7px 10px 7px 24px; cursor: pointer; border-radius: 4px; }
.pk-panel li[role="option"]:hover { background: var(--bg); }
.pk-panel li.hi { background: var(--ink); color: var(--surface); }
.pk-panel li.hi .cap { color: inherit; }
.pk-panel li[aria-selected="true"]:not(.hi) { font-weight: 600; }
.pk-empty { padding: 8px 10px; color: var(--muted); }
@media (max-width: 720px) {
  .dayentries .entry { grid-template-columns: minmax(0, 1fr) 70px; }
  .dayentries .entry > div:last-child { grid-column: 1 / -1; }
  .datenav .navlabel { min-width: 0; }
}
.lockbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.usage { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.usage .bar { width: 72px; }
.bar.warn span { background: var(--warn); }
.bar.over span { background: var(--crit); }
.pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.pct.warn { color: var(--warn); font-weight: 600; }
.pct.over { color: var(--crit); font-weight: 600; }
.over-text { color: var(--crit); }
.tiles dd .usage .bar { width: 90px; height: 8px; }
.stage-toggle { font-weight: 600; text-decoration: none; color: var(--ink); text-align: left; }
.costform { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 16px; align-items: end; margin: 8px 0 16px; }
.costform .wide { grid-column: 1 / -1; }
.costform input, .costform select { width: 100%; }
.cols > .card { min-width: 0; }

/* ---- Timesheet approval ---- */
.ts-foot { justify-content: space-between; }
.approval { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-left: auto; }
.approval span { max-width: 60ch; }
.approval-submitted span strong, .approval-approved span strong { color: var(--accent); }
.submit-week { font-weight: 600; }
.pill-not-submitted { color: var(--muted); }
.pill-submitted { color: var(--warn); background: var(--warn-soft); }
.pill-approved { color: var(--accent); background: var(--accent-soft); }
.pill-rejected { color: var(--crit); background: var(--crit-soft); }
.appr .appr-actions { text-align: right; white-space: nowrap; }
.appr .appr-actions button + button { margin-left: 6px; }
.appr .pill + .cap { margin-top: 4px; max-width: 34ch; white-space: normal; }
.appr-open > td { background: var(--bg); padding: 12px 16px 16px; }
.appr-detail { min-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.appr-detail th, .appr-detail td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.appr-detail td:first-child .cap { margin-top: 2px; }
.appr-notes { margin: 10px 0 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.reject-form { display: flex; flex-direction: column; gap: 6px; text-align: left; white-space: normal; min-width: 260px; }
.reject-form label { font-size: 12px; font-weight: 600; color: var(--muted); }
.show-empty { margin-top: 10px; color: var(--muted); }
.appr-notes li { white-space: pre-line; }

/* Admins switching to a teammate's timesheet */
.person-pick select { min-width: 200px; }
.ts-top h1 + .person-pick { margin-right: auto; }
.flash-info { background: #fff7e0; border-color: #d9a400; justify-content: flex-start; flex-wrap: wrap; gap: 6px 14px; align-items: center; }

/* Team page, after Harvest's */
:root { --bill: #3b63d1; --nonbill: #93aee9; --over: #c8423b; --over-soft: #e4938d; }
:root[data-theme="dark"] { --bill: #7c9df0; --nonbill: #3d5591; --over: #ef7b73; --over-soft: #7a3631; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bill: #7c9df0; --nonbill: #3d5591; --over: #ef7b73; --over-soft: #7a3631; } }
.team-sum { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.3fr) minmax(320px, 3fr); gap: 16px 32px; align-items: start; }
.team-sum .lbl { display: block; font-size: 14px; }
.team-sum .big { display: block; font: 700 30px var(--font-display); font-variant-numeric: tabular-nums; }
.team-split { display: grid; grid-template-columns: auto 1fr; gap: 4px 24px; align-items: center; }
.team-split dl { grid-row: span 3; margin: 0; display: grid; gap: 8px; min-width: 190px; }
.team-split dl div { display: flex; justify-content: space-between; gap: 24px; }
.team-split dt { display: flex; gap: 8px; align-items: center; }
.team-split dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.key { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.key.b, .splitbar .b, .tbar .b { background: var(--bill); }
.key.nb, .splitbar .nb, .tbar .nb { background: var(--nonbill); }
.splitbar, .tbar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); position: relative; }
.ticks { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); }
.splitbar i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.45); }
.team-filter { gap: 10px; margin: 4px 0 0; }
.team-filter input { width: min(420px, 100%); }
.team-table td { vertical-align: middle; }
.team-table .who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.team-table .nm { font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.tag { font-size: 12px; border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; color: var(--muted); }
.barcell { width: 30%; min-width: 180px; }
.tbar.over .b { background: var(--over); }
.tbar.over .nb { background: var(--over-soft); }
.tbar .cap-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.team-table .cap { display: block; }
.team-table td.warn { color: var(--over); font-weight: 600; }
.team-table .act { text-align: right; white-space: nowrap; }
.row.team-filter select { width: auto; flex: 0 0 220px; max-width: 220px; }
.row.team-filter input { flex: 0 1 420px; }
@media (max-width: 900px) { .team-sum { grid-template-columns: 1fr 1fr; } .team-split { grid-column: 1 / -1; } }

/* Photos and profiles */
img.avatar { border-radius: 50%; object-fit: cover; display: inline-block; flex: none; background: var(--accent-soft); }
.avatar { flex: none; }
.who .me { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; padding: 3px 10px 3px 3px; border-radius: 99px; }
.who .me:hover, .who .me.current { background: var(--accent-soft); color: var(--ink); }
.team-table a.nm { color: var(--ink); text-decoration: none; }
.team-table a.nm:hover { text-decoration: underline; }
.back { display: inline-block; margin-bottom: 4px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.profile-head h1 { font-size: 22px; margin: 0; }
.profile { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.ptabs { display: grid; gap: 4px; position: sticky; top: 16px; }
.ptabs button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font: inherit; color: var(--muted); cursor: pointer; }
.ptabs button[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.pform { padding: 8px 24px 20px; }
.pform hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.pfield { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 6px 24px; padding: 12px 0; align-items: start; }
.pfield > label { font-weight: 600; padding-top: 8px; }
.pfield input:not([type=checkbox]):not([type=file]):not(.short), .pfield select { width: 100%; max-width: 560px; }
.pfield .hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; max-width: 70ch; }
.pfield .plain { margin: 8px 0 0; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; max-width: 720px; }
.picks.readonly { min-height: 30px; align-items: center; }
.pick { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.pick:hover { border-color: var(--accent); }
.pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pfield > .plabel { font-weight: 600; padding-top: 6px; }
.choice-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px 32px; }
.choice-list ul { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
.choice-list li { display: flex; align-items: center; gap: 6px; }
.choice-list li input { flex: 1; min-width: 0; }
.choice-list li .cap { min-width: 64px; text-align: right; }
.choice-list .row input { flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 560px; min-height: 40px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: text; }
.tags.readonly { border-style: dashed; cursor: default; }
.tags input { border: 0 !important; outline: none; flex: 1 1 120px; min-width: 120px; padding: 4px; background: transparent; box-shadow: none !important; }
.tags:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tagchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px;
  background: var(--accent-soft); border: 1px solid var(--accent); font-size: 14px; }
.tags.readonly .tagchip { padding-right: 10px; }
.tagchip .x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 5px; color: var(--ink); border-radius: 50%; }
.tagchip .x:hover { background: rgba(0,0,0,.08); }
.cap-row { align-items: center; gap: 10px; }
.addbox { display: grid; gap: 4px; text-align: left; width: 100%; max-width: 560px; margin-top: 10px; padding: 12px 16px;
  border: 1.5px dashed var(--line); border-radius: 10px; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.addbox span { color: var(--muted); font-size: 14px; }
.addbox:hover { border-color: var(--accent); }
.workhours { margin-top: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; max-width: 560px; }
.wh-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; }
.wh-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; text-align: center; }
.wh-grid input { width: 100%; text-align: center; }
.photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.pactions { gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 8px; }
@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; } .ptabs { position: static; display: flex; }
  .pfield { grid-template-columns: 1fr; } .pfield > label { padding-top: 0; }
}

/* Adding and archiving people */
.modal.modal-wide { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.two .field input, .row.two .field select { width: 100%; flex: none; }
.row.two .field input.num { text-align: left; }
.field .flabel { display: block; font-weight: 600; margin-bottom: 6px; }
.modal .picks { margin-bottom: 4px; }
.tag-invite { color: var(--warn); border-color: var(--warn); }
.ts-top .row { gap: 8px; flex-wrap: wrap; }
.profile-head { flex-wrap: wrap; }
.profile-head .head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.archived-banner { margin-bottom: 14px; }
@media (max-width: 640px) { .row.two { grid-template-columns: 1fr; } }

/* Reports */
.report-bar { flex-wrap: wrap; gap: 10px 14px; }
.report-bar #r-period { flex: none; width: auto; min-width: 150px; }
.custom-range { gap: 10px; align-items: center; }
.custom-range label { display: flex; gap: 6px; align-items: center; }
.rep-head { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr 1.2fr; gap: 16px 32px; align-items: center; padding: 20px 24px; }
.rep-head .lbl { display: block; font-size: 14px; }
.rep-head .big { display: block; font: 700 28px var(--font-display); font-variant-numeric: tabular-nums; }
.rep-split { display: flex; align-items: center; gap: 18px; }
.rep-split dl { margin: 0; display: grid; gap: 8px; flex: 1; }
.rep-split dl div { display: flex; justify-content: space-between; gap: 16px; }
.rep-split dt { display: flex; gap: 8px; align-items: center; }
.rep-split dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut { width: 84px; height: 84px; flex: none; }
.donut circle { fill: none; stroke-width: 12; }
.donut .nb { stroke: var(--nonbill); }
.donut .b { stroke: var(--bill); }
.donut text { font: 700 19px var(--font-display); fill: var(--ink); }
.rtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 6px; }
.rtabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.rtabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.rtools { justify-content: flex-end; gap: 12px; flex-wrap: wrap; align-items: center; }
.rtools .check { margin-right: auto; }
.export { gap: 6px; align-items: center; }
.rtable th { white-space: nowrap; }
.sorth { color: inherit; text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.sorth .arrow { font-size: 10px; opacity: .35; }
.sorth.on, .sorth:hover { color: var(--ink); }
.sorth.on .arrow { opacity: 1; color: var(--accent); }
.rtable td.num { white-space: nowrap; }
.rtable td a { color: var(--ink); }
.rtable td a.muted-link { color: var(--muted); }
.rtable tfoot td { border-top: 2px solid var(--line); padding-top: 10px; }
.cap-pct { color: var(--muted); font-size: 13px; margin-left: 4px; }
.hcell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.rbar { display: flex; width: 120px; height: 14px; border-radius: 3px; overflow: hidden; background: var(--bg); flex: none; }
.rbar .b { background: var(--bill); } .rbar .nb { background: var(--nonbill); }
.rtable .who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dtitle { font: 600 22px var(--font-display); margin: 14px 0 8px; }
.rtools-top { gap: 16px; margin-top: 4px; }
.detail-head { grid-template-columns: 1fr 1fr; }
.fsum { margin: 0; display: grid; gap: 4px; }
.fsum div { display: grid; grid-template-columns: 110px 1fr; }
.fsum dt { color: var(--muted); } .fsum dd { margin: 0; font-weight: 600; }
.dfilters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 12px 0; }
.dfilters select { flex: 0 1 auto; max-width: 260px; }
.dfilters .export { margin-left: auto; }
.dtable td { vertical-align: top; }
.dtable .dnote { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 46ch; white-space: pre-wrap; }
.dtable tr.grp td { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 13px; }
.dtable .cap { display: block; }
@media (max-width: 1000px) { .rep-head { grid-template-columns: 1fr 1fr; } }
@media print { .top, .ts-bar, .rtools, .dfilters, .rtools-top, .export { display: none !important; } }

/* Import from Harvest */
.imp-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin: 10px 0 12px; }
.imp-file { display: grid; gap: 4px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.imp-preview { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.imp-scroll { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.imp-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.imp td { vertical-align: top; font-size: 14px; }
table.imp td .cap { display: block; }
table.imp td.addr { white-space: pre-line; color: var(--muted); font-size: 13px; }
table.imp tr.off td { opacity: .45; }
.imp-notes { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--warn); max-width: 34ch; }
.pill-imp-new { color: var(--accent); } .pill-imp-update { color: var(--eq); } .pill-imp-unchanged, .pill-imp-skip { color: var(--muted); }
.imp-actions { gap: 10px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Clients */
button.sorth { border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; min-height: 0; box-shadow: none; }
.clients-table td { vertical-align: top; }
.clients-table td .cap { display: block; }
.clients-table tr.off td { opacity: .6; }
.clients-table .client-name { font-weight: 600; text-align: left; padding: 0; }
.cl-active { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 4px; }
.cl-active input[type=checkbox] { margin-top: 3px; flex: none; width: auto; }
.cl-active label { flex: 1; }
.cl-active label { font-size: 14px; font-weight: normal; color: var(--ink); }

/* Jobs first */
.pagehead .primary { margin-left: auto; }
.tag-proposal { color: var(--eq); border-color: var(--eq); margin-left: 6px; }
.jobno-input { font: 600 18px var(--font-display); max-width: 180px; letter-spacing: .02em; }
.row.spread { justify-content: space-between; align-items: center; }
.job-details h2, .cols .card h2 { margin: 0; }
dl.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 12px 0 0; }
dl.kv dt { font-size: 12px; font-weight: 600; color: var(--muted); }
dl.kv dd { margin: 2px 0 0; }
dl.kv .wide { grid-column: 1 / -1; }
.notes-text { white-space: pre-wrap; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
dl.kv dd { text-align: left; font-variant-numeric: normal; font-family: inherit; font-size: 15px; font-weight: 500; }
.modal .pfield .row { flex-wrap: nowrap; align-items: center; gap: 8px; }
.modal .pfield .row input { flex: 1; min-width: 0; }
.modal .pfield .row button { flex: none; white-space: nowrap; }
#nj-no-warn:empty { display: none; }
#nj-no-warn { margin: 6px 0 0; font-size: 14px; }
.jobno-input[aria-invalid="true"] { border-color: var(--warn); outline-color: var(--warn); }
.namefield { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.namefield label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.namefield input { flex: 1; min-width: 0; }
.jobhead h1 .tag { font: 500 12px var(--font-body); vertical-align: middle; margin-left: 6px; }
.jobhead dd .cap { display: block; }
.modal.modal-xwide { width: min(900px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.ov-h { margin: 16px 0 4px; font-size: 15px; }
.ov-table td .cap { display: block; }
.ov-table tfoot td { border-top: 2px solid var(--line); }

/* Job stages */
.stage-pill { display: inline-block; font: 700 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 99px; border: 1px solid; vertical-align: middle; white-space: nowrap; }
.stage-proposal { color: #b45d00; background: #fff1de; border-color: #e8a04a; }
.stage-current { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.stage-closed { color: var(--muted); background: transparent; border-color: var(--line); }
:root[data-theme="dark"] .stage-proposal { color: #f6b46a; background: #3a2510; border-color: #a8692a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stage-proposal { color: #f6b46a; background: #3a2510; border-color: #a8692a; } }
.jobhead h1 .stage-pill { margin-left: 10px; font-size: 12px; }
.lockbar-row { gap: 10px; align-items: center; flex-wrap: wrap; }
.jobs-head { grid-template-columns: repeat(4, 1fr); align-items: start; }
.jobs-head .muted { display: block; font-size: 13px; }
@media (max-width: 800px) { .jobs-head { grid-template-columns: 1fr 1fr; } }
.lead { display: inline-flex; align-items: center; gap: 8px; margin-right: 14px; white-space: nowrap; }
.lead-chips { margin-bottom: 6px; }
