/* Morrisett Builders project portal */
:root {
  --canvas: #f3f2ee;
  --panel: #fffdf9;
  --panel-2: #ebe9e3;
  --line: #dcd9d0;
  --line-strong: #8f8c83;
  --ink: #1d2427;
  --ink-2: #444d51;
  --ink-3: #5f676a;
  --accent: #24566b;
  --accent-hover: #1a4253;
  --accent-soft: #dce8ec;
  --on-accent: #ffffff;
  --ok: #2c6a3c;
  --ok-soft: #dfede2;
  --warn: #855600;
  --warn-soft: #f5e8cc;
  --bad: #a1372a;
  --bad-soft: #f6e0db;
  --shadow: 0 1px 2px rgba(29, 36, 39, .06), 0 6px 20px rgba(29, 36, 39, .06);
  --radius: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #15191b;
    --panel: #1d2326;
    --panel-2: #262d31;
    --line: #333c40;
    --line-strong: #6d777b;
    --ink: #ecebe6;
    --ink-2: #c3c6c3;
    --ink-3: #9da4a5;
    --accent: #5fa3bb;
    --accent-hover: #7ab6cb;
    --accent-soft: #1f3a45;
    --on-accent: #0e1a1f;
    --ok: #7cc28d;
    --ok-soft: #1d3324;
    --warn: #e2b155;
    --warn-soft: #3a2f17;
    --bad: #ec8b7c;
    --bad-soft: #3d221e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; overflow-x: clip;
  background: var(--canvas); color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.mono { font-family: var(--mono); font-weight: 500; font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.block { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bad-text { color: var(--bad); font-weight: 500; }
.loading { padding: 64px 20px; text-align: center; color: var(--ink-3); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease), color .18s var(--ease);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: currentColor; }
.btn.danger.ghost:hover { background: var(--bad-soft); }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.sm { min-height: 40px; } }

/* ───────── Chips, badges ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--panel-2); color: var(--ink-2);
}
.chip.s-done, .chip.co-approved, .chip.sel-approved, .chip.st-complete { background: var(--ok-soft); color: var(--ok); }
.chip.s-in_progress, .chip.st-active, .chip.sel-submitted { background: var(--accent-soft); color: var(--accent); }
.chip.s-delayed, .chip.co-pending, .chip.st-on_hold, .chip.sel-needed { background: var(--warn-soft); color: var(--warn); }
.chip.co-declined { background: var(--bad-soft); color: var(--bad); }
.chip.internal { background: var(--ink); color: var(--canvas); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 700;
}

/* ───────── Demo bar and header ───────── */
.demo-bar {
  display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 7px 16px; background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center;
}
.demo-bar .link { color: inherit; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--canvas) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
/* The full logo (LOGO_PIC in app.js), shrinking a little if the bar is tight, then "Project portal" beside it. */
.brand-logo { display: block; flex: 0 1 auto; min-width: 0; line-height: 0; }
.brand-logo img { display: block; width: 156px; max-width: 100%; height: auto; }
.brand-tag { flex: none; padding-left: 10px; border-left: 1px solid var(--line); color: var(--ink-3); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.me { display: flex; align-items: center; gap: 10px; }
.top-in .brand { margin-right: auto; min-width: 0; }
/* The team's two sections, Project Management and Administrative, right after the logo. */
.top-in .brand:has(+ .mode-switch) { margin-right: 0; }
.mode-switch { display: flex; gap: 2px; margin-right: auto; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.mode-switch .mode { padding: 7px 14px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.mode-switch .mode:hover { color: var(--ink); }
.mode-switch .mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mode-switch .mode.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
/* Tablets: "Project portal" beside the logo drops off to make room. Phones: the two buttons get their own row. */
@media (max-width: 1023px) {
  .top-in:has(.mode-switch) .brand-tag { display: none; }
}
@media (max-width: 900px) {
  .top-in:has(.mode-switch) .me-text { display: none; }
}
@media (max-width: 700px) {
  .top-in:has(.mode-switch) { flex-wrap: wrap; row-gap: 8px; }
  .top-in .brand:has(+ .mode-switch) { flex: 1 1 0; min-width: 0; margin-right: 0; }
  .mode-switch { order: 3; width: 100%; margin: 0; }
  .mode-switch .mode { flex: 1; text-align: center; padding: 8px 6px; }
}
/* ───────── Project sidebar ─────────
   Wide screens: a column on the left that stays in place while the page scrolls, shown or hidden with the
   button at the left of the top bar. Phones and tablets: it slides in over the page. */
.top.has-side .top-in { max-width: none; }
.side-toggle { flex: none; width: 38px; height: 38px; display: grid; place-items: center; margin-right: -4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink-2); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.side-toggle:hover { background: var(--panel-2); color: var(--ink); }
.side-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.side-toggle svg, .side-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.layout.with-side.side-open { display: grid; grid-template-columns: 272px minmax(0, 1fr); align-items: start; }
.layout.with-side:not(.side-open) .side { display: none; }
.side {
  position: sticky; top: var(--top-h, 60px); height: calc(100dvh - var(--top-h, 60px));
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px 10px 14px 14px;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--panel-2) 35%, var(--canvas));
}
/* The team's pages, at the top of the sidebar. */
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 12px 0; border-bottom: 1px solid var(--line); }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color .12s var(--ease), color .12s var(--ease); }
.side-link svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-link:hover { background: var(--panel-2); color: var(--ink); }
.side-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-admin .side-nav { border-bottom: 0; }
.side-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 6px; }
.side-head .sp { flex: 1; }
.side-all { color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none; }
.side-all:hover { color: var(--accent); }
.side-count { padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--ink-3); font: 600 12px/1.5 var(--mono); }
.side-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink-3); cursor: pointer; }
.side-btn svg { width: 17px; height: 17px; }
.side-btn:hover { background: var(--panel-2); color: var(--ink); }
.side-find { width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; }
.side-find:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.side-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 4px 0 0; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.side-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; transition: background-color .12s var(--ease); }
.side-item:hover { background: var(--panel-2); }
.side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-item.on { background: var(--accent-soft); }
.side-item.on b { color: var(--accent); }
.side-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--line-strong); }
.side-dot.st-active { background: var(--accent); }
.side-dot.st-on_hold { background: var(--warn); }
.side-dot.st-complete { background: var(--ok); }
.side-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-name b { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.side-name small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-star { flex: none; margin-top: 1px; color: var(--warn); font-size: 12px; }
.side-none { padding: 4px 8px; }
.side-scrim { display: none; }
@media (max-width: 1023px) {
  .layout.with-side.side-open { display: block; }
  .layout.with-side .side, .layout.with-side:not(.side-open) .side {
    display: flex; position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw); height: auto;
    padding-top: 16px; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    transform: translateX(-102%); visibility: hidden; transition: transform .25s var(--ease), visibility 0s linear .25s;
  }
  .layout.drawer-open .side, .layout.drawer-open:not(.side-open) .side { transform: none; visibility: visible; transition: transform .25s var(--ease); }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 22, 25, .4); opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
  .layout.drawer-open .side-scrim { opacity: 1; pointer-events: auto; }
}
/* The team's slim strip of page icons (each named when you point at it): on wide screens while the sidebar is
   hidden, and on tablets all the time, with the button opening the full sidebar over the page. Phones use the button only. */
