/* Look and feel: Buildertrend's sizes and spacing (measured 2026-11-23, see
   docs/ui-style.md), Quercus brand colours (Olive Green replaces BT's blue). */
@font-face {
  font-family: "Inter";
  src: url("/vendor/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --ink: #202227;
  --ink-soft: #5c636d;
  --line: #d9dee3;
  --line-strong: #c4ccd5;
  --surface: #ffffff;
  --page: #f2f3f1;
  --brand: #2f4731;
  --brand-hover: #263a28;
  --brand-ink: #ffffff;
  --brand-soft: #e6ece6;
  --good: #1f6b3f;
  --good-soft: #e2f1e7;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fcf1d9;
  --info: #3b5268;
  --info-soft: #e9eef3;
  --radius: 8px;
  --nav-h: 48px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: normal;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); }
h1 { font-size: 30px; line-height: 36px; font-weight: 700; margin: 0; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0 0 .6rem; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
a { color: var(--brand); }
.muted { color: var(--ink-soft); }
.boot { padding: 3rem; text-align: center; color: var(--ink-soft); }
.wordmark { display: inline-flex; align-items: center; text-decoration: none; margin: 0; }
.wordmark img { height: 26px; width: auto; display: block; }
.gate .wordmark img { height: 34px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }

/* ---- sign-in and Demo role picker ---- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; }
.gate-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; width: min(100%, 380px); display: grid; gap: 1rem; }
.gate-wide { width: min(100%, 860px); }
.gate-card h1 { font-size: 30px; }
.gate { background: var(--brand); min-height: 100vh; }
.gate-card { box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.demo-tag { font-size: 12px; font-weight: 600; margin-left: .6rem; background: var(--warn-soft); color: var(--warn); padding: .15rem .5rem; border-radius: 99px; vertical-align: middle; }
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.persona { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; cursor: pointer; display: grid; gap: .15rem; font: inherit; color: inherit; min-height: 64px; }
.persona:hover, .persona:focus-visible { border-color: var(--brand); background: var(--brand-soft); }

/* ---- layout ---- */
.layout { min-height: 100%; display: flex; flex-direction: column; }
.demo-bar { background: var(--warn-soft); color: var(--warn); padding: 4px 16px; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: 13px; border-bottom: 1px solid #ecd9a8; }
.demo-bar label { margin-left: auto; display: flex; gap: .4rem; align-items: center; white-space: nowrap; }
.demo-bar select { max-width: 60vw; min-height: 28px; padding: 2px 6px; font-size: 13px; }
/* top navigation (Buildertrend: one 48px band, modules across, menus drop down) */
.topnav { background: var(--brand); color: #fff; height: var(--nav-h); display: flex; align-items: center; gap: 2px; padding: 0 16px; position: sticky; top: 0; z-index: 8; }
.topnav .wordmark { margin-right: 18px; }
.topnav .wordmark img { height: 18px; }
.topnav-group { position: relative; }
.topnav-btn { font: inherit; font-weight: 500; color: #fff; background: none; border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 20px; }
.topnav-btn:hover, .topnav-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .14); }
.topnav-btn.on { background: rgba(255, 255, 255, .2); }
.topnav-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topnav-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--brand); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 4px; display: grid; z-index: 9; }
.nav-menu-right { left: auto; right: 0; }
.nav-menu a, .nav-menu button { font: inherit; text-align: left; background: none; border: 0; color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.nav-menu a:hover, .nav-menu button:hover { background: var(--page); }
.nav-menu a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-menu .nav-soon { color: var(--ink-soft); }
.nav-menu-head { padding: 8px 12px 4px; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; color: var(--ink-soft); }
.nav-menu-user { padding: 8px 12px; display: grid; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.nav-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.nav-soon { color: var(--ink-soft); }
.body { flex: 1; display: flex; min-height: 0; }
.content { flex: 1; min-width: 0; padding: 16px 24px 64px; }
.page { max-width: 1240px; margin: 0 auto; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.page > * { min-width: 0; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.crumb { font-size: 14px; font-weight: 500; color: var(--ink); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

/* ---- pieces ---- */
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; flex: 1; }
.btn { font: inherit; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 12px; cursor: pointer; min-height: 32px; white-space: nowrap; line-height: 20px; }
.btn:hover:not(:disabled) { background: #f6f7f6; border-color: #aeb7c0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--bad); border-color: #ebc0bb; }
.btn-small { padding: 3px 10px; min-height: 28px; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0; min-height: 0; text-decoration: underline; }
.icon-btn { font: inherit; font-size: 18px; line-height: 1; border: 0; background: none; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; color: var(--ink); }
.icon-btn:hover { background: var(--page); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 12px; line-height: 16px; font-weight: 500; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eceeec; color: var(--ink-soft); }
.note { background: var(--info-soft); color: var(--info); border-radius: var(--radius); padding: 10px 12px; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.note-bad { background: var(--bad-soft); color: var(--bad); }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.empty { color: var(--ink-soft); padding: 1.5rem; text-align: center; margin: 0; }

/* ---- forms ---- */
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field-label { font-size: 12px; line-height: 16px; font-weight: 700; }
.field-hint { font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.field-error { font-size: 12px; line-height: 16px; color: var(--bad); }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #ccd2d8; border-radius: 4px; padding: 5px 8px; background: var(--surface); width: 100%; min-height: 32px; min-width: 0; line-height: 20px; }
input:hover, select:hover, textarea:hover { border-color: #aeb7c0; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .nav-item:focus-visible, .icon-btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.check { display: flex; gap: .5rem; align-items: center; }
.check-list { display: grid; gap: .45rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.toolbar .grow { flex: 1 1 220px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 14px; color: var(--ink); font-weight: 500; padding: 14px 8px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f6f8f6; }
tr.struck td { color: var(--ink-soft); }
tfoot td { font-weight: 600; border-bottom: 0; }
tfoot tr.grand td { font-size: 16px; border-top: 2px solid var(--ink); }

/* ---- quotation editor lines ---- */
.lines { display: grid; gap: .6rem; }
.line { display: grid; grid-template-columns: minmax(180px, 3fr) 90px 130px 90px 120px 40px; gap: .5rem; align-items: start; }
.line .check { min-height: 40px; }
.line .amount { text-align: right; padding: .5rem 0; font-variant-numeric: tabular-nums; }
.line-head { font-size: 14px; color: var(--ink); font-weight: 500; }
.totals { margin-left: auto; width: min(100%, 320px); display: grid; gap: .25rem; }
.totals div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 16px; border-top: 2px solid var(--ink); padding-top: .35rem; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin: 0; }
.meta dt { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.timeline li { border-left: 3px solid var(--line); padding-left: .7rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- modal and toasts ---- */
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(94vw, 520px); max-height: 90vh; color: var(--ink); }
.modal-wide { width: min(94vw, 860px); }
.modal::backdrop { background: rgba(20, 28, 36, .45); }
.modal-head { display: flex; align-items: center; padding: .9rem 1rem .5rem 1.2rem; }
.modal-head h2 { flex: 1; margin: 0; font-size: 20px; line-height: 24px; }
.modal-body { padding: .5rem 1.2rem 1rem; display: grid; gap: .9rem; overflow-y: auto; }
.modal-foot { padding: .8rem 1.2rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: .4rem; z-index: 20; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: .65rem .9rem; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0, 0, 0, .2); }

/* ---- phones ---- */
@media (max-width: 820px) {
  .content { padding: 12px 14px 64px; }
  h1 { font-size: 24px; line-height: 30px; }
  /* phones: 16px inputs stop iPhone zooming in; 40px touch targets */
  input, select, textarea { font-size: 16px; min-height: 40px; }
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn-small { min-height: 34px; }
  .icon-btn { width: 40px; height: 40px; }
  .demo-bar label { margin-left: 0; width: 100%; }
  .demo-bar select { max-width: none; flex: 1; }
  .line { grid-template-columns: 1fr 1fr; padding: .7rem; border: 1px solid var(--line); border-radius: var(--radius); }
  .line > :first-child { grid-column: 1 / -1; }
  .line-head { display: none; }
  .line .amount { text-align: left; }
  .only-wide { display: none !important; }
}
@media (min-width: 821px) {
  .only-narrow { display: none !important; }
  .line .field-label { display: none; }
}

/* ==== shared workspace (docs/buildertrend-research/00-ui-conventions.md) ==== */
.screen { display: flex; gap: 1rem; align-items: flex-start; }
.screen-main { flex: 1; min-width: 0; max-width: none; margin: 0; }
.spacer { flex: 1; }

/* project rail */
.rail { width: 260px; flex: none; position: sticky; top: calc(var(--nav-h) + 16px); display: grid; gap: .6rem; align-content: start; max-height: calc(100vh - 5.5rem); }
.rail-collapsed { width: 40px; }
.rail-toggle { justify-self: end; font-size: 1.1rem; }
.rail-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 12px; display: grid; gap: 2px; }
.rail-card strong { font-size: 16px; line-height: 24px; font-weight: 600; }
.rail-card .badge { margin-bottom: 4px; }
.rail-card .badge { justify-self: start; }
.rail-list { display: grid; gap: .15rem; overflow-y: auto; min-height: 0; }
.rail-item { font: inherit; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.rail-item:hover { background: var(--surface); }
.rail-item-on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rail-none { padding: .4rem .55rem; margin: 0; }

/* status tabs */
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tab { font: inherit; font-weight: 500; border: 0; background: none; padding: 10px 8px; cursor: pointer; color: var(--ink-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab-on { color: var(--brand); border-bottom-color: var(--brand); }
.tab-count { display: inline-block; margin-left: 4px; color: var(--ink-soft); font-weight: 400; }
.tab-on .tab-count { color: var(--ink-soft); }

/* list card, totals row, phone cards */
.list-card { padding: .4rem .6rem; }
.cards { display: grid; gap: .5rem; }
.cards-total { display: flex; justify-content: space-between; align-items: baseline; padding: .4rem .2rem .2rem; }
.cards-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.card-row { font: inherit; color: inherit; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.card-row.struck { opacity: .7; }
.card-main { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.card-line { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.card-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.card-chevron { color: var(--ink-soft); font-size: 1.4rem; }

/* empty states */
.empty-state { padding: 2rem 1rem; text-align: center; display: grid; gap: .5rem; justify-items: center; }
.empty-state p { margin: 0; max-width: 46ch; }
.empty-clear strong { color: var(--good); }

/* filter drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(20, 28, 36, .3); z-index: 16; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(92vw, 340px); background: var(--surface); z-index: 17; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0, 0, 0, .15); }
.drawer-head { display: flex; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem; display: grid; gap: .9rem; align-content: start; }
.drawer-foot { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }

/* record window */
.win-scrim { position: fixed; inset: 0; background: rgba(20, 28, 36, .45); z-index: 13; }
.win { position: fixed; z-index: 14; top: 3vh; bottom: 3vh; left: 50%; transform: translateX(-50%); width: min(96vw, 1320px); background: var(--page); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); outline: none; }
.win-head { display: flex; align-items: flex-start; gap: .4rem; padding: 12px 16px 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.win-title { min-width: 0; flex: 1; }
.win-title-line { display: flex; align-items: center; gap: .3rem .6rem; flex-wrap: wrap; }
.win-title h1 { font-size: 20px; line-height: 24px; font-weight: 600; overflow-wrap: anywhere; }
.win-title .crumb { font-size: 14px; font-weight: 500; color: var(--ink); }
.win-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.icon-on { background: var(--brand-soft); }
.win-main { flex: 1; min-height: 0; display: flex; }
.win-body { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 20px 24px; display: grid; gap: 16px; align-content: start; }
.win-side { width: 320px; flex: none; border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.win-foot { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 20px; border-radius: 0 0 var(--radius) var(--radius); }
.win-form { display: grid; gap: 1rem; }
.side-panel { padding: 1rem; display: grid; gap: .6rem; align-content: start; }

/* status bar and action bar */
.status-bar { border-radius: var(--radius); padding: 10px 12px; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--info-soft); color: var(--info); }
.status-good { background: var(--good-soft); color: var(--good); }
.status-bad { background: var(--bad-soft); color: var(--bad); }
.status-warn { background: var(--warn-soft); color: var(--warn); }
.status-muted { background: #eceeec; color: var(--ink-soft); }
.action-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.more { position: relative; }
.more-menu { position: absolute; bottom: calc(100% + .35rem); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .15); min-width: 200px; padding: .3rem; z-index: 3; display: grid; }
.more-item { font: inherit; text-align: left; border: 0; background: none; padding: .55rem .7rem; border-radius: 6px; cursor: pointer; color: var(--ink); }
.more-item:hover { background: var(--page); }
.more-danger { color: var(--bad); }

@media (max-width: 820px) {
  .screen { display: block; }
  .rail-select { margin-bottom: .8rem; }
  .win { inset: 0; transform: none; width: auto; border-radius: 0; }
  .win-head, .win-foot { border-radius: 0; }
  .win-head { padding: .6rem .8rem; }
  .win-body { padding: .8rem; }
  .win-with-side .win-body { display: none; }
  .win-side { width: 100%; border-left: 0; }
  .win-foot { padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); }
  .lines-table thead { display: none; }
  .lines-table tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); padding: .4rem 0; }
  .lines-table td { border: 0; padding: .2rem .3rem; text-align: left; }
  .lines-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .lines-table td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--ink-soft); font-size: .8rem; }
}
td.nowrap, th.nowrap { white-space: nowrap; }
tfoot td:first-child { white-space: nowrap; }

/* ---- Stage lists ---- */
.stage-items { list-style: none; margin: 0 0 .8rem; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.stage-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .35rem .6rem; min-height: 48px; border-top: 1px solid var(--line); }
.stage-row:first-child { border-top: 0; }
.stage-row.struck .stage-name { color: var(--ink-soft); text-decoration: line-through; }
.stage-name { flex: 1 1 auto; }
.stage-tools { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.stage-tools .icon-btn { font-size: 1rem; }
.stage-tools .icon-btn:disabled { opacity: .3; cursor: default; }
.stage-edit, .stage-add { display: flex; gap: .5rem; flex: 1 1 100%; flex-wrap: wrap; }
.stage-edit input, .stage-add input { flex: 1 1 200px; }

/* ---- form helpers ---- */
.text-bad { color: var(--bad); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.plain-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-section { font-size: .95rem; margin: .4rem 0 -.3rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.form-section .muted { font-weight: 400; font-size: .85rem; }

/* ==== phone habits from the Buildertrend app (docs/buildertrend-research/11-mobile-app.md) ==== */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabbar-item { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0 5px; color: var(--ink-soft); text-decoration: none; font-size: 11px; line-height: 14px; font-weight: 500; min-height: 54px; }
.tabbar-item[aria-current="page"] { color: var(--brand); font-weight: 600; }
.project-button { font: inherit; font-size: .9rem; border: 0; background: none; padding: .2rem 0; color: var(--brand); cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker { position: fixed; inset: 0; z-index: 15; background: var(--page); display: flex; flex-direction: column; }
.picker-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.picker-head h2 { margin: 0; font-size: 1rem; }
.picker-head .btn-link { justify-self: start; }
.picker-search { padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.picker-search input { width: 100%; }
.picker-body { flex: 1; overflow-y: auto; padding-bottom: 2rem; }
.pick-group { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; color: var(--ink-soft); padding: .9rem 1rem .3rem; }
.pick-row { font: inherit; color: inherit; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .5rem; text-align: left; background: var(--surface); border: 0; border-bottom: 1px solid var(--line); padding: .8rem 1rem; min-height: 48px; cursor: pointer; }
.pick-on { color: var(--brand); }
.pick-tick { font-weight: 700; }
.fab { position: fixed; right: 1rem; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 9; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 1.8rem; line-height: 1; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); cursor: pointer; }
.card-small { font-size: .82rem; }
.more-user { display: grid; gap: .15rem; }
.more-group { padding: 0; overflow: hidden; }
.more-group summary { list-style: none; cursor: pointer; padding: .8rem 1rem; display: flex; justify-content: space-between; }
.more-group summary::-webkit-details-marker { display: none; }
.more-group summary h2 { margin: 0; }
.more-group summary::after { content: "▾"; color: var(--ink-soft); }
.more-group:not([open]) summary::after { content: "▸"; }
.more-link { display: flex; justify-content: space-between; padding: .8rem 1rem; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 48px; align-items: center; }
@media (max-width: 820px) {
  .topnav { display: none; }
  .content { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .action-bar { flex-wrap: nowrap; }
  .action-bar > .btn-primary { flex: none; }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ---- Purchase Order ---- */
.line.line-stage { grid-template-columns: minmax(160px, 3fr) minmax(120px, 1.4fr) 80px 120px 70px 110px 40px; }
.card-line-start { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.progress { position: relative; height: 12px; border-radius: 99px; background: #e6e9ed; overflow: hidden; }
.progress span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.progress-billed { background: #9cc3ad; }
.progress-paid { background: var(--good); }
@media (max-width: 820px) {
  .line.line-stage { grid-template-columns: 1fr 1fr; }
}

/* ---- Bill ---- */
.win-left { width: 44%; flex: none; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; }
.invoice-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.invoice-view { flex: 1; width: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); object-fit: contain; background: var(--page); }
.invoice-drop { font: inherit; color: var(--ink-soft); flex: 1; min-height: 200px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--page); cursor: pointer; padding: 1rem; }
.line-skipped { opacity: .55; }
tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.pay-row { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-row .grow { flex: 1 1 220px; min-width: 0; }
.pay-voided { opacity: .6; }
.pay-voided .card-amount { text-decoration: line-through; }
.alloc { font-size: .85rem; }
@media (max-width: 820px) {
  .win-split { flex-direction: column; overflow-y: auto; }
  .win-split .win-left { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: .8rem; }
  .win-split .win-body { overflow: visible; }
  .invoice-view { min-height: 260px; max-height: 50vh; }
  .invoice-drop { min-height: 90px; }
}

/* ---- formula bar (A − B = C) and stage tree ---- */
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.formula > div { display: grid; }
.formula strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.formula-op { font-size: 1.3rem; color: var(--ink-soft); }
.tree .tree-head td { background: var(--surface); border-top: 1px solid var(--line); }
.tree .tree-child td { font-size: .88rem; color: var(--ink-soft); padding-left: 2rem; }
.tree .tree-child td:first-child { padding-left: 2.2rem; }
.tree-toggle { display: inline-block; width: 1.2rem; color: var(--ink-soft); }
.sticky-total td { position: sticky; bottom: 0; background: var(--surface); font-weight: 700; border-top: 2px solid var(--ink); }
.line.budget-line { grid-template-columns: minmax(140px, 1.2fr) minmax(180px, 2fr) 150px 40px; }
@media (max-width: 820px) {
  .line.budget-line { grid-template-columns: 1fr 1fr; }
  .tree .tree-child td:first-child { padding-left: 1rem; }
}

/* ---- Client preview (A4-like sheet) ---- */
.sheet-wrap { display: grid; gap: .6rem; }
.sheet-tools { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sheet { position: relative; background: #fff; color: #111; width: 100%; max-width: 794px; margin: 0 auto; padding: 40px 44px; box-shadow: 0 2px 12px rgba(0,0,0,.12); border-radius: 4px; font-size: 13px; overflow: hidden; }
.sheet-watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 64px; font-weight: 800; color: rgba(163, 42, 42, .14); letter-spacing: .08em; pointer-events: none; white-space: nowrap; }
.sheet-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: .8rem; margin-bottom: 1rem; }
.sheet-company { font-size: 16px; }
.sheet-title { text-align: right; }
.sheet-title h2 { margin: 0 0 .2rem; font-size: 20px; letter-spacing: .06em; }
.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.sheet-parties h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #555; margin: 0 0 .2rem; }
.sheet-lines { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.sheet-lines th, .sheet-lines td { border-bottom: 1px solid #ddd; padding: .35rem .3rem; text-align: left; vertical-align: top; }
.sheet-lines th { font-size: 11px; text-transform: uppercase; color: #555; }
.sheet-lines .num { text-align: right; white-space: nowrap; }
.sheet-totals { margin-left: auto; width: min(100%, 280px); display: grid; gap: .2rem; }
.sheet-totals div { display: flex; justify-content: space-between; }
.sheet-totals .grand { font-weight: 700; border-top: 2px solid #111; padding-top: .3rem; }
.sheet-pay { margin-top: 1.2rem; border-top: 1px solid #ddd; padding-top: .8rem; display: grid; gap: .25rem; }
.sheet-due { font-size: 15px; }
.sheet-terms { display: grid; gap: .5rem; margin: 0 0 1rem; }
.sheet-terms dt { font-size: 11px; text-transform: uppercase; color: #555; }
.sheet-terms dd { margin: 0; }
.sheet-sign { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.sheet-sign div { border-top: 1px solid #111; padding-top: .3rem; font-size: 11px; color: #555; }
.win-tabs { margin: -.2rem 0 .2rem; }
@media (max-width: 820px) {
  .sheet { padding: 20px 16px; font-size: 12px; }
  .sheet-parties { grid-template-columns: 1fr; }
  .sheet-doc th:nth-child(2), .sheet-doc td:nth-child(2), .sheet-doc th:nth-child(3), .sheet-doc td:nth-child(3) { display: none; }
}
@media print {
  body * { visibility: hidden; }
  .sheet, .sheet * { visibility: visible; }
  .sheet { position: absolute; left: 0; top: 0; box-shadow: none; max-width: none; }
  .no-print { display: none; }
}
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 2px; background: var(--surface); width: fit-content; }
.segmented button { font: inherit; border: 0; background: none; padding: .4rem .9rem; border-radius: 99px; cursor: pointer; color: var(--ink-soft); min-height: 36px; }
.segmented .seg-on { background: var(--brand); color: var(--brand-ink); }
/* Rows in the record window keep their full height (scroll containers like the tab strip would otherwise collapse). */
.win-body { grid-auto-rows: max-content; }
.sheet-group td { background: #f2f4f6; padding-top: .5rem; }
.sheet-subtotal td { font-weight: 600; border-top: 1px solid #999; }
.sheet-terms.pnl div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #eee; padding: .35rem 0; }
.sheet-terms.pnl dd { font-variant-numeric: tabular-nums; }
/* ---- Schedule ---- */
.text-good { color: var(--good); font-weight: 600; }
.sched-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; flex: none; }
.sched-title { display: inline-flex; align-items: center; }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #9aa5b1; background: var(--surface); color: #fff; font-weight: 700; font-size: .8rem; cursor: pointer; display: inline-grid; place-items: center; padding: 0; flex: none; }
.tick-on { background: var(--good); border-color: var(--good); }
.tick:disabled { cursor: default; opacity: .7; }
.progress { display: inline-block; width: 56px; height: 6px; border-radius: 3px; background: #e5e9ee; vertical-align: middle; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--good); }
.progress-num { margin-left: .4rem; font-size: .85rem; }
.row-done td, .card-row.row-done { color: var(--ink-soft); }
.sched-card { display: flex; gap: .7rem; align-items: flex-start; }
.toolbar .check { align-self: center; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-nav { display: flex; align-items: center; gap: .4rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.cal-nav h2 { margin: 0 0 0 .4rem; font-size: 1.05rem; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: .3rem .4rem; border-bottom: 1px solid var(--line); }
.cal-week { grid-template-rows: 1.6rem repeat(var(--lanes), 1.55rem) .4rem; min-height: 6rem; position: relative; border-bottom: 1px solid var(--line); }
.cal-day { grid-row: 1 / -1; border-right: 1px solid var(--line); padding: .2rem .35rem; }
.cal-day:nth-child(7) { border-right: 0; }
.cal-num { font-size: .8rem; color: var(--ink-soft); }
.cal-out { background: #fafbfc; }
.cal-out .cal-num { opacity: .5; }
.cal-off { background: repeating-linear-gradient(135deg, #f6f7f9, #f6f7f9 6px, #eef1f4 6px, #eef1f4 12px); }
.cal-today .cal-num { background: var(--brand); color: #fff; border-radius: 99px; padding: 0 .4rem; }
.cal-bar { z-index: 1; margin: 1px 3px; border: 0; border-radius: 4px; background: var(--bar); color: #fff; font: inherit; font-size: .78rem; text-align: left; padding: 0 .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; min-height: 0; }
.cal-bar-done { opacity: .55; }
.cal-bar.cut-start { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.cut-end { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.grid-2, .grid-3 { display: grid; gap: .9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#schedule-form .plain-fieldset { display: grid; gap: .9rem; grid-column: 1 / -1; }
#schedule-form { grid-template-columns: 1fr; }
.swatches { display: flex; gap: .45rem; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; outline-offset: 2px; }
.swatch-on { outline: 2px solid var(--ink); }
.swatch-none { background: linear-gradient(135deg, #fff 45%, #c9ced4 45%, #c9ced4 55%, #fff 55%); border-color: var(--line); }
.exception-form { display: grid; grid-template-columns: 170px 190px 1fr auto; gap: .8rem; align-items: end; margin-bottom: .8rem; }
@media (max-width: 820px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :first-child { grid-column: 1 / -1; }
  .grid-2 { grid-template-columns: 1fr; }
  .exception-form { grid-template-columns: 1fr 1fr; }
  .exception-form > :nth-child(3), .exception-form .exception-add { grid-column: 1 / -1; }
  .cal-bar { font-size: .68rem; padding: 0 .2rem; }
  .cal-week { grid-template-rows: 1.4rem repeat(var(--lanes), 1.3rem) .3rem; min-height: 4.5rem; }
}
.weekdays { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.handover { display: grid; gap: .5rem; }
.handover-row { display: grid; grid-template-columns: 1fr minmax(180px, 240px); gap: .6rem; align-items: center; }
@media (max-width: 820px) { .handover-row { grid-template-columns: 1fr; } }
.card-row-outer { display: flex; align-items: stretch; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-row-outer > .card-row { flex: 1; border: 0; background: none; min-width: 0; }
.card-lead { display: flex; align-items: center; padding-left: .8rem; }
/* ---- Daily Log ---- */
.log-feed { display: grid; gap: .8rem; }
.log-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; cursor: pointer; display: grid; gap: .55rem; }
.log-card:hover { border-color: #c4ccd5; }
.log-head { display: flex; gap: .6rem; align-items: flex-start; }
.log-date { font-size: 16px; font-weight: 600; color: var(--brand); text-decoration: underline; margin-right: .5rem; }
.log-title { font-size: 1rem; }
.log-badges { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.log-body { margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.log-full { margin: .8rem 0 0; }
.log-count { font-size: .8rem; margin-top: -.3rem; }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)); gap: .4rem; }
.thumb-wrap { position: relative; }
.thumb-more { position: absolute; inset: 0; background: rgba(20, 28, 36, .55); color: #fff; border: 0; border-radius: 6px; font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.photo { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: #eef1f4; overflow: hidden; cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-file { display: grid; place-items: center; height: 100%; font-size: .75rem; padding: .3rem; word-break: break-all; color: var(--ink-soft); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.photo-edit { position: relative; }
.photo-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(20, 28, 36, .7); color: #fff; font-size: 1.1rem; cursor: pointer; }
.chips, .pick-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { background: #eef1f4; border-radius: 99px; padding: .15rem .6rem; font-size: .8rem; }
.chip-sub { background: var(--info-soft); color: var(--info); }
.chip-btn { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: .35rem .75rem; cursor: pointer; min-height: 36px; }
.chip-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.log-form { display: grid; gap: .9rem; }
.file-pick { cursor: pointer; }
@media (max-width: 820px) {
  .thumbs { grid-template-columns: 1fr; }
  .thumbs .thumb-wrap:not(:first-child) { display: none; }
  .log-head { flex-wrap: wrap; }
}
/* ---- To-Do ---- */
.filter-chips { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem; }
.fchip { display: inline-flex; align-items: center; gap: .3rem; background: var(--info-soft); color: var(--info); border-radius: 99px; padding: .2rem .3rem .2rem .7rem; font-size: .85rem; }
.fchip button { border: 0; background: none; color: inherit; font-size: 1rem; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; }
.add-filter { position: relative; }
.add-filter .more-menu { left: 0; right: auto; top: 100%; bottom: auto; }
.todo-list { padding: 0; }
.todo-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); }
.todo-main { flex: 1; text-align: left; border: 0; background: none; font: inherit; color: inherit; padding: .2rem 0; cursor: pointer; display: grid; min-width: 0; }
.todo-main:disabled { cursor: default; }
.todo-title { overflow-wrap: anywhere; }
.todo-meta { font-size: .85rem; }
.todo-done .todo-title { text-decoration: line-through; color: var(--ink-soft); }
.todo-add input { flex: 1; border: 0; font: inherit; padding: .5rem 0; background: none; outline: none; }
.tick-ghost { border-style: dashed; color: var(--ink-soft); cursor: default; }
.owner-pick { display: inline-flex; gap: .4rem; align-items: center; }
/* ---- Home ---- */
.home-page > .card { margin-bottom: .9rem; }
.action-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.action-tile { display: grid; gap: .2rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--info-soft); }
.action-tile strong { font-size: 1.6rem; color: var(--info); line-height: 1.1; }
.tile-bad { background: var(--bad-soft); }
.tile-bad strong { color: var(--bad); }
.quiet { font-size: .85rem; margin: .7rem 0 0; }
.log-remind li, .week-list li a { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.week-list li a { color: inherit; text-decoration: none; align-items: center; }
.week-title { flex: 1; }
.remind-warn span:last-child { color: var(--warn); font-weight: 600; }
@media (max-width: 820px) { .action-tiles { grid-template-columns: 1fr 1fr; } .log-remind li { flex-direction: column; gap: .1rem; } }
/* ---- OHS ---- */
.tabs-scroll { overflow-x: auto; }
.tabs-scroll .tabs { flex-wrap: nowrap; }
.ohs-checks { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; }
.ohs-check { color: var(--ink-soft); }
.ohs-check.ok { color: var(--good); font-weight: 600; }
.action-tile { font: inherit; text-align: left; cursor: pointer; }
.worker-list { display: grid; }
.worker-row { display: flex; justify-content: space-between; gap: .7rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.worker-row.status-expected { border-left: 3px solid var(--bad); padding-left: .6rem; }
.worker-state { font-size: .85rem; }
.swms-steps { display: grid; gap: .6rem; margin-bottom: .6rem; }
.swms-step { display: flex; gap: .7rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.swms-num { font-weight: 700; color: var(--ink-soft); min-width: 1.4rem; }
.swms-fields { display: grid; gap: .5rem; flex: 1; grid-template-columns: 1fr 1fr; }
.swms-read { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; flex: 1; }
.swms-read dt { color: var(--ink-soft); font-size: .85rem; }
.swms-read dd { margin: 0; }
.talk { border-top: 1px solid var(--line); padding: .6rem 0; }
.talk > .check-list, .talk > .btn, .talk > .actions, .talk > div { margin-top: .35rem; }
.talk:first-of-type { border-top: 0; }
.talk-form { display: grid; gap: .6rem; border-top: 1px dashed var(--line); padding-top: .7rem; margin-top: .4rem; }
.stepper { display: flex; flex-wrap: wrap; gap: .3rem; }
.step { font-size: .78rem; padding: .2rem .55rem; border-radius: 99px; background: #eef1f4; color: var(--ink-soft); }
.step-done { background: var(--good-soft); color: var(--good); }
.step-on { background: var(--brand); color: #fff; }
.private-box { border: 1px dashed var(--warn); border-radius: var(--radius); padding: .6rem; background: var(--warn-soft); }
.plan-sections { display: grid; gap: .7rem; }
.plan-read summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.form-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.form-card { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; display: grid; gap: .3rem; }
.trade-panel { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .3rem; display: grid; gap: .5rem; }
.worker-add { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: .5rem; }
@media (max-width: 820px) {
  .swms-fields { grid-template-columns: 1fr; }
  .worker-add { grid-template-columns: 1fr 1fr; }
  .ohs-summary { grid-template-columns: 1fr 1fr; }
}
/* ---- Checklist ---- */
.cl-layout { display: grid; grid-template-columns: 280px 1fr; gap: .9rem; align-items: start; margin-top: .8rem; }
.cl-stages { display: grid; gap: .15rem; position: sticky; top: .5rem; max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .3rem; }
.cl-stage { font: inherit; font-size: .88rem; text-align: left; border: 0; background: none; padding: .45rem .5rem; border-radius: 6px; cursor: pointer; display: grid; gap: .15rem; }
.cl-stage:hover { background: #f3f5f7; }
.cl-stage-on { background: var(--brand-soft); font-weight: 600; }
.cl-stage-meta { font-size: .78rem; }
.cl-items { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; display: grid; gap: .1rem; }
.cl-item { display: grid; grid-template-columns: 1fr minmax(220px, auto); gap: .8rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; padding-left: .5rem; }
.cl-Y { border-left-color: var(--good); }
.cl-N { border-left-color: var(--bad); }
.cl-NA { border-left-color: #9aa5b1; }
.cl-inactive { opacity: .55; }
.cl-code { font-size: .75rem; }
.cl-side { display: grid; gap: .35rem; justify-items: end; align-content: start; }
.cl-answers button { min-width: 3.4rem; }
.cl-answers button:disabled { cursor: default; }
.cl-reason { color: var(--bad); font-size: .88rem; text-align: right; }
.cl-who { font-size: .78rem; }
.cl-reason-form { display: grid; gap: .4rem; width: 100%; }
.cl-summary { margin-top: .4rem; }
@media (max-width: 820px) {
  .cl-layout { grid-template-columns: 1fr; }
  .cl-item { grid-template-columns: 1fr; }
  .cl-side { justify-items: stretch; }
  .cl-answers { width: 100%; }
  .cl-answers button { flex: 1; min-height: 44px; }
  .cl-reason { text-align: left; }
}
.cl-items .card-head { flex-wrap: wrap; }
@media (max-width: 820px) { .cl-items .card-head h2 { flex: 1 1 100%; } }
/* ---- Files ---- */
.files-bar { align-items: center; margin-bottom: .6rem; }
.crumbs { font-size: .95rem; }
.crumbs .btn-link { font-weight: 600; }
.folder-icon { color: #d7a21f; flex: none; }
.folder-system { color: #4f6f8f; }
.file-name { display: inline-flex; align-items: center; gap: .55rem; }
.file-badge { font-size: .62rem; font-weight: 700; background: #eef1f4; color: var(--ink-soft); border-radius: 4px; padding: .15rem .3rem; min-width: 2.4rem; text-align: center; flex: none; }
.file-sub { display: block; font-size: .8rem; }
.record-chip { display: inline-block; background: var(--info-soft); color: var(--info); border-radius: 99px; padding: .1rem .55rem; font-size: .8rem; text-decoration: none; white-space: nowrap; }
.file-menu { position: relative; display: inline-block; }
.file-menu-pop { right: 0; left: auto; top: 100%; bottom: auto; text-align: left; }
.file-menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: .25rem 0; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.file-tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; display: grid; overflow: visible; }
.file-tile:hover { border-color: #b9c2cc; }
.file-tile-img { aspect-ratio: 4 / 3; display: grid; place-items: center; background: #f3f5f7; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.file-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.file-tile-img .folder-icon { width: 54px; height: 54px; }
.file-ext { font-weight: 700; color: var(--ink-soft); font-size: 1.1rem; }
.file-tile-text { padding: .5rem .6rem; display: grid; gap: .1rem; min-width: 0; }
.file-tile-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.file-tile-text span { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tile-menu { position: absolute; top: .3rem; right: .3rem; background: rgba(255, 255, 255, .9); border-radius: 6px; }
.trash-row { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 820px) { .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tpl-tree, .tpl-children { display: grid; gap: .35rem; }
.tpl-children { margin: .35rem 0 0 1.6rem; border-left: 2px solid var(--line); padding-left: .7rem; }
.tpl-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tpl-row input { flex: 1 1 200px; }
ul.plain.tpl-children { margin: .35rem 0 0 1.6rem; padding-left: .7rem; border-left: 2px solid var(--line); }
.move-tree { max-height: 55vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: .3rem; gap: 0; }
.move-tree ul.plain { gap: 0; }
.move-row { display: flex; align-items: center; gap: .45rem; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; min-height: 40px; }
.move-row:hover { background: #f3f5f7; }
.move-here { opacity: .6; cursor: default; }
.move-row .folder-icon { width: 18px; height: 18px; }
.move-row input[type=radio] { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; padding: 0; }
.move-row span:not(.muted) { flex: 1; }

/* Customer Relation System */
.client-picker { display: grid; gap: .4rem; }
.client-picker .actions input { flex: 1; min-width: 12rem; }
.client-picker .picked { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pick-list { border: 1px solid var(--line); border-radius: var(--radius); max-height: 16rem; overflow: auto; background: var(--surface); }
.pick-list .pick-row { width: 100%; text-align: left; }
.card-row-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

/* Suppliers & Trades: insurance certificates */
.cert-list { display: grid; gap: .6rem; }
.cert-row { display: grid; grid-template-columns: minmax(12rem, 16rem) 1fr; gap: .4rem 1rem; align-items: end; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.cert-file { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; min-height: 40px; }
.cert-file a { word-break: break-all; }
@media (max-width: 700px) { .cert-row { grid-template-columns: 1fr; align-items: start; } }

/* Insurance & licences (Compliance) */
.compliance-panel { display: grid; gap: .6rem; }
.compliance-sub { margin: .6rem 0 .2rem; font-size: .95rem; }
.compliance-table td { vertical-align: top; }
.compliance-table tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad, #b42318); }
.compliance-history li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; justify-self: start; }
.worker-warning { color: var(--bad, #b42318); font-size: .85rem; }
@media (max-width: 700px) {
  .compliance-table thead { display: none; }
  .compliance-table tr { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .compliance-table td { border: 0; padding: 0; }
  .compliance-table td:first-child { grid-column: 1 / -1; }
}
.small-note { font-size: .82rem; margin-top: .2rem; }

/* Admin → Contract */
.contract-reminders { display: grid; gap: .35rem; }
.reminder { border-radius: var(--radius); padding: .55rem .8rem; font-size: .92rem; }
.reminder-bad { background: var(--bad-soft); color: var(--bad); }
.reminder-warn { background: #fff4e0; color: #8a5a00; }
.contract-file-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.contract-file-groups h3 { font-size: .95rem; margin: 0 0 .4rem; }
.contract-files { display: grid; gap: .4rem; justify-items: start; }

/* Directory → Projects: extra access */
.access-person { padding: .6rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .4rem; }
.access-row { display: grid; grid-template-columns: 1fr minmax(9rem, 12rem); align-items: center; gap: .6rem; }
.access-row select { max-width: 12rem; }

/* Schedule: predecessors and Gantt */
.pred-box { display: grid; gap: .45rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; background: var(--page); }
.pred-head .muted { font-size: .85rem; }
.pred-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: .5rem; align-items: center; }
.pred-lag { display: flex; align-items: center; gap: .3rem; white-space: nowrap; font-size: .9rem; }
.pred-lag input { width: 4.5rem; }
@media (max-width: 700px) { .pred-row { grid-template-columns: 1fr; } }
.gantt { display: grid; gap: .5rem; }
.gantt-tools { flex-wrap: wrap; }
.gantt-frame { display: grid; grid-template-columns: minmax(9rem, 15rem) 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gantt-names { border-right: 1px solid var(--line); min-width: 0; }
.gantt-head-cell { height: 46px; display: flex; align-items: flex-end; padding: 0 .6rem .4rem; font-size: 14px; font-weight: 500; color: var(--ink); border-bottom: 1px solid var(--line); }
.gantt-name { display: flex; align-items: center; gap: .35rem; width: 100%; height: 36px; padding: 0 .6rem; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; font-size: .88rem; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.gantt-name:hover { background: var(--brand-soft); }
.gantt-scroll { overflow-x: auto; }
.gantt-canvas { position: relative; }
.gantt-months, .gantt-days { position: relative; height: 23px; border-bottom: 1px solid var(--line); font-size: .72rem; color: var(--ink-soft); }
.gantt-months span { position: absolute; top: 4px; padding-left: 4px; white-space: nowrap; font-weight: 600; color: var(--ink); border-left: 1px solid var(--line); }
.gantt-days span { position: absolute; top: 4px; text-align: center; }
.gantt-off-label { color: #a0a8b2; }
.gantt-body { position: relative; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, var(--line) 35px, var(--line) 36px); }
.gantt-off { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, #f1f3f5 0 4px, #e9ecef 4px 8px); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .6; }
.gantt-bar { position: absolute; height: 22px; border: 0; border-radius: 5px; background: color-mix(in srgb, var(--bar) 35%, white); cursor: pointer; padding: 0; overflow: hidden; text-align: left; font: inherit; }
.gantt-fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); opacity: .9; }
.gantt-label { position: relative; padding: 0 .4rem; font-size: .75rem; line-height: 22px; white-space: nowrap; color: #111; font-weight: 600; }
.gantt-bar-done { opacity: .55; }
.gantt-bar-late { outline: 2px solid var(--bad); }
.gantt-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.gantt-arrow { fill: none; stroke: #5b6673; stroke-width: 1.4; }
.gantt-arrow-head { fill: #5b6673; }
.weather-place { display: grid; gap: .4rem; }
.weather-place .actions input { flex: 1; min-width: 10rem; }
.weather-fill .muted { font-size: .85rem; }
.note-good { background: var(--good-soft); color: var(--good); }
.reset-code { font-size: 2rem; font-weight: 700; letter-spacing: .15em; text-align: center; font-variant-numeric: tabular-nums; margin: .5rem 0; padding: .8rem; background: var(--page); border-radius: var(--radius); }
.gantt-bar-drag { cursor: grab; }
.gantt-bar-dragging { cursor: grabbing; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); z-index: 2; }
.gantt-grip { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: ew-resize; background: linear-gradient(to right, transparent 3px, rgba(0, 0, 0, .25) 3px, rgba(0, 0, 0, .25) 5px, transparent 5px); }
.gantt-arrow-ss, .gantt-arrow-ff { stroke-dasharray: 4 3; }
.gantt-bar { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.gantt-bar-drag { touch-action: pan-x pan-y; }
@media (max-width: 820px) { .gantt-grip { width: 18px; background: linear-gradient(to right, transparent 8px, rgba(0, 0, 0, .3) 8px, rgba(0, 0, 0, .3) 11px, transparent 11px); } }
@media (max-width: 820px) { .gantt-frame { grid-template-columns: 7.5rem 1fr; } .gantt-name { font-size: .8rem; padding: 0 .4rem; } }
/* Gantt table beside the bars (item, start, working days, +) */
.gantt-frame { grid-template-columns: clamp(14rem, 34%, 24rem) 1fr; }
.gantt-row { display: grid; grid-template-columns: minmax(0, 1fr) 3.4rem 2.4rem 1.8rem; align-items: center; height: 36px; border-bottom: 1px solid var(--line); }
.gantt-row .gantt-name { border-bottom: 0; height: 35px; }
.gantt-row.gantt-head-cell { height: 46px; align-items: end; padding: 0 0 .4rem .6rem; }
.gantt-col { font-size: .8rem; color: var(--ink-soft); text-align: right; padding-right: .4rem; }
.gantt-num { font-variant-numeric: tabular-nums; }
.gantt-add { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; }
.gantt-add:hover { filter: brightness(1.15); }
.gantt-row-critical .gantt-name { color: var(--bad); font-weight: 600; }
.gantt-progress { position: absolute; bottom: -1px; width: 0; height: 0; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #1f2933; cursor: ew-resize; opacity: 0; }
.gantt-bar:hover .gantt-progress, .gantt-bar-dragging .gantt-progress { opacity: .85; }
.gantt-progress::before { content: ''; position: absolute; left: -9px; top: -10px; width: 18px; height: 18px; }
.gantt-link-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #5b6673; background: #fff; cursor: crosshair; opacity: .35; z-index: 3; }
.gantt-link-dot:hover, .gantt-linking .gantt-link-dot { opacity: 1; }
.gantt-drawing { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 5 3; }
.gantt-arrow-hit { fill: none; stroke: transparent; stroke-width: 10; pointer-events: stroke; cursor: pointer; }
.gantt-arrow-hit:hover { stroke: rgba(185, 28, 28, .18); }
.gantt-bar-critical { box-shadow: 0 0 0 2px var(--bad); }
.gantt-arrow-critical { stroke: var(--bad); stroke-width: 2; }
.gantt-arrow-head-critical { fill: var(--bad); }
.gantt-hint { flex: 1 1 100%; font-size: .85rem; }
@media (max-width: 820px) {
  .gantt-frame { grid-template-columns: 7.5rem 1fr; }
  .gantt-row { grid-template-columns: minmax(0, 1fr); }
  .gantt-row .gantt-col { display: none; }
  .gantt-progress { opacity: .7; border-left-width: 7px; border-right-width: 7px; border-bottom-width: 9px; margin-left: -7px; }
}
/* Site induction */
.induction-point { align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.induction-point input { margin-top: .2rem; }
.induction-card { padding: .7rem .8rem; }
.induction-read { margin: 0; padding-left: 1.3rem; display: grid; gap: .25rem; }
/* OHS site checks */
.check-form { display: grid; gap: .6rem; }
.check-section { display: grid; gap: .1rem; }
.check-q { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.check-q-bad { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.check-q-text { font-size: .93rem; }
.check-note, .check-note-read, .check-controls { grid-column: 1 / -1; }
.check-note-read { color: var(--bad); font-size: .9rem; }
.check-controls { margin: 0; padding-left: 1.2rem; font-size: .88rem; color: var(--ink-soft); }
.check-answers button { min-width: 3.2rem; }
.check-new { flex-wrap: wrap; margin-bottom: .6rem; }
.check-row { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.check-row:hover { background: var(--brand-soft); }
.tpl-item { display: grid; gap: .3rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); }
.tpl-item-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: .4rem; align-items: center; }
@media (max-width: 700px) {
  .check-q { grid-template-columns: 1fr; }
  .check-answers button { min-width: 4.2rem; min-height: 2.6rem; }
  .tpl-item-row { grid-template-columns: 1fr 1fr; }
}
.check-q > .badge { justify-self: start; }
.ohs-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .6rem; }
.ohs-stats > div { display: grid; gap: .1rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); }
.ohs-stats strong { font-size: 1.35rem; }
.ohs-stats span { font-size: .8rem; }
/* Toolbox inside Workers on site */
.toolbox-bar { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .7rem; background: var(--page); display: grid; gap: .3rem; }
.toolbox-form { border-top: 0; margin-top: 0; padding-top: 0; }
.briefed { margin-top: .25rem; font-size: .88rem; }
.swms-trade { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.swms-trade .field { flex: 1 1 14rem; }