@media (min-width: 1024px) {
  .layout.with-side.has-nav:not(.side-open) { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: start; }
  .layout.with-side.has-nav:not(.side-open) .side { display: flex; align-items: center; padding: 14px 8px; }
  .layout.with-side.has-nav:not(.side-open) .side > :not(.side-nav) { display: none; }
  .layout.with-side.has-nav:not(.side-open) .side-nav { padding: 0; border: 0; }
  .layout.with-side.has-nav:not(.side-open) .side-link { justify-content: center; padding: 10px; }
  .layout.with-side.has-nav:not(.side-open) .side-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 761px) and (max-width: 1023px) {
  .layout.with-side.has-nav { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: start; }
  .layout.with-side.has-nav > main { grid-column: 2; }
  .layout.with-side.has-nav:not(.drawer-open) .side {
    position: sticky; inset: auto; top: var(--top-h, 60px); z-index: auto; width: auto; height: calc(100dvh - var(--top-h, 60px));
    align-items: center; padding: 14px 8px; transform: none; visibility: visible; box-shadow: none; transition: none;
    background: color-mix(in srgb, var(--panel-2) 35%, var(--canvas));
  }
  .layout.with-side.has-nav:not(.drawer-open) .side > :not(.side-nav) { display: none; }
  .layout.with-side.has-nav:not(.drawer-open) .side-nav { padding: 0; border: 0; }
  .layout.with-side.has-nav:not(.drawer-open) .side-link { justify-content: center; padding: 10px; }
  .layout.with-side.has-nav:not(.drawer-open) .side-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 760px) {
  .top-in .me { flex: none; }
}
/* Billable Hours: the Person and Period drop-downs, side by side at the top right (stacked full width on phones). */
.hrs-picks { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.hrs-person { min-width: 220px; }
.hrs-period { min-width: 180px; }
@media (max-width: 640px) {
  .hrs-picks { width: 100%; }
  .hrs-picks .field { flex: 1 1 100%; min-width: 0; }
}
.tabs button.tab { border: 0; background: none; font: inherit; font-weight: 550; font-size: 14.5px; cursor: pointer; }
.tabs button.tab:focus-visible { outline: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent-soft); border-radius: 8px 8px 0 0; }
.tab-count { margin-left: 7px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; font-weight: 500; }
.tab.on .tab-count { background: var(--accent-soft); color: var(--accent); }
/* A manager's Notes: one block per project, in two columns on wide screens. */
.pm-notes { padding: 18px 22px; }
.pm-notes header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.pm-notes h2 { font-size: 22px; }
.pm-notes-cols { columns: 2 340px; column-gap: 36px; }
.pm-note { break-inside: avoid; margin-bottom: 22px; }
.pm-note-head { font-weight: 650; margin: 0 0 6px; }
.pm-total { margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 700; }
.pm-note ul { margin: 0; padding-left: 4px; display: flex; flex-direction: column; gap: 4px; }
.pm-note li { line-height: 1.45; }
.pm-note li .mono { color: var(--ink); font-weight: 600; margin-right: 4px; }
.pm-notes-tip { margin: -6px 0 14px; }
.pm-note li { display: flex; align-items: flex-start; gap: 6px; list-style: none; }
.pm-note li::before { content: "•"; flex: none; padding-top: 2px; color: var(--ink); }
.pm-note li .mono { flex: none; padding-top: 3px; white-space: nowrap; }
.pm-note-input { flex: 1; min-width: 0; resize: none; overflow: hidden; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; line-height: 1.45; padding: 2px 6px; margin: -1px 0; }
.pm-note-input:hover { border-color: var(--line); }
.pm-note-input:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.pm-note-input.edited { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
/* A line of hand-entered hours (like Paul Morrisett's): click to change or delete it. */
.pm-note-entry { flex: 1; min-width: 0; text-align: left; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; line-height: 1.45; padding: 2px 6px; margin: -1px 0; cursor: pointer; overflow-wrap: anywhere; }
.pm-note-entry:hover { border-color: var(--line); }
.pm-note-entry:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Add hours: a row per project (Project, Hours, ×), with its note underneath. */
.mh-rows { display: flex; flex-direction: column; gap: 10px; }
.mh-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 36px; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.mh-row [name=mh_note] { grid-column: 1 / -1; }
.mh-row .mh-del[hidden] { display: inline-block; visibility: hidden; }
.mh-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mh-total { font-size: 14px; }
.pm-notes .head-btns { align-items: center; }
.me-text { display: flex; flex-direction: column; line-height: 1.15; }
.me-text b { font-weight: 600; font-size: 14px; }
.me-text small { color: var(--ink-3); font-size: 12px; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}

/* ───────── Layout ───────── */
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head, .sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head { margin-bottom: 24px; }
.sec-head { margin-bottom: 18px; }
.sec-head p { margin-top: 4px; max-width: 62ch; }
.eyebrow, .label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.eyebrow { margin-bottom: 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card .h { font-size: 16px; margin-bottom: 14px; }
.card .h:not(:first-child) { margin-top: 22px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.empty { padding: 44px 20px; text-align: center; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); }
.empty b { display: block; font-size: 16px; margin-bottom: 4px; }
.empty p { color: var(--ink-3); max-width: 46ch; margin: 0 auto; }

/* ───────── Dashboard ───────── */
/* Projects page: one row per project. */
.proj-list .proj-row { cursor: pointer; }
.proj-list .proj-row:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.proj-list td { vertical-align: middle; }
.proj-list .proj-name { font-weight: 650; color: var(--ink); text-decoration: none; }
.proj-list .proj-name:hover, .proj-list .proj-name:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.proj-list .proj-addr { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
/* Favorites: a star in front of each project. Starred projects stay at the top. */
.proj-list .proj-cell { display: flex; align-items: flex-start; gap: 8px; }
.fav-btn { flex: none; width: 30px; height: 30px; margin: -4px 0 0 -6px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: 19px; line-height: 1; cursor: pointer; transition: color .18s var(--ease), background-color .18s var(--ease), transform .18s var(--ease); }
.fav-btn:hover { color: var(--warn); background: var(--panel-2); }
.fav-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.fav-btn.on { color: #d4a017; }
.fav-btn:active { transform: scale(.9); }
@media (pointer: coarse) { .fav-btn { width: 40px; height: 40px; } }
.proj-list .proj-prog { display: inline-flex; align-items: center; gap: 8px; }
.proj-list .proj-prog .meter { width: 70px; flex: none; }
.proj-list .proj-prog .mono { min-width: 38px; text-align: right; }
.proj-list .flags { margin: 0; }
.proj-list th, .proj-list td { white-space: nowrap; }
.proj-list td:first-child { white-space: normal; min-width: 170px; }
.proj-list td.col-phase, .proj-list td.col-owner { white-space: normal; min-width: 110px; }
.proj-list .flags { flex-direction: column; align-items: flex-start; }
.proj-list .proj-sm { display: none; }
@media (max-width: 760px) {
  .proj-list .col-phase, .proj-list .col-owner, .proj-list .col-target, .proj-list .col-status, .proj-list .col-flags { display: none; }
  .proj-list .proj-sm { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .proj-list .proj-sm .flags { flex-direction: row; flex-wrap: wrap; }
  .proj-list .proj-prog .meter { width: 56px; }
}
.meter { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.sm { height: 6px; width: 64px; }
.mini { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 0 0; }
.mini div { min-width: 0; }
.mini dt { font-size: 12px; color: var(--ink-3); }
.mini dd { margin: 0; font-weight: 500; font-size: 14px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.flag { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
/* On the Projects list the tags are links to their tab. */
a.flag { text-decoration: none; transition: box-shadow .15s var(--ease); }
a.flag:hover { box-shadow: inset 0 0 0 1px currentColor; text-decoration: underline; text-underline-offset: 2px; }
a.flag:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── Project header and tabs ───────── */
.proj-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.proj-head p { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; text-decoration: none; }
.back::before { content: "←"; }
.ring {
  --p: 0; flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--panel-2) 0);
}
.ring > span { width: 74px; height: 74px; border-radius: 50%; background: var(--canvas); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.ring b { font-size: 20px; font-weight: 700; }
.ring small { font-size: 11px; color: var(--ink-3); }
.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -24px 24px; padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; padding: 12px 14px; white-space: nowrap;
  color: var(--ink-2); font-weight: 550; font-size: 14.5px; text-decoration: none;
  transition: color .18s var(--ease);
}
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { transform: scaleX(1); }
.panel { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ───────── Overview ───────── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat b { font-size: 19px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.stat small { color: var(--ink-3); font-size: 12.5px; }
.stat.bad b { color: var(--bad); }
.stats.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* The phase strip: the build at a glance. */
.strip {
  list-style: none; margin: 0 0 22px; padding: 18px 18px 14px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); gap: 6px;
  overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.seg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.seg-bar { height: 12px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); }
.seg.s-done .seg-bar { background: var(--accent); border-color: var(--accent); }
.seg.s-in_progress .seg-bar {
  border-color: var(--accent);
  background: repeating-linear-gradient(-45deg, var(--accent) 0 6px, var(--accent-soft) 6px 12px);
  background-size: 17px 17px;
  animation: march 1.8s linear infinite;
}
.seg.s-delayed .seg-bar { border-color: var(--warn); background: repeating-linear-gradient(-45deg, var(--warn) 0 6px, var(--warn-soft) 6px 12px); }
@keyframes march { to { background-position: 17px 0; } }
.seg-n { font-size: 11px; color: var(--ink-3); }
.seg-name { font-size: 12.5px; line-height: 1.25; color: var(--ink-2); }
.seg.s-in_progress .seg-name, .seg.s-delayed .seg-name { color: var(--ink); font-weight: 600; }

.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attn-item {
  display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border-radius: 9px;
  background: var(--canvas); border-left: 3px solid var(--accent); color: var(--ink); text-decoration: none;
  transition: background-color .18s var(--ease);
}
.attn-item:hover { background: var(--panel-2); }
.attn-item.warn { border-left-color: var(--warn); }
.attn-item.bad { border-left-color: var(--bad); }
.attn-item b { font-weight: 600; font-size: 14px; }
.attn-item small { color: var(--ink-3); }
.more { display: inline-block; margin-top: 12px; font-weight: 600; font-size: 14px; }

/* ───────── Schedule ───────── */
.sched { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sched-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) 150px minmax(160px, 2fr); gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.sched.staff .sched-row { grid-template-columns: minmax(180px, 1.3fr) 150px minmax(160px, 2fr) 170px; }
.sched-row:first-child { border-top: 0; }
.sched-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sched-name b { font-weight: 600; }
.note-line { color: var(--warn); }
.sched-row .chip { justify-self: start; }
.track { position: relative; height: 14px; border-radius: 4px; background: var(--panel-2); }
.bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--line-strong); }
.bar.s-done { background: var(--accent); }
.bar.s-in_progress { background: repeating-linear-gradient(-45deg, var(--accent) 0 5px, color-mix(in srgb, var(--accent) 55%, transparent) 5px 10px); }
.bar.s-delayed { background: var(--warn); }
.now { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.row-act { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Gantt predecessors */
.sched { position: relative; }
.ms-n { display: inline-block; min-width: 2ch; margin-right: 4px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.sched-name .after { color: var(--ink-3); font-size: 12.5px; }
.sched-name .after span { white-space: nowrap; }
.conflict-line { color: var(--bad); font-size: 12.5px; font-weight: 500; }
.conflict-line .link { color: inherit; font-size: inherit; }
.bar.conflict { box-shadow: 0 0 0 2px var(--bad); }
.links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.links path { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linejoin: round; opacity: .75; }
.links path.bad { stroke: var(--bad); opacity: 1; }

/* Gantt month axis */
.sched-axis { padding-top: 10px; padding-bottom: 6px; background: var(--canvas); }
.axis { position: relative; height: 36px; }
.tick-l, .now-l { position: absolute; top: 0; font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; padding-left: 4px; border-left: 1px solid var(--line-strong); line-height: 18px; }
.now-l { top: 18px; color: var(--ink); font-weight: 600; border-left: 2px solid var(--ink); transform: translateX(-1px); }
.tick { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--line); }

/* ───────── Schedule: calendar views ───────── */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-nav { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal > .cal-nav:only-child { border-bottom: 0; }
.cal-nav-btns { display: flex; gap: 4px; }
.cal-nav-btns .btn[aria-label] { font-size: 18px; width: 34px; padding: 0; }
.cal-title { flex: 1; min-width: 0; font-size: 17px; }
.cal-jump input { min-height: 32px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--ink); }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-dow span { padding: 8px 10px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.cal-week { --lane: 24px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 3px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cal-month .cal-week { min-height: 120px; }
.cal-detail .cal-week { min-height: 360px; --lane: 28px; }
.cal-bg { position: relative; display: block; padding: 0; margin: 0; border: 0; border-left: 1px solid var(--line); background: transparent; font: inherit; color: inherit; }
.cal-bg.add { cursor: pointer; transition: background-color .18s var(--ease); }
.cal-bg.add:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.cal-bg.add::after {
  content: "+ Add phase"; position: absolute; right: 6px; bottom: 6px;
  padding: 2px 7px; border-radius: 6px; background: var(--panel); color: var(--accent);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity .18s var(--ease);
}
.cal-bg.add:hover::after { opacity: 1; }
.ag-add { font-size: 13.5px; }
.day-add { margin-top: 14px; }
.cal-bg:first-child { border-left: 0; }
.cal-bg.out { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.cal-bg.today { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.cal-day {
  position: relative; z-index: 1; justify-self: start; display: flex; align-items: baseline; gap: 6px;
  margin: 6px 6px 2px; padding: 2px 6px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  color: var(--ink-2); font-weight: 600; font-size: 13px;
  transition: background-color .18s var(--ease);
}
.cal-day:hover { background: var(--panel-2); color: var(--ink); }
.cal-day.out { color: var(--ink-3); }
.cal-day .dow { font-family: var(--mono); font-size: 11px; text-transform: uppercase; font-weight: 500; color: var(--ink-3); }
.cal-day.today .dnum { background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 0 7px; }
.cal-detail .cal-day { flex-direction: column; align-items: flex-start; gap: 0; margin: 8px 6px 4px; }
.cal-detail .cal-day .dnum { font-size: 20px; line-height: 1.2; }
.cal-bar {
  position: relative; z-index: 1; display: block; min-width: 0; height: var(--lane); margin: 0 4px; padding: 0 8px;
  border: 0; border-radius: 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 600 12px/var(--lane) var(--font);
  background: var(--panel-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.cal-bar.s-done { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.cal-bar.s-in_progress { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-bar.s-delayed { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.cal-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
button.cal-bar { cursor: grab; user-select: none; -webkit-user-select: none; transition: opacity .18s var(--ease); }
button.cal-bar:hover { opacity: .85; }
@media (pointer: coarse) { button.cal-bar { cursor: pointer; } }

/* Dragging a phase */
body.dragging-phase, body.dragging-phase * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
body.dragging-phase .cal-bg.add::after { display: none; }
.cal-bar.drag-src { opacity: .4; }
.cal-bg.drop { background: color-mix(in srgb, var(--accent) 24%, transparent) !important; }
.cal-bg.drop-start { box-shadow: inset 3px 0 0 var(--accent); }
.drag-tip {
  position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--canvas);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.cal-items { position: relative; z-index: 1; align-self: start; list-style: none; margin: 2px 0 0; padding: 0 5px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev {
  display: flex; align-items: flex-start; gap: 6px; width: 100%; min-width: 0; padding: 2px 4px;
  border: 0; border-radius: 5px; background: none; cursor: pointer; text-align: left; text-decoration: none;
  font-size: 12px; line-height: 1.35; color: var(--ink);
  transition: background-color .18s var(--ease);
}
.ev:hover { background: var(--panel-2); }
.ev-dot { display: inline-block; width: 7px; height: 7px; margin-top: 5px; flex: none; border-radius: 50%; background: var(--accent); }
.ev-sel .ev-dot { background: var(--warn); }
.ev-log .ev-dot { background: var(--ok); }
.ev-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev small { display: block; color: var(--ink-3); font-size: 11.5px; }
.ev.done .ev-t { text-decoration: line-through; color: var(--ink-3); }
.ev.more { color: var(--ink-3); padding-left: 17px; }
.cal-detail .ev-t { white-space: normal; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .ev-dot { margin: 0; }
.legend .legend-tip { margin-left: auto; font-style: italic; }
@media (pointer: coarse) { .legend .legend-tip { display: none; } }
.lg-bar { display: inline-block; width: 18px; height: 9px; border-radius: 3px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.lg-bar.s-done { background: var(--accent); box-shadow: none; }
.lg-bar.s-in_progress { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.agenda { display: none; list-style: none; margin: 0; padding: 0; }
.ag-day { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); }
.ag-day:first-child { border-top: 0; }
.ag-day.today { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.ag-head { padding: 0; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--ink); text-align: left; }
.ag-phases { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-day .cal-items { width: 100%; padding: 0; }

/* Daily view */
.day-grid { margin-top: 16px; }
.day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.day-phase { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 9px; background: var(--canvas); }
.day-phase > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.next-up { margin-top: 12px; font-size: 13.5px; color: var(--ink-3); }
.next-up b { color: var(--ink); font-weight: 600; }
.day-items { padding: 0; }
.day-items .ev { font-size: 14px; padding: 6px 8px; }
.day-items .ev small { font-size: 12.5px; }
.day-items .ev-dot { margin-top: 7px; }
.day-grid .log + .btn, .day-grid p + .btn { margin-top: 12px; }

/* ───────── Budget table ───────── */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 16px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { border-top: 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 500; color: var(--ink-3); }
.tbl tfoot th, .tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tr.over td:nth-child(4) { color: var(--bad); font-weight: 600; }
.used { display: inline-flex; align-items: center; gap: 8px; }
.tr-over .meter > span { background: var(--bad); }
.tbl tr.over .meter > span { background: var(--bad); }

/* ───────── Change orders ───────── */
.co-list { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.co { display: flex; flex-direction: column; gap: 10px; }
.co header, .co footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.co footer { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.co.co-pending { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.co.co-draft { border-style: dashed; border-color: var(--line-strong); }
.co p { color: var(--ink-2); max-width: 65ch; }
.co-num { font-size: 15px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.chip.co-draft { background: var(--panel-2); color: var(--ink-2); }
.co-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.co-lines > p { padding: 12px 14px; margin: 0; }
.co-lines table { width: 100%; border-collapse: collapse; font-size: 14px; }
.co-lines th, .co-lines td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line); }
.co-lines thead th { border-top: 0; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--canvas); }
.co-lines .num { text-align: right; white-space: nowrap; }
.co-lines td.num small { display: block; color: var(--ink-3); font-size: 11.5px; }
.co-scroll { overflow-x: auto; }
/* A line item's file: its name to open it, and (for the team) who can see it, with Share, Replace, and Remove. */
.co-lines td.li-file-cell { min-width: 150px; max-width: 240px; }
.li-attach { gap: 6px; white-space: nowrap; }
.clip { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.li-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.li-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-file:hover span { text-decoration: underline; text-underline-offset: 3px; }
.li-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.li-file-acts { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 12.5px; }
.li-file-acts .link { font-size: 12.5px; }
.li-shared { color: var(--ok); font-weight: 600; }
.danger-link { color: var(--bad) !important; }
/* Phones: the file goes under the line item's name instead of a column of its own. */
.li-file-inline { display: none; margin-top: 6px; }
@media (max-width: 760px) {
  .co-lines .li-file-cell { display: none; }
  .li-file-inline { display: block; }
}
.co-line-edit { cursor: pointer; }
.co-line-edit:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.co-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--canvas); }
.co-add input { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }
.co-add input[name=line] { flex: 1 1 220px; min-width: 0; }
.co-add input[name=price] { width: 140px; text-align: right; }
.co-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.co-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line-strong); font-weight: 600; }
.co-total b { font-size: 16px; }
.co-lines th.li-decision, .co-lines td.li-decision { text-align: right; white-space: nowrap; width: 1%; }
.li-btns { display: inline-flex; gap: 6px; }
.li-btns .btn { min-height: 30px; padding: 0 10px; }
.co-lines tr.li-declined td:not(.li-decision) { color: var(--ink-3); }
.co-lines tr.li-declined .li-price { text-decoration: line-through; }
.co-lines tr.li-approved .li-price { color: var(--ok); font-weight: 600; }
.co-approved-total { border-top: 1px solid var(--line); font-weight: 600; color: var(--ok); }
.co-approved-total small { font-weight: 400; }
.co-lines > p.co-fee-note { max-width: none; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--canvas); color: var(--ink-3); font-size: 12.5px; }
.co-hint { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 500; }
@media (max-width: 520px) {
  .co-add input[name=line] { flex-basis: 100%; }
  .co-add input[name=price] { flex: 1; width: auto; }
}
.sp { flex: 1; }

/* ───────── Invoices ───────── */
.chip.inv-draft { background: var(--panel-2); color: var(--ink-2); }
.chip.inv-sent { background: var(--accent-soft); color: var(--accent); }
.chip.inv-deposit { background: var(--ok-soft); color: var(--ok); }
.inv-list .inv-row { cursor: pointer; }
.inv-list .inv-row:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.inv-editor { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.inv-editor .back { margin-bottom: -6px; }
.inv-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-title h2 { font-family: var(--mono); font-weight: 600; }
/* An invoice on its own page (from the Invoices page): the job it's for, just under its name. */
.inv-job { margin: -12px 0 0; }
.inv-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 12px; }
.inv-dates { margin: 0; }
.inv-part { padding: 18px 18px 6px; }
.inv-part .h { margin-bottom: 6px; }
.inv-part > p.muted { margin-bottom: 10px; }
.inv-scroll { overflow-x: auto; margin: 0 -18px; }
.tbl.inv-tbl { font-size: 14px; }
.tbl.inv-tbl td, .tbl.inv-tbl th { padding: 8px 12px; }
.tbl.inv-tbl th:first-child, .tbl.inv-tbl td:first-child { padding-left: 18px; }
.tbl.inv-tbl th:last-child, .tbl.inv-tbl td:last-child { padding-right: 18px; }
.inv-sec-row th { background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13.5px; text-transform: none; letter-spacing: 0; font-family: var(--font); }
.inv-sec-row.after th { background: var(--panel-2); color: var(--ink-2); }
.inv-sec-row.inv-co-head th { background: color-mix(in srgb, var(--warn-soft) 70%, var(--panel)); color: var(--warn); }
.inv-sec-row small { font-weight: 400; }
.inv-tbl td.inv-pct { color: var(--ink-2); white-space: nowrap; min-width: 84px; }
/* Earlier invoices: one column each, quieter than this invoice. */
.inv-tbl td.inv-prev { color: var(--ink-2); white-space: nowrap; }
.inv-tbl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
/* The amount on an invoice line: looks like a box, opens the charges window. */
.inv-amt-btn { display: inline-flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 1px; width: 132px; min-height: 34px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--ink); font: inherit; text-align: right; cursor: pointer; transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.inv-amt-btn:hover { border-color: var(--accent); }
.inv-amt-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inv-amt-val { font-family: var(--mono); font-weight: 500; font-size: .95em; }
.inv-amt-val.ph { color: var(--ink-3); }
.inv-amt-n { font-size: 11.5px; color: var(--accent); font-weight: 600; line-height: 1.2; }
.inv-chg-link { margin-left: auto; font-family: var(--font); font-size: 12.5px; }
/* With the builder: an invoice the office sent to the job for notes. */
.chip.inv-builder { background: var(--warn-soft); color: var(--warn); }
.inv-builder-tip { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 14px; }
.inv-builder-tip.done { background: var(--ok-soft); }
/* Checked by builder: back with the office, ready to finish. */
.chip.inv-checked { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 35%, transparent); }
.inv-total-btn.is-static { cursor: default; }
.inv-total-btn.is-static:hover { background: none; }
.inv-builder .inv-amt-btn { border-color: transparent; background: none; cursor: pointer; }
.inv-builder .inv-amt-btn:hover { border-color: var(--line-strong); }
.inv-editor input:disabled { color: var(--ink); background: var(--panel-2); opacity: 1; }
/* A line's Total: a button that adds or changes the line's note. A line with a note gets a corner mark,
   like a note on a spreadsheet cell, and shows the note on hover. */
.inv-tbl td.inv-total { position: relative; padding: 0; }
.inv-total-btn { display: flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: right; cursor: pointer; white-space: nowrap; }
.tbl.inv-tbl td.inv-total:last-child .inv-total-btn { padding-right: 18px; }
.inv-total-btn svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; color: var(--ink-3); opacity: 0; transition: opacity .15s var(--ease); }
.inv-total-btn:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.inv-total-btn:hover svg, .inv-total-btn:focus-visible svg, tr.inv-line:hover .inv-total-btn svg { opacity: 1; }
.inv-total-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.inv-builder .inv-total-btn svg { opacity: .55; }
@media (hover: none) { .inv-total-btn svg { opacity: .55; } }
.inv-total.has-note::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent var(--warn) transparent transparent; pointer-events: none; }
.inv-total.has-note .inv-total-btn svg { opacity: 1; color: var(--warn); fill: color-mix(in srgb, var(--warn) 22%, transparent); }
.inv-line-note { margin-top: 2px; font-style: italic; }
/* A line billed past its proposal (or revised) amount: light red, with how much it's over. */
.inv-tbl tr.inv-over td { background: color-mix(in srgb, var(--bad-soft) 72%, transparent); }
.inv-tbl tr.inv-over .inv-amt-btn { background: var(--panel); }
.inv-builder .inv-tbl tr.inv-over .inv-amt-btn { background: none; }
.inv-tbl tr.inv-line > td:nth-child(2) { min-width: 200px; }
.inv-over-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 3px; }
.inv-over-info[hidden] { display: none; }
.inv-over-amt { color: var(--bad); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.inv-revise { font-size: 12.5px; white-space: nowrap; }

/* Adding window: a column of numbers and their total */
.modal.charges { width: min(460px, calc(100vw - 24px)); }
.modal.charges h2 { overflow-wrap: anywhere; }
.chg-code { color: var(--ink-3); margin-right: 2px; }
.chg-intro { margin: -6px 0 0; }
.chg-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.chg-facts div { display: flex; flex-direction: column; gap: 2px; }
.chg-facts dt { color: var(--ink-3); }
.chg-facts dd { margin: 0; font-family: var(--mono); font-weight: 500; }
.chg-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: min(46vh, 420px); overflow: auto; margin: -3px; padding: 3px; }
.chg-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.chg-n { color: var(--ink-3); font-size: 12.5px; text-align: right; }
.chg-row input { width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px 8px 24px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); color: var(--ink); font-family: var(--mono); font-weight: 500; font-size: 16px; text-align: right; }
.chg-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chg-amt-box { position: relative; display: block; }
.chg-amt-box i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink-3); pointer-events: none; }
.chg-row.view { grid-template-columns: 26px minmax(0, 1fr); padding: 8px 0; border-bottom: 1px solid var(--line); text-align: right; }
/* Where a number came from, under it (numbers read from a QuickBooks invoice). */
.chg-note { grid-column: 2 / 3; margin-top: -4px; color: var(--ink-3); font-size: 12.5px; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
/* Under each number when it can be moved: where it came from, and a list of the invoice's other lines. */
.chg-sub { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: -4px; }
.chg-sub .chg-note { flex: 1 1 160px; margin: 0; }
.chg-move { flex: 0 1 auto; max-width: 100%; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background-color: var(--panel); color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chg-move:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chg-move[hidden], .chg-moving[hidden] { display: none; }
.chg-moving { font-size: 13px; color: var(--ink-2); }
.chg-moving .link { margin-left: 4px; font-size: 13px; }
.chg-row.moving .chg-amt-box input { color: var(--ink-3); background: var(--panel-2); text-decoration: line-through; }
.chg-row.moving .chg-del, .chg-row.locked .chg-del { visibility: hidden; }
/* The builder's window: the amounts can be moved, not changed. */
.chg-row.locked .chg-amt-box input { cursor: default; }
.chg-row.locked .chg-amt-box input:focus { border-color: var(--line-strong); box-shadow: none; }
/* A line that just got a charge moved onto it. */
.inv-tbl tr.inv-line.inv-flash td { background: var(--accent-soft); transition: background .3s; }
.chg-add { align-self: flex-start; margin-left: 34px; }
.chg-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 2px solid var(--line-strong); font-weight: 700; font-size: 17px; }
.chg-left { margin: -8px 0 0; }
.chg-left.over { color: var(--warn); font-weight: 500; }
.inv-totals { display: flex; flex-direction: column; gap: 0; padding: 6px 18px 14px; }
.inv-totals > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.inv-totals > div.grand { border-bottom: 0; border-top: 2px solid var(--line-strong); font-weight: 700; font-size: 17px; }
/* The buttons under the totals: where it stands, then the side buttons (left) and the main ones (right). */
.inv-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.inv-foot-note { margin: 0; color: var(--ink-3); font-size: 13px; }
.inv-foot-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.inv-foot-side, .inv-foot-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inv-foot-main { margin-left: auto; justify-content: flex-end; }
@media (max-width: 640px) {
  .inv-foot-btns { flex-direction: column-reverse; align-items: stretch; }
  .inv-foot-side, .inv-foot-main { margin-left: 0; }
  .inv-foot-main { flex-direction: column-reverse; align-items: stretch; }
  .inv-foot-side .btn { flex: 1 1 0; justify-content: center; }
  .inv-foot-main .btn { width: 100%; justify-content: center; }
}
/* Deposit credit: how much of the preconstruction deposit this invoice credits back. */
.inv-totals > div.inv-credit { align-items: center; }
.inv-credit label { display: flex; flex-direction: column; gap: 2px; }
.inv-credit [data-out=creditNote].over { color: var(--warn); font-weight: 500; }
.credit-box { position: relative; display: inline-flex; }
.credit-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-family: var(--mono); color: var(--ink-3); pointer-events: none; }
.credit-box input { width: 150px; min-height: 36px; padding: 6px 10px 6px 32px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font-family: var(--mono); font-weight: 500; text-align: right; }
.credit-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 760px) {
  .inv-meta { grid-template-columns: 1fr 1fr; }
}

/* ───────── Daily logs ───────── */
.logs { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.logs .log { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.log { display: flex; flex-direction: column; gap: 8px; }
.log header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.log header .btn { margin-left: auto; }
.log .log-title { font-weight: 600; color: var(--ink); }
.log .log-hours { font-size: 13px; color: var(--ink-2); background: var(--panel-2); padding: 2px 8px; border-radius: 999px; }
.log p { max-width: 70ch; }

/* ───────── Photos ───────── */
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--panel-2); aspect-ratio: 4 / 3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.thumb:hover img { transform: scale(1.04); }
.thumb .chip { position: absolute; left: 6px; top: 6px; }
/* All pictures (View All Pictures on Daily Logs): one group per daily log, more pictures across on wide screens. */
.pic-group { margin-bottom: 26px; }
.pic-day { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 15px; font-weight: 500; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pic-day b { font-weight: 700; }
.pic-day span { color: var(--ink-2); }
.pic-day small { margin-left: auto; font-size: 13px; }
.thumbs.pic-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 760px) { .thumbs.pic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } }
@media (max-width: 420px) { .thumbs.pic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.more-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }
.gallery figcaption { display: flex; flex-direction: column; padding-top: 8px; font-weight: 500; font-size: 14px; }

/* ───────── Selections ───────── */
/* Tile, Slabs, Paint: a list, one row each. Click one to see just those selections (click it again to see all). */
.sel-tiles { display: flex; flex-direction: column; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.sel-tile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 14px; width: 100%; padding: 11px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s var(--ease); }
.sel-tile:first-child { border-top: 0; }
.sel-tile:hover { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.sel-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sel-tile.on { background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); }
.sel-tile-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.sel-tile-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sel-tile-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; min-width: 0; }
.sel-tile-name { font-size: 16px; font-weight: 650; }
.sel-tile-count { font-size: 14px; color: var(--ink-2); }
.sel-tile small { font-size: 13px; text-align: right; }
.sel-tile-wait { color: var(--warn); font-weight: 600; }
.sel-tile-go { width: 18px; text-align: center; font-size: 20px; line-height: 1; color: var(--ink-3); }
.sel-tile.on .sel-tile-go { font-size: 18px; color: var(--accent); }
.sel-filter { margin: -6px 0 14px; color: var(--ink-2); font-size: 14px; }
/* Under the cards: the Add button (surface, slab, or room), with the "Showing…" note beside it. */
.ts-top { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: -4px 0 16px; }
.ts-top .sel-filter { margin: 0; }
/* Phones: the name and what's in it stack, and what's waiting goes under them. */
@media (max-width: 520px) {
  .sel-tile { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 12px; gap: 2px 12px; }
  .sel-tile-text { flex-direction: column; gap: 0; }
  .sel-tile small { grid-column: 2; grid-row: 2; text-align: left; font-size: 12.5px; }
  .sel-tile small:empty { display: none; }
  .sel-tile-go { grid-column: 3; grid-row: 1 / span 2; }
  .sel-tile-count { font-size: 13px; }
}
/* Selections checklist: one row per item, with a check box (the team) or a check mark (homeowners), when it's due,
   and the Send reminder and Edit buttons. */
.chk-note { margin: -4px 0 14px; font-size: 14px; max-width: 75ch; }
.chk-list { list-style: none; margin: 0 0 18px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.chk-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding: 11px 16px; border-top: 1px solid var(--line); }
.chk-row:first-child { border-top: 0; }
.chk-box { width: 19px; height: 19px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.chk-mark { width: 20px; height: 20px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; }
.chk-mark.on { background: var(--ok); border-color: var(--ok); color: var(--canvas); }
.chk-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chk-item { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.chk-main small { font-size: 13px; color: var(--ink-2); }
.chk-main small.chk-mail { color: var(--ink-3); }
.chk-soon { color: var(--warn); font-weight: 600; }
.chk-row.done .chk-item { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.chk-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Phones: the buttons go under the item. */
@media (max-width: 520px) {
  .chk-row { grid-template-columns: auto minmax(0, 1fr); padding: 10px 12px; }
  .chk-acts { grid-column: 2; justify-content: flex-start; }
}
.sel-list { display: flex; flex-direction: column; gap: 12px; }
.sel { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1.3fr) auto; gap: 20px; align-items: center; }
.sel-main { display: flex; flex-direction: column; gap: 3px; }
.sel-choice p { color: var(--ink-2); }
.sel-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.sel.sel-needed { border-left: 4px solid var(--warn); }

/* Tile details: one table per room or surface, with the layout picture beside it. */
.tile-specs { display: flex; flex-direction: column; gap: 16px; }
.tile-spec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 22px; align-items: stretch; }
.ts-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ts-table th { width: 180px; padding: 12px 14px 5px 0; text-align: left; vertical-align: top; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ts-table td { padding: 5px 0; vertical-align: top; }
.ts-table.ro th { padding: 10px 14px 10px 0; }
.ts-table.ro td { padding: 10px 0; overflow-wrap: anywhere; }
.ts-table.ro tr + tr > * { border-top: 1px solid var(--line); }
.ts-in { display: block; width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); font: inherit; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.ts-in:hover { border-color: var(--line-strong); }
.ts-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-in.edited { background: color-mix(in srgb, var(--accent-soft) 45%, var(--panel)); }
textarea.ts-in { resize: vertical; line-height: 1.45; }
.ts-side { display: flex; flex-direction: column; gap: 10px; border-radius: 12px; }
.ts-drop { flex: 1; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: 10px; background: var(--canvas); color: var(--ink-2); font: inherit; text-align: center; cursor: pointer; transition: border-color .18s var(--ease), background-color .18s var(--ease); }
.ts-drop svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ts-drop b { color: var(--ink); font-size: 14.5px; }
.ts-drop small { max-width: 26ch; font-size: 12.5px; color: var(--ink-3); }
.ts-drop:hover, .ts-side.drag .ts-drop { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 40%, var(--canvas)); }
.ts-drop:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-drop.ts-none { min-height: 160px; cursor: default; }
.ts-drop.ts-none:hover { border-color: var(--line-strong); background: var(--canvas); }
.ts-side.drag .ts-pic-open { outline: 2px dashed var(--accent); outline-offset: 4px; }
.ts-pic { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ts-pic-open { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--canvas); cursor: zoom-in; }
.ts-pic-open:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-pic-open img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.ts-pic figcaption { display: flex; gap: 16px; font-size: 13.5px; }
.ts-del { align-self: flex-end; margin-top: auto; }
.ts-bottom { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ts-sub { margin: 30px 0 12px; font-size: 17px; }
/* Paint: a Room box, then a grid with Color, Sheen, and Notes for each surface. No picture beside it. */
.tile-spec.no-pic { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ts-foot { display: flex; justify-content: flex-end; }
.ts-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ts-room { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 0; }
.ts-room-l { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ts-room b { font-size: 16.5px; font-weight: 650; }
.ts-scroll { overflow-x: auto; }
.ts-grid { min-width: 500px; }
.ts-grid th[scope=row] { width: 104px; }
.ts-grid thead th { padding: 4px 8px 2px 0; vertical-align: bottom; font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ts-grid thead th:nth-child(3) { width: 24%; }
.ts-grid td { padding: 4px 8px 4px 0; }
.ts-grid td:last-child { padding-right: 0; }
.ts-grid.ro tbody td { padding: 10px 10px 10px 0; }
.ts-grid.ro thead th { padding-bottom: 6px; }
/* On phones each surface stacks its Color, Sheen, and Notes, each with its own small label. */
@media (max-width: 560px) {
  .ts-grid { min-width: 0; }
  .ts-grid thead { display: none; }
  .ts-grid, .ts-grid tbody { display: block; width: 100%; }
  .ts-grid tr { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 6px; padding: 10px 0; }
  .ts-grid tr + tr { border-top: 1px solid var(--line); }
  .ts-grid.ro tr + tr > * { border-top: 0; }
  .ts-grid th[scope=row] { grid-column: 1 / -1; width: auto; padding: 0; font-size: 14px; color: var(--ink); }
  .ts-grid td, .ts-grid.ro tbody td { display: contents; }
  .ts-grid td::before { content: attr(data-col); font-size: 12.5px; color: var(--ink-3); }
  .ts-room { grid-template-columns: 56px minmax(0, 1fr); column-gap: 10px; }
}
@media (max-width: 760px) {
  .tile-spec { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ts-drop { min-height: 130px; }
  .ts-table th { width: 118px; }
}

/* ───────── To-dos ───────── */
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-2); margin-bottom: 14px; }
.seg-ctl button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease); }
.seg-ctl button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
/* To-do sheet: a spreadsheet grid. Cells are borderless boxes; the cell you're in gets a blue outline. */
.tdx-bar { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tdx-bar .seg-ctl { margin-bottom: 0; }
.tdx-bar .tdx-punch { margin-left: auto; }
/* Subcontractors: the search box at the right of the All / Needs attention buttons (full width on phones). */
.sub-search { margin-left: auto; flex: 0 1 300px; }
.sub-search input { width: 100%; min-height: 38px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.sub-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 640px) { .sub-search { flex: 1 1 100%; margin-left: 0; } }
.sub-none { padding: 14px 4px; }

/* Punch lists window: each trade, to print or download. */
.modal.punch { width: min(560px, calc(100vw - 24px)); }
.punch-intro { margin: -6px 0 0; }
.punch-warn { margin: 0; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 12%, var(--panel)); color: var(--warn); font-size: 13.5px; font-weight: 500; }
.punch-done { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.punch-list { list-style: none; margin: 0; padding: 0; max-height: min(48dvh, 420px); overflow: auto; border-top: 1px solid var(--line); }
.punch-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.punch-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.punch-name b { overflow-wrap: anywhere; }
.punch-btns { display: flex; gap: 8px; }
.punch-none { justify-content: center; padding: 18px 0; }
.tdx-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tdx { width: 100%; min-width: 780px; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.tdx .c-chk { width: 40px; }
.tdx .c-task { width: 28%; }
.tdx .c-room, .tdx .c-trade { width: 14%; }
.tdx .c-date { width: 112px; }
.tdx .c-by { width: 150px; }
/* Added by: a drop-down that looks like the other cells until it's clicked. */
.tdx-sel { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 26px; white-space: nowrap; overflow: hidden; }
/* Its little arrow, kept on hover, focus, and while changed (those set the cell's background). */
.tdx-in.tdx-sel, .tdx-in.tdx-sel:hover, .tdx-in.tdx-sel:focus, .tdx-in.tdx-sel.edited {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.tdx-sel:has(option:checked[value=""]) { color: var(--ink-3); }
.tdx .c-del { width: 38px; }
.tdx th, .tdx td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tdx tr > :last-child { border-right: 0; }
.tdx tbody tr:last-child > * { border-bottom: 0; }
.tdx thead th { background: var(--panel-2); text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tdx-sort { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tdx-sort:hover { background: color-mix(in srgb, var(--line) 55%, transparent); color: var(--ink); }
.tdx-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tdx-arrow { font-size: 10px; color: var(--ink-3); opacity: .6; }
.tdx th[aria-sort=ascending] .tdx-arrow, .tdx th[aria-sort=descending] .tdx-arrow { color: var(--accent); opacity: 1; }
.tdx-in { display: block; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; text-overflow: ellipsis; }
.tdx-in:hover { background: color-mix(in srgb, var(--accent-soft) 25%, transparent); }
.tdx-in:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--panel); text-overflow: clip; }
.tdx-in.edited { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.tdx-in.overdue, .tdx-ro.overdue { color: var(--bad); font-weight: 600; }
.tdx-in.bad { box-shadow: inset 0 0 0 2px var(--bad); }
.tdx-in::placeholder { color: var(--ink-3); }
/* The Task and Notes cells wrap long text and the row grows to fit; the row's other cells stay at the top. */
.tdx td { vertical-align: top; }
textarea.tdx-grow { height: auto; min-height: 38px; padding: 9px 10px; line-height: 20px; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; text-overflow: clip; }
.tdx td.tdx-chk { padding-top: 10px; }
.tdx td.tdx-chk input { vertical-align: top; }
.tdx td.tdx-del { padding-top: 6px; }
.tdx-ro { padding: 9px 10px; overflow-wrap: anywhere; }
.tdx-chk { text-align: center; }
.tdx-chk input { width: 17px; height: 17px; vertical-align: middle; accent-color: var(--accent); cursor: pointer; }
.tdx tr.done .tdx-in, .tdx tr.done .tdx-ro { color: var(--ink-3); text-decoration: line-through; font-weight: 400; }
.tdx-del { text-align: center; }
.tdx-x { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s var(--ease); }
.tdx tr:hover .tdx-x, .tdx-x:focus-visible { opacity: 1; }
.tdx-x:hover { background: var(--bad-soft); color: var(--bad); }
@media (hover: none) { .tdx-x { opacity: 1; } }
.tdx-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 24px; margin-top: 10px; }
.tdx-status.warn { color: var(--warn); font-weight: 600; }

/* ───────── Documents ───────── */
/* The folders in a column (Proposal, Invoices, Plans, the standard folders, then the team's own). Opening one shows
   only what's in it, with All folders above it to go back. */
.docs { display: flex; flex-direction: column; }
.docs.docs-opened { gap: 14px; }
.doc-back { align-self: flex-start; }
.doc-acc { list-style: none; margin: 0; padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-acc > li + li { border-top: 1px solid var(--line); }
.doc-folder { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 16px; color: var(--ink); text-decoration: none; font-weight: 500; transition: background-color .15s var(--ease), box-shadow .15s var(--ease); }
.doc-folder .badge { margin-left: -2px; }
.doc-folder:hover { background: var(--panel-2); }
.doc-folder:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.doc-folder svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; color: var(--ink-3); }
.doc-folder svg.chev { margin-left: auto; width: 16px; height: 16px; stroke-width: 2; }
.doc-folder.drag { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.df-name { min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.doc-acc-new { padding: 6px 8px; }
.doc-new { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--accent); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.doc-new:hover { background: var(--panel-2); }
.doc-new:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* An open folder's page inside Documents: the built-in ones (Proposal, Invoices, Plans) and the team's own
   are headed the same way. */
.doc-view > .sec-head:first-child h2 { font-size: 21px; overflow-wrap: anywhere; }
.doc-pane { position: relative; min-width: 0; }
.doc-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table thead th { padding: 0; background: var(--panel-2); border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.doc-table th[aria-sort=ascending] .tdx-arrow, .doc-table th[aria-sort=descending] .tdx-arrow { color: var(--accent); opacity: 1; }
.doc-table .dc-created_at { width: 150px; }
.doc-table .dc-size { width: 96px; }
.doc-table .dc-acts { width: 1%; }
.doc-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody tr:hover { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
.doc-table tr.dragging { opacity: .45; }
.doc-open { display: flex; align-items: center; gap: 12px; width: 100%; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.doc-open:hover b { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.doc-ic { flex: none; width: 36px; height: 44px; display: grid; place-items: end center; padding-bottom: 7px; border-radius: 4px 11px 4px 4px; font: 700 9.5px/1 var(--mono); letter-spacing: .03em; }
.doc-ic.pdf { background: var(--bad-soft); color: var(--bad); }
.doc-ic.word { background: var(--accent-soft); color: var(--accent); }
.doc-ic.pic { background: var(--warn-soft); color: var(--warn); }
/* A preview of a picture or a PDF's first page, in place of its icon (Documents folders and receipts). */
.fprev { flex: none; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.fprev img { width: 100%; height: 100%; object-fit: contain; }   /* the whole photo shows */
.fprev.pdf { padding: 6px; }
.fprev.pdf img { object-fit: contain; width: auto; max-width: 100%; height: 100%; border: 1px solid var(--line); background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.fprev > .doc-ic { width: 36px; height: 44px; }
.doc-open:hover .fprev img { opacity: .88; }
.rcpt-prev { display: inline-grid; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: zoom-in; }
.rcpt-prev:hover { border-color: var(--line-strong); }
.rcpt-prev:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rcpt-prev .fprev { width: 64px; height: 64px; }
.rcpt-prev-word { padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--accent); }

/* Tiles: pictures in a Documents folder, and a job's receipts, as a grid of just their pictures. */
.tiles { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); cursor: pointer; box-shadow: var(--shadow); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.tile:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .fprev { width: 100%; height: 100%; border-radius: 0; background: var(--panel-2); }
.tile .fprev img { object-fit: cover; }
.tile .fprev.pdf { padding: 10px; }
.tile .fprev.pdf img { object-fit: contain; }
.tile-ph { display: block; width: 100%; height: 100%; background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel) 50%, var(--panel-2) 70%); background-size: 200% 100%; animation: tile-wait 1.4s linear infinite; }
@keyframes tile-wait { to { background-position: -200% 0; } }
.tile-text { display: flex; flex-direction: column; justify-content: center; gap: 4px; height: 100%; padding: 14px; text-align: left; color: var(--ink); }
.tile-text b { overflow-wrap: anywhere; }
.tile-text small { color: var(--ink-3); }
.tile-badge { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 99px; background: rgba(20, 24, 26, .78); color: #fff; font-size: 12px; font-weight: 650; }
.tile-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.tiles-sum { margin: 0 0 10px; }
@media (max-width: 600px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { border-radius: 9px; }
}

/* A tile, opened: the picture, its buttons, and comments. */
.modal.tile-view { width: min(720px, calc(100vw - 24px)); }
.modal.tile-view h2 { overflow-wrap: anywhere; }
.tv-meta { margin: -10px 0 0; }
.tv-pic { display: grid; place-items: center; width: 100%; min-height: 180px; max-height: 56dvh; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); cursor: zoom-in; }
.tv-pic img { display: block; max-width: 100%; max-height: 56dvh; object-fit: contain; }
.tv-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tv-comments { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.tv-comments h3 { margin: 0; font-size: 15px; }
.tv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 30dvh; overflow: auto; }
.tv-list li p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tv-c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tv-del { margin-left: auto; font-size: 12.5px; font-weight: 500; }
.tv-add textarea { width: 100%; }
.tv-post { display: flex; justify-content: flex-end; }
.doc-ic.note { background: var(--ok-soft); color: var(--ok); letter-spacing: 0; }

/* Reading a meeting transcript (from Plaud): its summary, then the whole transcript. */
.modal.note-view { width: min(760px, calc(100vw - 24px)); }
.modal.note-view h2 { overflow-wrap: anywhere; }
.note-meta { margin: -10px 0 0; }
.note-body { display: flex; flex-direction: column; gap: 18px; max-height: min(62dvh, 640px); overflow: auto; margin: 0 -22px; padding: 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.note-body section { padding: 16px 0; }
.note-body section + section { border-top: 1px solid var(--line); }
.note-body h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; }
.note-text .note-h { display: inline-block; margin-top: 6px; font-size: 15.5px; }

/* Plaud recordings waiting for a job, on the Projects page. */
.inbox { margin-bottom: 20px; padding: 16px 18px; border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.inbox-head h2 { font-size: 17px; }
.inbox-head p { margin: 4px 0 0; max-width: 72ch; }
.inbox-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.inbox-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 260px) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.inbox-read { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.inbox-read b { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.inbox-job { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; }
.inbox-btns { display: flex; gap: 8px; }
@media (max-width: 700px) {
  .inbox-list li { grid-template-columns: 1fr; }
}
.doc-title { display: flex; flex-direction: column; min-width: 0; }
.doc-title b { font-weight: 600; overflow-wrap: anywhere; }
.doc-meta { display: none; margin-top: 2px; color: var(--ink-3); font-size: 12.5px; }
.doc-added { white-space: nowrap; }
.doc-added small { display: block; color: var(--ink-3); font-size: 12.5px; white-space: normal; }
.doc-size { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.doc-acts { white-space: nowrap; text-align: right; }
.doc-acts .btn + .btn { margin-left: 6px; }
.doc-hint { margin: 10px 2px 0; }
@media (hover: none) { .doc-hint { display: none; } }
.doc-drop-empty { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 48px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink-2); font: inherit; text-align: center; cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.doc-drop-empty b { font-size: 16px; color: var(--ink); }
.doc-drop-empty:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.doc-drop-empty:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-pane.drag::after { content: attr(data-drop-label); position: absolute; inset: -6px; z-index: 2; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-size: 16px; font-weight: 650; text-align: center; pointer-events: none; }
@media (max-width: 600px) {
  .doc-table .dc-created_at, .doc-table .dc-size, .doc-added, .doc-size { display: none; }
  .doc-meta { display: block; }
  .doc-acts [data-act=downloadDoc] { display: none; }
}

/* ───────── Plans ───────── */
.plans { position: relative; }
.plans.drag::after { content: attr(data-drop-label); position: absolute; inset: -6px; z-index: 2; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-size: 16px; font-weight: 650; text-align: center; pointer-events: none; min-height: 160px; }
.plan-filter { flex-wrap: wrap; max-width: 100%; }
.plan-filter .mono { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.plan-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.plan { display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
/* The picture sits inside a fixed 3:2 frame, so every card's preview lines up whatever the sheet size. */
.plan-thumb { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: var(--panel-2); cursor: zoom-in; overflow: hidden; }
.plan-thumb img { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .22)); transition: transform .2s var(--ease); }
.plan-thumb:hover img { transform: scale(1.025); }
.plan-thumb svg { position: absolute; inset: 0; margin: auto; width: 72px; height: 48px; fill: none; stroke: var(--ink-3); stroke-width: 1.3; stroke-linejoin: round; }
.plan-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.plan-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.plan-kind { background: var(--accent-soft); color: var(--accent); }
.chip.plan-sup { background: var(--warn-soft); color: var(--warn); }
.plan h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.3; }
.plan-name { padding: 0; border: 0; background: none; font: inherit; font-weight: 650; color: var(--ink); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.plan-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.plan-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.plan-meta { margin: 0; }
.plan-acts { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.plan.old .plan-thumb img { opacity: .55; filter: grayscale(1); }
.plan-old-list { margin-top: 24px; }
.plan-old-list > summary { width: fit-content; padding: 6px 2px; font-weight: 650; cursor: pointer; }
.plan-old-list > summary .mono { margin-left: 4px; font-weight: 500; color: var(--ink-3); }
.plan-old-list > p { margin: 2px 2px 12px; }
@media (max-width: 560px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }

/* ───────── Settings ───────── */
.details { margin: 0; display: grid; gap: 12px; }
.details div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.details dt { color: var(--ink-3); }
.details dd { margin: 0; font-weight: 500; }
.people { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.people li { display: flex; align-items: center; gap: 12px; }
.people li > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.people small { overflow-wrap: anywhere; }
/* A homeowner invited to create an account, not on the project yet. */
.people li.invited .avatar { background: var(--panel-2); color: var(--ink-3); border: 1px dashed var(--line-strong); }
.people li.invited b { font-weight: 600; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; margin: 16px 0 6px; }
.inline-form .field { flex: 1; margin: 0; }
.danger-zone { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); border-radius: var(--radius); }

/* ───────── Forms ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 13.5px; }
.field > span i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field small, .check small { color: var(--ink-3); font-size: 12.5px; }
/* "Add photos" (fieldHtml): a big button over a hidden file box, then thumbnails of the chosen pictures. */
.photo-field { width: 100%; }
.photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.photo-add { width: 100%; min-height: 48px; gap: 8px; border-style: dashed; cursor: pointer; }
.photo-add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.photo-input:focus-visible + .photo-add { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-picks:empty { display: none; }
.photo-count { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 2px 0 6px; }
.photo-picks ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.photo-picks li { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: var(--panel-2); }
.photo-picks img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.photo-x:hover { background: rgba(0, 0, 0, .8); }
.photo-x:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.check span { display: flex; flex-direction: column; font-weight: 500; }
.form-msg { padding: 10px 12px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-weight: 500; font-size: 14px; }
.form-msg.ok { background: var(--ok-soft); color: var(--ok); }

.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, .25); }
.modal[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal::backdrop { background: rgba(15, 20, 22, .5); }
.modal.ask { width: min(460px, calc(100vw - 24px)); }
/* A fixed tag at the front of a text box, like the change order number. */
.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); overflow: hidden; transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.input-prefix b { display: flex; align-items: center; padding: 0 12px; background: var(--accent-soft); color: var(--accent); font-size: 14px; border-right: 1px solid var(--line-strong); white-space: nowrap; }
.field .input-prefix input { flex: 1; min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-note { margin: -4px 0 0; }
.radios { border: 0; margin: 0; padding: 0; min-width: 0; }
.radios legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.check.radio { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; transition: border-color .18s var(--ease), background-color .18s var(--ease); }
.check.radio:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.check.radio span { font-family: var(--mono); font-weight: 500; }
.check.radio small { font-family: var(--font); overflow-wrap: anywhere; }
.head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.stat .src { color: var(--accent); overflow-wrap: anywhere; font-size: 12.5px; }
.stat .link.src { align-self: flex-start; text-align: left; font-weight: 500; }

/* Contract viewer on the Budget page */
.contract-doc { margin: 0 0 20px; padding: 0; overflow: hidden; }
.contract-doc header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.contract-doc .cd-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contract-doc .cd-title b { overflow-wrap: anywhere; }
.ct-body[hidden] { display: none; }
.ct-empty { padding: 16px 18px; }
.ct-check { margin: 0; padding: 9px 18px; font-size: 13px; border-bottom: 1px solid var(--line); }
.ct-check.ok { color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 60%, transparent); }
.ct-check.warn { color: var(--warn); background: var(--warn-soft); }
.ct-wrap { max-height: min(640px, 72vh); overflow: auto; }
.tbl.ct { font-size: 14px; }
.tbl.ct thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); box-shadow: inset 0 -1px 0 var(--line); }
.tbl.ct td, .tbl.ct th { vertical-align: top; }
.tbl.ct .ct-code { width: 76px; white-space: nowrap; font-size: 12.5px; padding-top: 13px; }
.tbl.ct td.num { width: 140px; }
/* Revised Proposal: a box on every line item. */
.ct-rev-box { position: relative; display: inline-block; }
.ct-rev-box i { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink-3); pointer-events: none; }
.ct-rev { width: 132px; min-height: 34px; padding: 5px 9px 5px 20px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--ink); font-family: var(--mono); font-weight: 500; font-size: 13.5px; text-align: right; }
.ct-rev:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.contract-doc .row-act { align-items: center; }
.rev-status { color: var(--warn); font-weight: 600; }
.tbl.ct td[data-rev-sec], .tbl.ct td[data-rev-tot] { color: var(--accent); }
/* The homeowner's proposal with change orders and invoices: one column per invoice, then Total and % complete. */
.tbl.ct.ct-billing td.num { width: auto; min-width: 104px; white-space: nowrap; }
.tbl.ct.ct-billing tbody th, .tbl.ct.ct-billing tbody td:nth-child(2) { min-width: 190px; }
.tbl.ct.ct-billing th.num { white-space: nowrap; }
.tbl.ct.ct-billing td.ct-inv { color: var(--ink-2); }
.tbl.ct.ct-billing td.ct-billed { font-weight: 600; }
.tbl.ct.ct-billing td.ct-pct { color: var(--ink-2); min-width: 84px; }
.tbl.ct tr.ct-co th { color: var(--warn); }
/* The builder's note on a line, from a sent invoice: under the line's name, and a corner mark on that invoice's amount. */
.tbl.ct td.ct-inv.has-note { position: relative; cursor: help; }
.tbl.ct td.ct-inv.has-note:focus-visible, .inv-tbl td.inv-total.has-note:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* The note box shown when pointing at (or tapping) a cell with a corner mark. */
.note-tip { position: fixed; z-index: 200; max-width: 320px; padding: 8px 11px; border-radius: 8px; background: var(--ink); color: var(--canvas); font-family: var(--font); font-size: 13px; font-weight: 500; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); pointer-events: none; }
.note-tip[hidden] { display: none; }
.tbl.ct td.ct-inv.has-note::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent var(--warn) transparent transparent; pointer-events: none; }
.ct-sec th, .ct-sec td { background: var(--accent-soft); color: var(--accent); font-weight: 650; border-top: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.ct-sec th .mono { opacity: .7; margin-right: 4px; }
.ct-item { cursor: default; }
.ct-item[data-act] { cursor: pointer; }
.ct-item[data-act]:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.ct-item b { display: block; font-weight: 600; }
.ct-desc {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  margin-top: 2px; color: var(--ink-3); font-size: 13px; white-space: pre-line; max-width: 80ch;
}
.ct-item.open .ct-desc { display: block; -webkit-line-clamp: unset; }
.ct-total th, .ct-total td { font-weight: 600; background: var(--canvas); }
.ct-total.grand th, .ct-total.grand td { font-weight: 700; font-size: 15px; background: var(--panel-2); border-top: 2px solid var(--line-strong); }
@media (max-width: 760px) {
  .tbl.ct .ct-code { display: none; }
  .tbl.ct thead th:first-child { display: none; }
  .ct-sec th, .ct-total th { padding-left: 16px; }
  .tbl.ct td.num { width: auto; }
}
.modal footer .f-alt { order: 1; }
.modal footer .f-main { order: 2; }
.ask-msg { color: var(--ink-2); }
.modal form { display: flex; flex-direction: column; gap: 16px; padding: 22px; }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal footer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.fields { display: flex; flex-wrap: wrap; gap: 14px 12px; }
.fields > * { flex: 1 1 100%; }
.fields > .half { flex: 1 1 calc(50% - 6px); }
.x { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.x:hover { background: var(--panel-2); }

/* ───────── Photo viewer ───────── */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(10, 12, 13, .94); color: #f1f0ec; }
.viewer::backdrop { background: rgba(10, 12, 13, .94); }
.viewer figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 56px 72px 20px; }
.viewer img { max-width: 100%; max-height: calc(100dvh - 160px); object-fit: contain; border-radius: 6px; }
.viewer figcaption { width: 100%; max-width: 1100px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.viewer figcaption > span:first-child { display: flex; flex-direction: column; }
.viewer figcaption small { color: #b6b9b6; }
.v-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viewer .btn.ghost { color: #f1f0ec; border-color: rgba(255, 255, 255, .4); }
.viewer .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.viewer .btn.danger.ghost { color: #f19a8c; border-color: #f19a8c; }
.viewer .x { position: absolute; top: 12px; right: 14px; color: #fff; }
.viewer .x:hover { background: rgba(255, 255, 255, .12); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 34px; cursor: pointer; }
.viewer .nav:hover { background: rgba(255, 255, 255, .18); }
.viewer .prev { left: 12px; }
.viewer .next { right: 12px; }

/* ───────── PDF viewer (plan sets and documents) ───────── */
.pdfv { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #1f2427; color: #f1f0ec; }
.pdfv[open] { display: flex; flex-direction: column; }
.pdfv::backdrop { background: rgba(10, 12, 13, .94); }
.pdfv-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 14px; background: #15191b; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.pdfv-title { flex: 1 1 160px; min-width: 0; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfv-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pdfv-group { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(255, 255, 255, .08); }
.pdfv button { min-width: 38px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: 600 14px/1 var(--font); cursor: pointer; }
.pdfv-group button { font-size: 19px; }
.pdfv-group .pdfv-zoom { min-width: 58px; font: 600 13px/1 var(--mono); }
.pdfv button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.pdfv button:disabled { opacity: .35; cursor: default; }
.pdfv button:focus-visible, .pdfv select:focus-visible { outline: 2px solid #7ab6cb; outline-offset: 1px; }
.pdfv [data-v=download] { border: 1px solid rgba(255, 255, 255, .35); }
.pdfv .pdfv-x { font-size: 26px; font-weight: 400; }
.pdfv-page { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 13px; color: #c9ccc9; }
.pdfv-page select { height: 30px; padding: 0 4px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 6px; background: #15191b; color: #f1f0ec; font: 600 13px var(--mono); }
.pdfv-body { position: relative; flex: 1; min-height: 0; display: flex; padding: 12px; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; cursor: grab; outline: none; }
.pdfv-body.grabbing { cursor: grabbing; }
.pdfv-body canvas { flex: none; display: block; margin: auto; background: #fff; box-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.pdfv-body canvas.stale { opacity: .45; }
.pdfv-msg { margin: auto; color: #b6b9b6; }
@media (pointer: coarse) { .pdfv button { min-width: 44px; height: 44px; } }
/* Phones: the name, Download, and × on top; sheet and zoom controls on a row of their own below. */
@media (max-width: 600px) {
  .pdfv-bar { padding: 8px 10px; gap: 8px; }
  .pdfv-ctl { order: 3; width: 100%; justify-content: space-between; gap: 6px; }
}

/* ───────── Sign in ───────── */
.auth { min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 14px; padding: 24px 16px; background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-soft), transparent 70%), var(--canvas); }
.auth-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
/* The full logo (AUTH_LOGO in app.js) at the top of the box. */
.auth-logo { margin: 2px 0 4px; line-height: 0; }
.auth-logo img { display: block; width: 100%; max-width: 250px; height: auto; }
.auth-card .lede { color: var(--ink-3); }
.auth-card .note { font-size: 14px; color: var(--ink-2); background: var(--canvas); border-radius: 10px; padding: 12px 14px; }
.auth-card .label { margin-top: 6px; }
/* The videos behind the sign-in page (see authVideo in app.js), with a light dark tint so the card stands out.
   The card is frosted glass: the video shows through it, blurred. The text fields stay solid. */
.auth.has-video { background: #0c1a20; }
.auth-media { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0c1a20; pointer-events: none; }
.auth-media video, .auth-media img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.auth-media video { opacity: 0; transition: opacity 1s var(--ease); }
.auth-media video.on { opacity: 1; }
.auth-media::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 65% at 50% 50%, rgba(12, 26, 32, .1), rgba(12, 26, 32, .42)); }
.auth.has-video > .auth-card { position: relative; z-index: 1; }
/* A smaller box over the video, so more of the house shows. */
.auth.has-video .auth-card {
  width: min(360px, 100%); gap: 12px; padding: 24px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border-color: color-mix(in srgb, var(--panel) 40%, transparent);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth.has-video .auth-card {
    background: color-mix(in srgb, var(--panel) 52%, transparent);
    -webkit-backdrop-filter: blur(12px) saturate(1.3);
    backdrop-filter: blur(12px) saturate(1.3);
  }
}
/* On the glass, gray text is full strength, so it stays easy to read. */
.auth.has-video .auth-card .lede, .auth.has-video .auth-card .switch, .auth.has-video .auth-card .field small { color: var(--ink); }
.who-list { display: flex; flex-direction: column; gap: 8px; }
.who {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel);
  transition: border-color .18s var(--ease), background-color .18s var(--ease), transform .18s var(--ease);
}
.who:hover { border-color: var(--accent); background: var(--canvas); transform: translateX(2px); }
.who > span:last-child { display: flex; flex-direction: column; }
.who small { color: var(--ink-3); font-size: 12.5px; }
.switch { text-align: center; color: var(--ink-3); font-size: 14px; }
.forgot { margin-top: -6px; text-align: right; font-size: 13.5px; }

/* Team page: who has a team login, and adding someone by email. */
.team-page .page-head p { max-width: 62ch; margin-top: 6px; }
.team-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.team-grid .people li { padding: 4px 0; }
.team-how { margin: 0 0 4px; color: var(--ink-2); font-size: 14px; }
/* Email takes the room; Office or Field stays narrow. */
.team-add .field:has(select) { flex: 0 0 auto; min-width: 110px; }
.team-sub { margin-top: 26px !important; margin-bottom: 4px !important; }
.team-sub + .muted { margin-bottom: 12px; }
@media (max-width: 860px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .team-page .inline-form { flex-direction: column; align-items: stretch; } }

/* ───────── Toast ───────── */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 100; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 10px; background: var(--ink); color: var(--canvas); font-weight: 500; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

/* ───────── Responsive ───────── */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sched-row, .sched.staff .sched-row { grid-template-columns: 1fr auto; }
  .sched-row .track { grid-column: 1 / -1; }
  .sched.staff .row-act { grid-column: 1 / -1; justify-content: flex-start; }
  .sched-axis .axis-pad { display: none; }
  .sched-axis .axis { grid-column: 1 / -1; }
  .sel { grid-template-columns: 1fr; gap: 12px; }
  .sel-side { flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (max-width: 760px) {
  .two { grid-template-columns: 1fr; }
  .wrap { padding: 20px 16px 64px; }
  .top-in { padding: 10px 16px; }
  .tabs { margin: 0 -16px 20px; padding: 0 16px; }
  .me-text { display: none; }
  .brand-tag { display: none; }
  .brand-logo img { width: 128px; }
  .proj-head { align-items: flex-start; }
  .ring { width: 72px; height: 72px; }
  .ring > span { width: 58px; height: 58px; }
  .ring b { font-size: 16px; }
  .ring small { display: none; }
  .co-list { grid-template-columns: 1fr; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .details div { grid-template-columns: 1fr; gap: 2px; }
  .danger-zone, .inline-form { flex-direction: column; align-items: stretch; }
  .viewer figure { padding: 56px 12px 16px; }
  .viewer .nav { top: auto; bottom: 90px; transform: none; height: 48px; }
  .sec-head > .btn { width: 100%; }
  .head-btns { width: 100%; }
  .head-btns .btn { flex: 1; }
  /* Weekly becomes a day-by-day list on phones. */
  .cal-detail .cal-week { display: none; }
  .agenda { display: block; }
  /* Monthly keeps the grid but shows colored bars and dots instead of text. */
  .cal-dow span { padding: 6px 0; text-align: center; letter-spacing: 0; }
  .cal-month .cal-week { min-height: 74px; --lane: 7px; row-gap: 2px; }
  .cal-month .cal-day { margin: 4px auto 2px; justify-self: center; padding: 2px 4px; }
  .cal-month .cal-bar { font-size: 0; padding: 0; margin: 0 1px; border-radius: 3px; }
  .cal-month .cal-bar.cont-l { margin-left: 0; }
  .cal-month .cal-bar.cont-r { margin-right: 0; }
  .cal-month .cal-items { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 0 2px; }
  .cal-month .ev { width: auto; padding: 2px; }
  .cal-month .ev-dot { margin-top: 0; }
  .cal-month .ev-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cal-month .ev.more { font-size: 10px; padding: 0 2px; }
  .cal-month .cal-bg.add::after { display: none; }
  .cal-nav { gap: 8px; }
  .cal-title { order: -1; flex-basis: 100%; }
  .cal-jump { margin-left: auto; }
  .day-phase { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .stats { gap: 10px; }
  .stat { padding: 12px; }
  .stat b { font-size: 16px; }
  .fields > .half { flex-basis: 100%; }
}

/* ───────── Invoices and Receipts pages (Office only) ───────── */
.page-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.page-tools .field { min-width: 170px; }
.page-tools .field select { min-height: 40px; }
.stats.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tbl td.nowrap { white-space: nowrap; }
.all-list tbody tr { cursor: pointer; }
.all-list tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.inv-cell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-link { color: inherit; font-weight: 600; text-decoration: none; }
.inv-row:hover .inv-link, .inv-link:focus-visible { text-decoration: underline; }
.rcpt-vendor { font-weight: 600; }
.rcpt-note { display: block; margin-top: 2px; max-width: 44ch; overflow-wrap: anywhere; }
.tbl td.rcpt-file { width: 1%; text-align: right; white-space: nowrap; }
.rcpt-page { position: relative; }
/* Receipts page: each job by homeowner last name, with how many new receipts Field has added. */
.rcpt-job-name { color: inherit; font-weight: 650; text-decoration: none; }
.rcpt-job:hover .rcpt-job-name, .rcpt-job-name:focus-visible { text-decoration: underline; }
.rcpt-badge { margin-left: 0; white-space: nowrap; }
/* Bids page: when the newest file went into a job's Bids folder, under the count. */
.bid-last { margin-top: 2px; font-weight: 400; white-space: nowrap; }
/* A job's bids: Plans for bidding, the subs (waiting on, and bids received), then the Bids folder's other files. */
.bids-page .bid-sec { margin-bottom: 18px; }
.bid-sec .sec-head { margin-bottom: 12px; }
.bid-sec .table-wrap { box-shadow: none; }
.bid-plans { position: relative; }
.bid-plans.drag::after { content: attr(data-drop-label); position: absolute; inset: 6px; z-index: 2; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-size: 16px; font-weight: 650; text-align: center; pointer-events: none; }
.bid-plans .doc-drop-empty { padding: 32px 20px; }
.bid-h { font-size: 15px; margin: 18px 0 8px; }
.bid-h .muted { font-weight: 500; margin-left: 4px; }
.bid-sub b { font-weight: 650; }
.bid-warn { color: var(--warn); font-size: 12.5px; }
/* A bid's notes keep their lines (like the "Includes:" list read from a proposal). */
.bid-note { max-width: 44ch; overflow-wrap: anywhere; white-space: pre-line; }
.bid-late { color: var(--bad); font-weight: 600; }
.bid-tbl td[data-l] { white-space: nowrap; }
.tbl td.bid-acts { width: 1%; white-space: nowrap; text-align: right; }
.bid-acts .btn + .btn { margin-left: 6px; }
.tbl td.bid-file { width: 1%; }
.chip.bid-low { margin-left: 8px; background: var(--ok-soft); color: var(--ok); font-family: inherit; }
.bid-none { margin: 4px 0 0; }
/* The cost code picker under a proposal line's Code box. */
.code-pop { position: absolute; z-index: 60; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.code-opt { display: flex; align-items: baseline; gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--ink); font-size: 13.5px; line-height: 1.3; cursor: pointer; }
.code-opt b { flex: none; width: 54px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.code-opt:hover { background: var(--panel-2); }
.code-opt.on { background: var(--accent-soft); }
.code-none { margin: 0; padding: 8px; color: var(--ink-3); font-size: 13px; }
/* A Download button with a menu of file types (PDF or Word). */
.dl-wrap { position: relative; display: inline-flex; }
.dl-wrap > .btn svg { flex: none; width: 15px; height: 15px; margin: 0 -3px 0 6px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s var(--ease); }
.dl-wrap > .btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.dl-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 210px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.dl-menu[hidden] { display: none; }
.dl-menu [role=menuitem] { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.dl-menu [role=menuitem] small { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.dl-menu [role=menuitem]:hover, .dl-menu [role=menuitem]:focus-visible { background: var(--panel-2); outline: none; }
.dl-menu [role=menuitem]:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dl-menu.to-left { right: auto; left: 0; }
/* A proposal from the bids: the heading, the bids, line items by division, totals, alternates, and notes. */
.pl-status { margin-left: 4px; font-size: 13px; }
.pl-status.bad { color: var(--bad); }
.pl-head-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.pl-head-grid .wide { grid-column: 1 / -1; }
.pl-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pl-cols, .pl-line { display: grid; grid-template-columns: 92px minmax(120px, 190px) minmax(0, 1fr) 136px 30px; gap: 8px; align-items: start; padding: 8px 10px; }
.pl-cols { background: var(--panel-2); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.pl-cols .num { text-align: right; }
.pl-div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-top: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; }
.pl-div b { font-weight: 700; }
.pl-div .mono { color: var(--ink-2); font-weight: 600; }
.pl-line { border-top: 1px solid var(--line); }
.pl-lines > .pl-line:first-child { border-top: 0; }
.pl-line input, .pl-line textarea, .pl-tot input { width: 100%; font: inherit; font-size: 14px; line-height: 1.4; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }
.pl-line textarea { display: block; resize: vertical; min-height: 36px; overflow: hidden; }
.pl-line input:focus, .pl-line textarea:focus, .pl-tot input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pl-code input { font-family: var(--mono); font-size: 13px; }
.pl-name textarea { font-weight: 600; }
.pl-amt .ct-rev-box, .pl-tot .ct-rev-box { display: block; }
.pl-amt input, .pl-tot input { padding-left: 20px; text-align: right; font-family: var(--mono); font-size: 13px; }
.pl-alt .pl-code { padding-top: 9px; font-size: 13px; }
.pl-x { width: 30px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; }
.pl-x:hover { background: var(--bad-soft); color: var(--bad); }
.pl-msg { grid-column: 1 / -1; }
.pl-tots { margin: 14px 0 0 auto; max-width: 560px; }
.pl-tot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 2px; border-top: 1px solid var(--line); }
.pl-tot > span { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pl-tot b { white-space: nowrap; }
.pl-tot .pl-num { width: 64px; padding-left: 9px; }
.pl-tot .ct-rev-box { display: inline-block; }
.pl-tot .pl-num.wide { width: 112px; padding-left: 20px; }
.pl-tot.grand { border-top: 2px solid var(--ink); font-size: 17px; font-weight: 700; }
.prop-page textarea[data-pf="notes"] { min-height: 110px; }
@media (max-width: 760px) {
  .pl-head-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-cols { display: none; }
  .pl-line { grid-template-columns: 84px minmax(0, 1fr) 30px; }
  .pl-line .pl-desc { grid-column: 1 / -1; grid-row: 2; }
  .pl-line .pl-amt { grid-column: 1 / 3; grid-row: 3; }
  .pl-line .pl-msg { grid-row: 4; }
  .pl-tots { max-width: none; }
}
/* Weekly reminders: on or off for the job, and when each waiting sub's next one goes out. */
.bid-auto { display: flex; align-items: center; gap: 8px 16px; margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); }
.bid-auto.off { background: var(--panel-2); }
.bid-auto p { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13.5px; }
.bid-auto .block { margin-top: 2px; }
.bid-auto .btn { flex: none; }
.bid-next { margin-top: 2px; font-size: 12.5px; }
/* Email subs for bids: the subs, by trade, to check off. */
.bid-pick .bid-find { margin: 4px 0 8px; }
.bid-pick-list { max-height: min(46vh, 380px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 2px 12px 8px; }
.bid-trade { margin: 10px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.bid-pick-sub { padding: 6px 0; }
.bid-pick-sub small { color: var(--ink-3); font-weight: 400; overflow-wrap: anywhere; }
.bid-pick-sub input:disabled + span { opacity: .55; }
.bid-plan-list ul { margin: 4px 0; padding-left: 18px; }
@media (max-width: 640px) {
  .bid-tbl thead { display: none; }
  .bid-tbl, .bid-tbl tbody { display: block; }
  .bid-tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
  .bid-tbl tr:first-child { border-top: 0; }
  .bid-tbl td { padding: 0; border: 0; }
  .bid-tbl td.bid-sub { flex: 1 1 100%; }
  .bid-tbl td[data-l] { font-size: 13px; color: var(--ink-3); }
  .bid-tbl td[data-l]::before { content: attr(data-l) ' '; }
  .bid-tbl td.bid-acts { flex: 1 1 100%; width: auto; text-align: left; }
  .bid-got td.bid-amt { text-align: left; }
  .bid-auto { flex-wrap: wrap; }
  .bid-tbl td[data-l] .bid-next { display: inline; margin: 0 0 0 4px; }
}
.rcpt-sum { margin: 0 0 10px; }
/* A job's receipts: New on the ones from Field not archived yet, and Archive (or Move back) on each. */
.chip.rcpt-new { margin-left: 8px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.rcpt-who { display: block; margin-top: 2px; }
.rcpt-who:empty { display: none; }
.tbl td.rcpt-act { width: 1%; text-align: right; white-space: nowrap; }

/* Subcontractors page: expired insurance in red, expiring within 30 days in amber. */
.sub-name { font-weight: 600; }
.sub-contact { display: block; margin-top: 2px; overflow-wrap: anywhere; }
.tbl td.sub-file { width: 1%; white-space: nowrap; }
.chip.sub-expired { background: var(--bad-soft); color: var(--bad); }
.chip.sub-soon { background: var(--warn-soft); color: var(--warn); }
.chip.sub-ok { background: var(--ok-soft); color: var(--ok); }
.subs-list td .chip { margin-left: 6px; }
.subs-list th { white-space: nowrap; }
.subs-list tr.sub-expired td { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.subs-list tr.sub-expired:hover td { background: color-mix(in srgb, var(--bad-soft) 80%, transparent); }
.sub-alert { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.sub-alert.bad { background: var(--bad-soft); color: var(--bad); }
.sub-alert.warn { background: var(--warn-soft); color: var(--warn); }
.subs-page .tdx-bar { margin-top: 6px; }
/* A job's Receipts folder in Documents: the same list, without the Job column. */
.job-rcpt-pane { position: relative; }
.job-rcpt-pane.drag::after { content: attr(data-drop-label); position: absolute; inset: -6px; z-index: 2; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-size: 16px; font-weight: 650; text-align: center; pointer-events: none; min-height: 160px; }
.rcpt-page.drag::after { content: attr(data-drop-label); position: absolute; inset: 8px; z-index: 2; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-size: 16px; font-weight: 650; text-align: center; pointer-events: none; min-height: 200px; }

/* Team page: Office or Field next to each person. */
.people-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip.team-role.tr-office { background: var(--accent-soft); color: var(--accent); }
.chip.team-role.tr-field { background: var(--panel-2); color: var(--ink-2); }
.team-role-pick select { min-height: 34px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; }
.team-role-pick select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal.ask .radios { margin-top: 4px; }
@media (max-width: 560px) {
  .team-grid .people li { flex-wrap: wrap; row-gap: 6px; }
  .team-grid .people-act { width: 100%; justify-content: flex-start; padding-left: 46px; }
}

@media (max-width: 1000px) {
  .stats.three-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.three-up > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .page-tools { width: 100%; }
  .page-tools .field { flex: 1 1 140px; min-width: 0; }
  .page-tools .btn { flex: 1 1 auto; }
  /* On phones each invoice or receipt is a small card, so the amount is always in view. */
  .all-list thead { display: none; }
  .all-list, .all-list tbody, .all-list tfoot { display: block; }
  .all-list tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; row-gap: 3px; padding: 12px 16px; border-top: 1px solid var(--line); }
  .all-list tbody tr:first-child { border-top: 0; }
  .all-list tbody td { padding: 0; border: 0; min-width: 0; }
  .all-list tfoot tr { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 2px solid var(--line-strong); }
  .all-list tfoot th, .all-list tfoot td { padding: 0; border: 0; }
  .all-list tfoot td:empty { display: none; }
  .all-list tbody td.num { grid-area: 1 / 3; align-self: start; font-weight: 650; }
  /* Invoices: number and status, amount / job / date and due date. */
  .inv-list.all-list td:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
  .inv-list.all-list td:nth-child(2) { grid-area: 2 / 1 / 3 / 4; }
  .inv-list.all-list td:nth-child(3), .inv-list.all-list td:nth-child(4) { color: var(--ink-3); font-size: 13px; }
  .inv-list.all-list td:nth-child(3) { grid-area: 3 / 1; }
  .inv-list.all-list td:nth-child(4) { grid-area: 3 / 2 / 4 / 4; }
  .inv-list.all-list td:nth-child(4)::before { content: '· Due '; }
  .inv-list.all-list td.no-due { display: none; }
  /* A job's receipts: vendor (and who added it), amount / date and category, View / Archive. */
  .rcpt-list td:nth-child(2) { grid-area: 1 / 1 / 2 / 3; }
  .rcpt-list td:nth-child(1), .rcpt-list td:nth-child(3) { color: var(--ink-3); font-size: 13px; }
  .rcpt-list td:nth-child(1) { grid-area: 2 / 1; }
  .rcpt-list td:nth-child(3) { grid-area: 2 / 2; }
  .rcpt-list td:nth-child(3)::before { content: '· '; }
  .rcpt-list td.rcpt-file { grid-area: 2 / 3 / 4 / 4; align-self: end; width: auto; }
  .rcpt-list td.rcpt-act { grid-area: 3 / 1 / 4 / 3; width: auto; padding-top: 6px; text-align: left; }
  /* The Receipts page's jobs: last name and the new count / address. */
  .rcpt-jobs td:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
  .rcpt-jobs td:nth-child(2) { grid-area: 2 / 1 / 3 / 4; color: var(--ink-3); font-size: 13px; }
  /* A job's receipts: vendor, amount / date and category, View. */
  .job-rcpts td:nth-child(2) { grid-area: 1 / 1 / 2 / 3; }
  .job-rcpts td:nth-child(1), .job-rcpts td:nth-child(3) { color: var(--ink-3); font-size: 13px; }
  .job-rcpts td:nth-child(1) { grid-area: 2 / 1; }
  .job-rcpts td:nth-child(3) { grid-area: 2 / 2; }
  .job-rcpts td:nth-child(3)::before { content: '· '; }
  .job-rcpts td.no-cat, .rcpt-list td.no-cat { display: none; }   /* no category: nothing to show */
  .job-rcpts td.rcpt-file { grid-area: 2 / 3; align-self: end; width: auto; }
  /* Subcontractors: name and contact / trade / insurance date and status / the two files, labeled. */
  .subs-list tbody tr { grid-template-columns: minmax(0, 1fr) auto; }
  .subs-list td:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
  .subs-list td:nth-child(2) { grid-area: 2 / 1 / 3 / 3; color: var(--ink-3); font-size: 13px; }
  .subs-list td:nth-child(3) { grid-area: 3 / 1 / 4 / 3; }
  .subs-list td.sub-file { display: flex; align-items: center; gap: 8px; width: auto; text-align: left; }
  .subs-list td:nth-child(4) { grid-area: 4 / 1; }
  .subs-list td:nth-child(5) { grid-area: 4 / 2; }
  .subs-list td:nth-child(4)::before { content: 'Insurance'; color: var(--ink-3); font-size: 13px; }
  .subs-list td:nth-child(5)::before { content: 'W-9'; color: var(--ink-3); font-size: 13px; }
  .subs-list tr.sub-expired { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
  .subs-list tr.sub-expired td, .subs-list tr.sub-expired:hover td { background: none; }
}

/* ───────── Motion preferences ───────── */
body.paused *, body.paused *::before, body.paused *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
