/* Plumbline UI.
   Blueprint-derived palette: deep navy ground, drafting-blue accent, amber for
   the things that cost money if ignored. Light and dark both first-class --
   half the users are in a trailer with the sun on the screen. */

:root {
  --navy-900: #060d1a;
  --navy-800: #0b1728;
  --navy-700: #122139;
  --navy-600: #1b2f4d;
  --line: #23395c;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --surface-3: #e3e8ef;
  --border: #d3dae4;
  --text: #14203a;
  --text-dim: #5a6a85;
  --text-faint: #8b98ad;

  --accent: #1f6fd0;
  --accent-soft: #e6f0fd;
  --accent-line: #b9d5f6;

  --amber: #b06f00;
  --amber-soft: #fff3d9;
  --amber-line: #f0d6a0;

  --red: #b3261e;
  --red-soft: #fdeceb;
  --red-line: #f2c3bf;

  --green: #1e6b45;
  --green-soft: #e6f5ec;

  /* A revision drawn on a page image (docchanges.js): the page is paper, white
     in every scheme, so these don't change with it. */
  --rev: #c5221f;
  --rev-paper: #ffffff;
  --rev-tint: rgba(197, 34, 31, .08);
  --rev-veil: rgba(255, 255, 255, .94);

  --radius: 12px;
  --radius-sm: 8px;

  /* One spacing scale (the unslop pass, 11-29): every padding, margin and gap is a
     step of 4px at 100% text size, and grows with the Text size setting like the rem
     it replaced. --sp-2 is only for 2px nudges inside small controls. */
  --sp-2: calc(2px * var(--ui-scale));
  --sp-4: calc(4px * var(--ui-scale));
  --sp-8: calc(8px * var(--ui-scale));
  --sp-12: calc(12px * var(--ui-scale));
  --sp-16: calc(16px * var(--ui-scale));
  --sp-20: calc(20px * var(--ui-scale));
  --sp-24: calc(24px * var(--ui-scale));
  --sp-28: calc(28px * var(--ui-scale));
  --sp-32: calc(32px * var(--ui-scale));
  --sp-36: calc(36px * var(--ui-scale));
  --sp-40: calc(40px * var(--ui-scale));
  --sp-44: calc(44px * var(--ui-scale));
  --sp-48: calc(48px * var(--ui-scale));
  --sp-52: calc(52px * var(--ui-scale));
  --sp-60: calc(60px * var(--ui-scale));
  --sp-76: calc(76px * var(--ui-scale));
  --sp-136: calc(136px * var(--ui-scale));

  /* One scale for every text size (11-29: whole pixels at 100% -- 12, 13, 14, 15, 18,
     20, 28 -- the smallest 12px so it reads in a trailer), and one quiet line for the edges of cards
     and lists (the November 2026 cleanup). A control keeps the full --border. */
  --fs-xs: .8rem;
  --fs-sm: .8667rem;
  --fs-base: .9333rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.3333rem;
  --fs-2xl: 1.8667rem;
  --border-soft: color-mix(in srgb, var(--border) 55%, transparent);
  --shadow: 0 1px 2px rgba(20, 32, 58, .06), 0 6px 20px rgba(20, 32, 58, .07);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;

  /* Appearance hooks (appearance.js). Each defaults to the look above, so with
     no scheme chosen nothing changes. A scheme sets them inline on <html>. */
  --on-accent: #fff;
  --ui-scale: 1;
  --stripe: none;
  --side-bg: var(--surface);
  --side-surface-2: var(--surface-2);
  --side-text: var(--text);
  --side-dim: var(--text-dim);
  --side-faint: var(--text-faint);
  --side-border: var(--border);
  --side-accent: var(--accent);
  --side-accent-soft: var(--accent-soft);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--navy-900);
    --surface: var(--navy-800);
    --surface-2: var(--navy-700);
    --surface-3: var(--navy-600);
    --border: var(--line);
    --text: #e6edf8;
    --text-dim: #9db0cc;
    --text-faint: #6d82a3;

    --accent: #4da3ff;
    --accent-soft: #10233d;
    --accent-line: #1e4470;

    --amber: #ffb547;
    --amber-soft: #2b2110;
    --amber-line: #5c441a;

    --red: #ff8b80;
    --red-soft: #2e1512;
    --red-line: #63302a;

    --green: #6ede9f;
    --green-soft: #10261a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --on-accent: var(--navy-900);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: calc(15px * var(--ui-scale));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1, h2 { letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--sp-8); }
.muted { color: var(--text-dim); }
.small { font-size: var(--fs-sm); }
[hidden] { display: none !important; }

/* ---------- controls ---------- */

.btn {
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.4;
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
/* Three weights: filled (the one thing to do), outlined, and ghost (there if wanted). */
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); border-color: var(--red-line); }

.link {
  background: none; border: none; padding: 0;
  font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline;
}
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: var(--fs-xl); line-height: 1; color: var(--text-dim); padding: 0 var(--sp-4);
}

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-8);
  width: 100%;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }

.field { display: block; margin-bottom: var(--sp-12); }
.field > span {
  display: block; font-size: var(--fs-sm); font-weight: 400;
  color: var(--text-dim); margin-bottom: var(--sp-4);
}

.tabs { display: flex; gap: var(--sp-4); border-bottom: 1px solid var(--border-soft); }
.tab {
  font: inherit; font-weight: 400;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim);
  padding: var(--sp-8) var(--sp-12);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.badge {
  display: inline-block;
  background: var(--surface-3); color: var(--text-dim);
  border-radius: 99px; padding: 0 var(--sp-8);
  font-size: var(--fs-xs); font-weight: 400; min-width: 1.2rem; text-align: center;
}

.chip {
  font: inherit; font-size: var(--fs-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 99px; padding: var(--sp-2) var(--sp-8); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent-line); }

.error { color: var(--red); font-size: var(--fs-base); }

/* ---------- auth ---------- */

.auth-screen {
  min-height: 100%;
  display: grid; place-items: center;
  padding: var(--sp-32) var(--sp-16);
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-28);
}
.brand { display: flex; align-items: center; gap: var(--sp-12); margin-bottom: var(--sp-24); }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-mark.small { width: 20px; height: 20px; }
.brand-tag { margin: 0; font-size: var(--fs-sm); color: var(--text-dim); }
.auth-card .tabs { margin-bottom: var(--sp-20); }
.account-type { border: 0; padding: 0; margin: 0 0 var(--sp-16); display: grid; gap: var(--sp-8); }
.account-type legend { font-size: var(--fs-sm); color: var(--text-faint); padding: 0; margin-bottom: var(--sp-4); }
.account-option {
  display: flex; gap: var(--sp-8); align-items: flex-start; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  padding: var(--sp-8) var(--sp-12);
}
.account-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.account-option input { margin-top: var(--sp-4); }
.account-option > span { display: grid; gap: var(--sp-2); }
.join-head { margin: 0 0 var(--sp-8); }
.join-out { margin-top: var(--sp-8); }
.join-number { font-family: var(--mono); font-weight: 600; font-size: var(--fs-lg); white-space: nowrap; }
.join-row { display: flex; gap: var(--sp-8); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-12); }
.join-wait-head { margin-top: var(--sp-12); }
.auth-note { font-size: var(--fs-sm); color: var(--text-faint); margin: var(--sp-16) 0 0; }
.auth-note.sso-or { text-align: center; margin: var(--sp-8) 0 var(--sp-16); }

/* Two-step sign-in (mfa.js): the code at sign-in, the setup steps and the
   recovery codes. The QR code brings its own white ground and margin (drawn
   on the server), so phones read it in every color scheme. */
.two-step-title { font-size: var(--fs-lg); margin: 0 0 var(--sp-8); }
.two-step-card { max-width: 520px; }
.two-step-code { font-family: var(--mono); font-size: var(--fs-lg); letter-spacing: .15em; }
.two-step-steps { padding-left: var(--sp-20); display: grid; gap: var(--sp-12); font-size: var(--fs-base); }
.two-step-qr { margin: var(--sp-8) 0; }
/* `.modal-body .two-step-qr img` too: the setup also opens in a window, whose
   `.modal-body img` (page previews, full width) stretched the code to fill it. */
.two-step-qr img, .modal-body .two-step-qr img {
  display: block; width: 200px; height: 200px; border-radius: var(--radius-sm);
}
.two-step-key {
  font-family: var(--mono); font-size: var(--fs-md); letter-spacing: .05em; margin: var(--sp-4) 0;
  user-select: all; overflow-wrap: anywhere;
}
.two-step-confirm { display: flex; gap: var(--sp-8); align-items: flex-end; flex-wrap: wrap; margin-top: var(--sp-8); }
.two-step-confirm .field { margin-bottom: 0; }
.two-step-codes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-24);
  font-family: var(--mono); font-size: var(--fs-md); padding-left: var(--sp-24); margin: var(--sp-12) 0; user-select: all;
}
.two-step-actions { display: flex; gap: var(--sp-8); flex-wrap: wrap; margin-top: var(--sp-8); }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }

.sidebar {
  /* The sidebar re-scopes the shared tokens, so a scheme can give it its own
     color (a team's primary) while everything inside follows automatically. */
  --surface: var(--side-bg);
  --surface-2: var(--side-surface-2);
  --text: var(--side-text);
  --text-dim: var(--side-dim);
  --text-faint: var(--side-faint);
  --border: var(--side-border);
  --border-soft: color-mix(in srgb, var(--side-border) 55%, transparent);
  --accent: var(--side-accent);
  --accent-soft: var(--side-accent-soft);
  background: var(--surface);
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--sp-16) var(--sp-12);
  gap: var(--sp-12);
  overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; gap: var(--sp-8);
  font-weight: 600; color: var(--text);
  padding: 0 var(--sp-4) var(--sp-4);
}
.sidebar-head .brand-mark { color: var(--accent); }

.project-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.project-item {
  text-align: left; width: 100%;
  background: none; border: none; cursor: pointer;
  font: inherit; color: var(--text-dim);
  padding: var(--sp-8) var(--sp-8); border-radius: var(--radius-sm);
  display: block;
}
.project-item:hover { background: var(--surface-2); color: var(--text); }
.project-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 400; }
.project-item .pi-name {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-item .pi-sub { display: block; font-size: var(--fs-xs); color: var(--text-faint); }

.sidebar-foot { border-top: 1px solid var(--border-soft); padding-top: var(--sp-8); display: grid; gap: var(--sp-4); }
/* The sidebar's own buttons read as a list of places to go, not as a stack of boxes. */
.sidebar-foot .btn.block, .sidebar .find-job-btn {
  text-align: left; padding: var(--sp-8) var(--sp-8); font-size: var(--fs-md); font-weight: 400;
}
/* These two open a window, so they keep an outline: plain words here read as a label, not a button. */
.sidebar .find-job-btn { font-size: var(--fs-base); border-color: var(--border); }
.sidebar .find-job-btn:hover:not(:disabled) { border-color: var(--accent); }
@media (max-width: 820px) {
  .sidebar-foot .btn.block, .sidebar .find-job-btn { padding: var(--sp-12) var(--sp-8); }
}
/* Demo allowance. Shown plainly rather than sprung on someone at the cap. */
.demo-meter {
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
  border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-8);
  display: grid; gap: 2px;
}
.demo-tag {
  font-size: var(--fs-xs); font-weight: 400; color: var(--amber);
}
.demo-line { font-size: var(--fs-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.demo-line.spent { color: var(--amber); font-weight: 600; }

.capabilities { font-size: var(--fs-xs); color: var(--text-faint); display: grid; gap: 2px; }
.cap-row { display: flex; align-items: center; gap: var(--sp-4); }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-faint); }
.dot.on { background: var(--green); }
.dot.off { background: var(--amber); }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-8); }
.user-email {
  font-size: var(--fs-sm); color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.main {
  overflow-y: auto; padding: var(--sp-28) var(--sp-32) var(--sp-60);
  /* A scheme's stripe: a thin band of team colors along the top. */
  background-image: var(--stripe);
  background-size: 100% 5px;
  background-repeat: no-repeat;
}
/* Phones: no room for the sidebar beside the page, so it becomes a drawer that
   the top bar's menu button slides in over it. Projects, Appearance, Company,
   Settings and Sign out all live in the sidebar, so hiding it outright left a
   phone with no way to reach them. Desktop never shows either piece. */
.topbar, .drawer-backdrop { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .main { padding: var(--sp-16); }

  .topbar {
    display: flex; align-items: center; gap: var(--sp-8);
    padding: var(--sp-4) var(--sp-16) var(--sp-4) var(--sp-8);
    background: var(--side-bg); color: var(--side-text);
    border-bottom: 1px solid var(--side-border);
    font-weight: 400;
  }
  .topbar .brand-mark { color: var(--side-accent); }
  /* 44px: the smallest target a thumb hits reliably. */
  .menu-btn { color: var(--side-text); padding: 12px; line-height: 0; }
  .menu-btn svg { width: 22px; height: 22px; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(290px, 85vw);
    box-shadow: var(--shadow);
    /* Hidden as well as moved, so Tab can't wander into a closed drawer. */
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility .2s;
  }
  .app.drawer-open .sidebar { transform: none; visibility: visible; }
  .app.drawer-open .drawer-backdrop {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(6, 13, 26, .55);
  }
}
@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

.empty-state { max-width: 480px; margin: var(--sp-60) auto; text-align: center; }
.empty-state p { color: var(--text-dim); margin-bottom: var(--sp-20); }

.project-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-16); margin-bottom: var(--sp-16);
}
.main-tabs { margin-bottom: var(--sp-20); }
.panel { max-width: 940px; }

/* ---------- ask ---------- */

.ask-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-12);
  box-shadow: var(--shadow);
}
.ask-form textarea { border: none; padding: var(--sp-4); background: none; font-size: var(--fs-md); }
.ask-form textarea:focus { outline: none; }
.ask-controls { display: flex; gap: var(--sp-8); align-items: center; justify-content: flex-end; }
.select { width: auto; max-width: 260px; font-size: var(--fs-base); padding: var(--sp-4) var(--sp-8); }

.examples { display: flex; flex-wrap: wrap; gap: var(--sp-8); align-items: center; margin: var(--sp-12) 0 var(--sp-24); font-size: var(--fs-base); }

.ask-result { display: grid; gap: var(--sp-16); }

.answer-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--sp-16) var(--sp-20);
}
.answer-body { line-height: 1.65; }
.answer-body h1, .answer-body h2, .answer-body h3 { margin: var(--sp-16) 0 var(--sp-8); font-size: var(--fs-md); }
.answer-body ul, .answer-body ol { margin: var(--sp-8) 0 var(--sp-12); padding-left: var(--sp-20); }
.answer-body li { margin-bottom: var(--sp-4); }
.answer-body blockquote {
  margin: var(--sp-8) 0; padding: var(--sp-8) var(--sp-12);
  border-left: 3px solid var(--accent-line);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim); font-size: var(--fs-base);
}
.answer-body code {
  font-family: var(--mono); font-size: .87em;
  background: var(--surface-2); padding: var(--sp-2) var(--sp-4); border-radius: 4px;
}

.cite {
  font: inherit; font-size: var(--fs-sm); font-weight: 400;
  vertical-align: super; line-height: 1;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 4px; padding: var(--sp-2) var(--sp-4); margin: 0 1px;
  cursor: pointer;
}
.cite:hover { background: var(--accent); color: var(--on-accent); }
.cite.missing { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

.answer-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-16);
  margin-top: var(--sp-16); padding-top: var(--sp-12);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-faint);
}

.notice {
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16);
  border: 1px solid var(--border-soft); background: var(--surface-2);
  font-size: var(--fs-base);
}
.notice.warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.notice.warn strong { color: var(--amber); }

.conflict-card {
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--amber);
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--sp-16) var(--sp-16);
}
.conflict-card.high { border-left-color: var(--red); }
.conflict-head { display: flex; align-items: center; gap: var(--sp-8); margin-bottom: var(--sp-8); font-weight: 600; }
.conflict-head .sev {
  display: inline-block;
  font-size: var(--fs-xs);
  border: 1px solid currentColor; border-radius: 99px; padding: 0 var(--sp-8);
}
.conflict-values { display: grid; gap: var(--sp-8); margin: var(--sp-12) 0; }
.conflict-value {
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-12); align-items: baseline;
  background: var(--surface-2); border: 0;
  border-radius: var(--radius-sm); padding: var(--sp-8) var(--sp-12);
}
.conflict-value .val { font-family: var(--mono); font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.conflict-value .src { font-size: var(--fs-sm); color: var(--text-dim); }
.conflict-hint { font-size: var(--fs-base); margin: 0; }

.sources h3 { margin-bottom: var(--sp-8); color: var(--text-dim); font-size: var(--fs-sm); }
.source-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-12); margin-bottom: var(--sp-8);
}
.source-card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.source-top { display: flex; gap: var(--sp-8); align-items: baseline; flex-wrap: wrap; }
.source-id {
  font-family: var(--mono); font-size: var(--fs-sm); font-weight: 400;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 4px; padding: var(--sp-2) var(--sp-4);
}
.source-cite { font-weight: 400; font-size: var(--fs-base); }
.source-heading { font-size: var(--fs-sm); color: var(--text-faint); margin: var(--sp-4) 0 var(--sp-8); }
.source-excerpt {
  font-size: var(--fs-base); color: var(--text-dim);
  max-height: 4.6em; overflow: hidden; position: relative;
  white-space: pre-wrap;
}
.source-excerpt.open { max-height: none; }
.source-actions { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); flex-wrap: wrap; }
.tag {
  font-size: var(--fs-xs); border-radius: 4px; padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border); color: var(--text-faint);
}
.tag.ocr { color: var(--amber); border-color: var(--amber-line); }

/* ---------- documents ---------- */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--sp-32) var(--sp-16); text-align: center;
  color: var(--text-dim); margin-bottom: var(--sp-16);
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

.doc-list { display: grid; gap: var(--sp-8); }
/* A big job's list: find by name, show by state, a page at a time (app.js). */
.doc-tools { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.doc-tools input[type=search] { flex: 1 1 14rem; min-width: 0; }
/* Nolan's template: the list a group at a time (app.js renderDocKinds). */
.doc-kinds { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.doc-kinds .chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); }
/* Whose contract a contract is (app.js contractLine). */
.doc-for { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-top: var(--sp-8); }
.doc-for .select { max-width: 18rem; }
.doc-indexing { display: flex; align-items: center; gap: var(--sp-8); margin: 0 0 var(--sp-8); }
.doc-pager { display: flex; align-items: center; justify-content: center; gap: var(--sp-12); margin-top: var(--sp-12); }
.doc-filter-name { min-width: 10rem; }
.doc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16);
}
.doc-top { display: flex; justify-content: space-between; gap: var(--sp-16); align-items: flex-start; }
.doc-name { font-weight: 400; word-break: break-word; }
.doc-sub { font-size: var(--fs-sm); color: var(--text-faint); margin-top: var(--sp-2); }
.type-pill {
  display: inline-block;
  font-size: var(--fs-xs); font-weight: 400;
  border-radius: 99px; padding: var(--sp-2) var(--sp-8);
  background: var(--surface-3); color: var(--text-dim); white-space: nowrap;
}
.type-pill.drawing { background: var(--accent-soft); color: var(--accent); }
.type-pill.specification { background: var(--green-soft); color: var(--green); }
.type-pill.contract { background: var(--amber-soft); color: var(--amber); }

.progress { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: var(--sp-8); }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.doc-status { font-size: var(--fs-sm); color: var(--text-dim); margin-top: var(--sp-8); }
.doc-status.failed { color: var(--red); }
.doc-actions { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); }
.doc-actions .btn { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-sm); }

/* ---------- index ---------- */

.search-input { max-width: 380px; margin-bottom: var(--sp-16); }
.index-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-24); }
@media (max-width: 760px) { .index-grid { grid-template-columns: 1fr; } }
.index-list { margin-top: var(--sp-8); max-height: 62vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.index-row {
  display: flex; gap: var(--sp-12); align-items: baseline;
  padding: var(--sp-8) var(--sp-12); border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: var(--fs-base);
}
.index-row:last-child { border-bottom: none; }
.index-row:hover { background: var(--surface-2); }
.index-row .code { font-family: var(--mono); font-weight: 400; color: var(--accent); flex: none; }
.index-row .label { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- registers (RFIs, change orders) ---------- */

.panel-actions { display: flex; gap: var(--sp-8); margin-bottom: var(--sp-16); flex-wrap: wrap; }

.register { display: grid; gap: var(--sp-8); }

.reg-item {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16); cursor: pointer;
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: var(--sp-12);
  align-items: baseline;
}
.reg-item:hover { border-color: var(--accent-line); }
.reg-num { font-family: var(--mono); font-weight: 400; font-size: var(--fs-sm); color: var(--accent); }
.reg-title { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-sub { font-size: var(--fs-sm); color: var(--text-faint); margin-top: var(--sp-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-right { display: flex; align-items: center; gap: var(--sp-8); }

@media (max-width: 640px) {
  .reg-item { grid-template-columns: minmax(0, 1fr); }
}

/* Status is the spine of both registers, so it reads as a shape not just a word. */
.status-pill {
  font-size: var(--fs-xs); font-weight: 400; border-radius: 99px; padding: var(--sp-2) var(--sp-8);
  white-space: nowrap; border: 1px solid transparent;
}
.status-pill.draft     { background: var(--surface-3); color: var(--text-dim); }
.status-pill.open      { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.status-pill.submitted { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.status-pill.answered  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.status-pill.approved  { background: var(--green-soft); color: var(--green); }
.status-pill.closed    { background: var(--green-soft); color: var(--green); }
.status-pill.rejected  { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.status-pill.void      { background: var(--surface-3); color: var(--text-faint); text-decoration: line-through; }
.status-pill.overdue   { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

.money { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- form editor ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-12); }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span-2 { grid-column: 1 / -1; }

.field-note { font-size: var(--fs-sm); color: var(--text-faint); margin-top: var(--sp-4); }

.evidence {
  border: 1px solid var(--amber-line); background: var(--amber-soft);
  border-radius: var(--radius-sm); padding: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-12);
  font-size: var(--fs-sm);
}
.evidence h4 { margin: 0 0 var(--sp-4); font-size: var(--fs-sm); color: var(--amber); }
.evidence ul { margin: 0; padding-left: var(--sp-16); }
.evidence li { margin-bottom: var(--sp-4); }

.ref-list { display: grid; gap: var(--sp-4); margin-top: var(--sp-4); }
.ref-chip {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-8); background: var(--surface-2);
}

.line-items { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.line-items th {
  text-align: left; font-size: var(--fs-xs); color: var(--text-faint); font-weight: 400;
  padding: var(--sp-4) var(--sp-8); border-bottom: 1px solid var(--border);
}
.line-items td { padding: var(--sp-4) var(--sp-8); border-bottom: 1px solid var(--border); }
.line-items input { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-sm); }
.line-items .num-col { width: 6rem; }
.line-items .money-col { width: 8rem; }
.li-total { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.totals { display: grid; gap: var(--sp-4); margin-top: var(--sp-8); justify-content: end; }
.totals div { display: grid; grid-template-columns: auto 7rem; gap: var(--sp-16); font-size: var(--fs-base); }
.totals .grand { font-weight: 600; border-top: 1px solid var(--border); padding-top: var(--sp-4); }

/* ---------- company ---------- */

.member-row, .invite-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--sp-8);
  align-items: center; padding: var(--sp-8) 0; border-bottom: 1px solid var(--border);
  font-size: var(--fs-base);
}
.member-row:last-child, .invite-row:last-child { border-bottom: 0; }
.member-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.invite-link {
  font-family: var(--mono); font-size: var(--fs-xs); word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm); padding: var(--sp-8) var(--sp-8); margin-top: var(--sp-8);
}

/* Audit log (audit.js) */
.audit-filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-8); align-items: end;
}
.audit-filters .field { margin: 0; }
.audit-bar { display: flex; gap: var(--sp-8); align-items: center; flex-wrap: wrap; margin: var(--sp-8) 0 var(--sp-4); }
.audit-row {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) minmax(0, 2fr) 7rem; gap: var(--sp-8);
  padding: var(--sp-8) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); align-items: baseline;
}
.audit-row:last-child { border-bottom: 0; }
.audit-row > span { overflow-wrap: anywhere; }
.audit-row.head { font-weight: 400; color: var(--text-dim); font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .audit-row { grid-template-columns: 1fr; gap: var(--sp-2); }
  .audit-row.head { display: none; }
}

.plan-row {
  display: flex; gap: var(--sp-12); align-items: baseline; flex-wrap: wrap;
  font-size: var(--fs-base); margin-bottom: var(--sp-12);
}
.quote-block {
  border-left: 3px solid var(--accent-line);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--sp-8) var(--sp-12); font-size: var(--fs-base); color: var(--text-dim);
  white-space: pre-wrap;
}

.plan-badge {
  font-family: var(--mono); font-size: var(--fs-xs); border: 1px solid var(--accent-line);
  background: var(--accent-soft); color: var(--accent);
  border-radius: 99px; padding: var(--sp-2) var(--sp-8);
}

/* ---------- history ---------- */

.history-list { display: grid; gap: var(--sp-8); }
.history-item {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-12); cursor: pointer;
}
.history-item:hover { border-color: var(--accent-line); }
.history-q { font-weight: 400; }
.history-a { font-size: var(--fs-sm); color: var(--text-dim); margin-top: var(--sp-4);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-meta { font-size: var(--fs-xs); color: var(--text-faint); margin-top: var(--sp-4); }

/* ---------- updates timeline ---------- */

.note-form { margin-bottom: var(--sp-20); }
.note-form textarea { width: 100%; }
.timeline { display: grid; gap: var(--sp-8); }
.tl-day {
  margin: var(--sp-16) 0 var(--sp-2); font-size: var(--fs-xs); color: var(--text-faint);
}
.tl-day:first-child { margin-top: 0; }
.tl-note {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-12);
}
.tl-note header { display: flex; gap: var(--sp-8); align-items: baseline; margin-bottom: var(--sp-4); }
.tl-actions { margin-left: auto; display: inline-flex; gap: var(--sp-8); }
.tl-dates { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.tl-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-event {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-8);
  align-items: baseline; padding: var(--sp-4) var(--sp-12); font-size: var(--fs-base);
  border-left: 2px solid var(--border);
}
.tl-event.linkable { cursor: pointer; }
.tl-event.linkable:hover { border-left-color: var(--accent); }
.tl-event-text { overflow-wrap: anywhere; }
#timeline-more { margin-top: var(--sp-12); }
.check { display: inline-flex; gap: var(--sp-4); align-items: center; font-size: var(--fs-base); color: var(--text-dim); white-space: nowrap; }
.check input { width: auto; margin: 0; }

/* Nine tabs outgrow a narrow window: keep each label on one line and let the
   row scroll sideways instead of breaking "To-dos" across two lines. */
/* The tab bar slides sideways on a narrow screen (swipe, or shift and the wheel)
   with no scrollbar showing. Its line is an inset shadow under the tabs, so they
   sit inside the bar: a tab hanging 1px over it made the bar scroll up and down. */
.main-tabs {
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border);
}
.main-tabs::-webkit-scrollbar { display: none; }
/* On a phone the tabs run off the side: the fade says there are more to swipe to. */
@media (max-width: 640px) {
  .main-tabs {
    padding-right: var(--sp-32);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(to right, black calc(100% - 2.5rem), transparent);
  }
}
.main-tabs .tab { white-space: nowrap; flex-shrink: 0; margin-bottom: 0; }

/* ---------- tags shared by RFIs, change orders and the updates ---------- */

.tag.high, .tag.overdue { color: var(--red); border-color: var(--red-line); }
.tag.link-tag { color: var(--accent); border-color: var(--accent-line); }
.modal-actions { display: flex; gap: var(--sp-8); justify-content: flex-end; margin-top: var(--sp-16); }
/* On a long form the buttons stay at the foot of the window, in reach without scrolling. */
.modal-body > .modal-actions.stick {
  position: sticky; bottom: -1.25rem; z-index: 1; justify-content: flex-start; flex-wrap: wrap;
  margin: var(--sp-20) calc(-1 * var(--sp-20)) calc(-1 * var(--sp-20)); padding: var(--sp-12) var(--sp-20);
  background: var(--surface); border-top: 1px solid var(--border-soft);
}
@media (max-width: 640px) {
  /* One row to swipe along, so the buttons never take half a phone's screen. */
  .modal-body > .modal-actions.stick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .modal-body > .modal-actions.stick::-webkit-scrollbar { display: none; }
  .modal-body > .modal-actions.stick > .btn { flex: none; }
}

/* ---------- modal & toast ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 13, 26, .55);
  display: grid; place-items: center; padding: var(--sp-24);
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 700px; max-height: 86vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 1100px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-16) var(--sp-20); border-bottom: 1px solid var(--border-soft);
}
.modal-body { padding: var(--sp-20); overflow-y: auto; }
@media (max-width: 640px) {
  .modal-backdrop { padding: var(--sp-8); }
  .modal { max-height: 94vh; }
}
.modal-body img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

.toast-stack { position: fixed; bottom: 1rem; right: 1rem; z-index: 60; display: grid; gap: var(--sp-8); }
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: var(--sp-8) var(--sp-12); font-size: var(--fs-base); max-width: 380px;
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }

.spinner {
  width: 15px; height: 15px; display: inline-block; vertical-align: -2px;
  border: 2px solid var(--accent-line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---- connected platforms ---- */
.cx-card {
  border: 1px solid var(--border, #d6dde8); border-radius: 10px;
  padding: var(--sp-8) var(--sp-12); margin: var(--sp-8) 0;
}
.cx-card summary {
  cursor: pointer; display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap;
}
.cx-card[open] summary { margin-bottom: var(--sp-8); }
.cx-steps { margin: var(--sp-4) 0 var(--sp-8) var(--sp-16); padding: 0; }
.cx-steps li { margin: var(--sp-2) 0; }
.cx-paste { margin-top: var(--sp-8); }
.crumbs { margin: var(--sp-12) 0 var(--sp-8); font-size: var(--fs-base); }
.tree {
  max-height: 360px; overflow: auto;
  border: 1px solid var(--border, #d6dde8); border-radius: 10px;
}
.tree-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12);
  padding: var(--sp-8) var(--sp-12); border-bottom: 1px solid var(--border, #d6dde8);
}
.tree-row:last-child { border-bottom: 0; }
.tree-name { text-align: left; }
.tag.sync-ok { color: var(--green); }
.tag.sync-error, .tag.sync-partial { color: var(--red); }

/* ---------- appearance: layouts (appearance.js sets these on <html>) ---------- */

/* Density. Text size is --ui-scale; density is the room around things. */
html[data-density="compact"] .main { padding: var(--sp-16) var(--sp-20) var(--sp-44); }
html[data-density="compact"] .btn { padding: var(--sp-4) var(--sp-12); }
html[data-density="compact"] .tab { padding: var(--sp-8) var(--sp-8); }
html[data-density="compact"] .ask-result { gap: var(--sp-8); }
html[data-density="compact"] .answer-card { padding: var(--sp-12) var(--sp-16); }
html[data-density="compact"] .source-card { padding: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-4); }
html[data-density="compact"] .sidebar { gap: var(--sp-8); }

/* Spacious is also touch-sized: 44px is the smallest target a gloved or
   hurried thumb hits reliably. */
html[data-density="spacious"] .main { padding: var(--sp-32) var(--sp-36) var(--sp-76); }
html[data-density="spacious"] .btn,
html[data-density="spacious"] .tab,
html[data-density="spacious"] .project-item { min-height: 44px; }
html[data-density="spacious"] .btn { padding: var(--sp-8) var(--sp-16); }
html[data-density="spacious"] .chip { padding: var(--sp-8) var(--sp-12); font-size: var(--fs-md); }
html[data-density="spacious"] .ask-form textarea { font-size: var(--fs-lg); }
html[data-density="spacious"] .ask-result { gap: var(--sp-20); }

/* Options a layout can switch off. */
html[data-examples="off"] #examples { display: none; }
html[data-doc-filter="off"] #doc-filter-name { display: none; }
html[data-examples="off"] .ask-result { margin-top: var(--sp-16); }

/* Slim sidebar: narrower, and only what you click on. The narrower column is
   for desktop widths only: on a phone the sidebar is a drawer, and this rule
   (more specific than the phone one) would squeeze the page into 205px. */
@media not all and (max-width: 820px) {
  html[data-sidebar="slim"] .app { grid-template-columns: 205px 1fr; }
}
html[data-sidebar="slim"] .capabilities,
html[data-sidebar="slim"] .project-item .pi-sub { display: none; }

/* Answer beside its sources, on a screen wide enough to hold both. */
@media (min-width: 1200px) {
  html[data-side-by-side="on"] .panel[data-panel="ask"] { max-width: 1500px; }
  html[data-side-by-side="on"] .ask-result {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  html[data-side-by-side="on"] .ask-result > * { grid-column: 1; }
  html[data-side-by-side="on"] .ask-result > .sources {
    grid-column: 2; grid-row: 1 / span 40;
  }
}

/* Simple layout: the top sources only, until asked for the rest. */
.source-card.ap-more { display: none; }
.sources.ap-all .source-card.ap-more { display: block; }

/* In-depth layout: how the question was read and how each source ranked. */
.ap-details {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16); font-size: var(--fs-base);
}
.ap-details summary { cursor: pointer; font-weight: 400; color: var(--text-dim); }
.ap-details h5 { margin: var(--sp-12) 0 var(--sp-4); font-size: var(--fs-xs); color: var(--text-faint); }
.ap-pills { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.ap-pill { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-8); border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }
.ap-pill.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.ap-pill.neg { color: var(--red); border-color: var(--red-line); }
.ap-rank { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ap-rank th, .ap-rank td { text-align: left; padding: var(--sp-4) var(--sp-8); border-bottom: 1px solid var(--border); vertical-align: top; }
.ap-rank th { color: var(--text-faint); font-weight: 400; }
.ap-rank td.num { font-family: var(--mono); white-space: nowrap; }
.ap-bar { height: 5px; border-radius: 3px; background: var(--accent); min-width: 2px; }

/* Drop anywhere: shown while a PDF is dragged over the window. */
.ap-drop {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 3px dashed var(--accent);
  font-size: var(--fs-xl); font-weight: 400; color: var(--accent);
}

/* ---------- appearance window ---------- */

.ap-section { margin-bottom: var(--sp-20); }
.ap-section > h4 { margin-bottom: var(--sp-4); }
.ap-section > p { margin-bottom: var(--sp-12); }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-8); }
.ap-card {
  font: inherit; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-12) var(--sp-12); display: grid; gap: var(--sp-4); align-content: start;
}
.ap-card:hover { border-color: var(--accent-line); }
.ap-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ap-card strong { font-size: var(--fs-md); }
.ap-card .muted { font-size: var(--fs-sm); line-height: 1.4; }
.ap-swatch { display: flex; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.ap-swatch span { flex: 1; }
.ap-swatch span:first-child { flex: 2.4; }

.ap-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ap-seg button {
  font: inherit; font-size: var(--fs-base); background: var(--surface); color: var(--text-dim);
  border: none; padding: var(--sp-4) var(--sp-12); cursor: pointer;
}
.ap-seg button + button { border-left: 1px solid var(--border); }
.ap-seg button.active { background: var(--accent); color: var(--on-accent); }

.ap-knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-16) var(--sp-24); }
.ap-knobs h5 { margin: 0 0 var(--sp-8); font-size: var(--fs-sm); }
.ap-toggle { display: flex; gap: var(--sp-8); align-items: flex-start; font-size: var(--fs-base); margin-bottom: var(--sp-4); cursor: pointer; }
.ap-toggle input { width: auto; margin-top: var(--sp-4); }
.ap-tabrow { display: flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-base); padding: var(--sp-2) 0; }
.ap-tabrow input { width: auto; }
.ap-tabrow .grow { flex: 1; }
.ap-tabrow button { font: inherit; font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-8); }
input[type="range"] { padding: 0; }

.ap-colors { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(250px, 1.1fr); gap: var(--sp-20); }
@media (max-width: 700px) { .ap-colors { grid-template-columns: 1fr; } }
.ap-roles { display: grid; gap: 2px; max-height: 440px; overflow-y: auto; align-content: start; }
.ap-role {
  font: inherit; font-size: var(--fs-base); text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: var(--sp-8);
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text); padding: var(--sp-4) var(--sp-8);
}
.ap-role:hover { background: var(--surface-2); }
.ap-role.active { border-color: var(--accent); background: var(--accent-soft); }
.ap-role .sw { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border); flex: none; }
.ap-role .hex { margin-left: auto; font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-faint); }
.ap-picker { display: grid; gap: var(--sp-12); justify-items: center; align-content: start; }
.ap-wheel { position: relative; width: 220px; height: 220px; touch-action: none; cursor: crosshair; }
.ap-wheel canvas { width: 220px; height: 220px; border-radius: 50%; display: block; }
.ap-marker {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 4px rgba(0, 0, 0, .5);
  pointer-events: none;
}
.ap-picker label { width: 100%; max-width: 260px; font-size: var(--fs-sm); color: var(--text-dim); }
.ap-hexrow { display: flex; gap: var(--sp-8); align-items: center; width: 100%; max-width: 260px; }
.ap-hexrow .sw { width: 38px; height: 34px; border-radius: 6px; border: 1px solid var(--border); flex: none; }
.ap-hexrow input { font-family: var(--mono); }
.ap-checks { display: grid; gap: var(--sp-4); font-size: var(--fs-sm); width: 100%; max-width: 300px; }
.ap-check { display: flex; justify-content: space-between; gap: var(--sp-8); }
.ap-check .ok { color: var(--green); font-weight: 400; }
.ap-check .bad { color: var(--red); font-weight: 400; }

/* ---------- conflict register (conflicts.js) ---------- */

.conflict-bar { align-items: center; }
.conflict-bar #conflict-scanned { margin-left: auto; }
.conflict-register { display: grid; gap: var(--sp-12); }
.reg-conflict .conflict-head { flex-wrap: wrap; }
.reg-conflict .conflict-head .status-pill { margin-left: auto; }
/* The values side by side, the way the sheets would be laid out on a table;
   one under another where there isn't room. */
.reg-conflict .conflict-values { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.reg-conflict .conflict-value { grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-4); }
.reg-conflict .conflict-value .link { justify-self: start; font-size: var(--fs-sm); }
/* Still on record, but the documents no longer say it. */
.reg-conflict.gone { border-style: dashed; border-color: var(--border); background: var(--surface-2); }
.conflict-state { font-size: var(--fs-base); color: var(--text-dim); margin: var(--sp-8) 0 0; }
.conflict-actions { display: flex; gap: var(--sp-8); flex-wrap: wrap; margin-top: var(--sp-8); }
.status-pill.rfi       { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.status-pill.resolved  { background: var(--green-soft); color: var(--green); }
.status-pill.dismissed { background: var(--surface-3); color: var(--text-dim); }
.status-pill.gone      { background: var(--surface); color: var(--text-dim); border: 1px dashed var(--border); }

/* ---------- revisions (revisions.js) ---------- */

.tag.superseded { color: var(--amber); border-color: var(--amber-line); }
.tag.current    { color: var(--green); border-color: var(--green); }
.tag.amended    { color: var(--accent); border-color: var(--accent-line); }
.rev-note { font-size: var(--fs-sm); color: var(--text-dim); margin: var(--sp-4) 0 var(--sp-8); }
.rev-note .cite { margin-left: var(--sp-2); }
/* Old words stay readable: the card shows what changed, not only the result. */
.source-excerpt del.rev-old { color: var(--text-faint); text-decoration-color: var(--amber); }
.source-card.rev-superseded { opacity: .78; border-style: dashed; }
.revision-card {
  border: 1px solid var(--green); background: var(--green-soft);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16); margin-bottom: var(--sp-12);
}
.revision-head { display: flex; gap: var(--sp-8); align-items: center; font-weight: 600; }
.revision-card ul { margin: var(--sp-8) 0 0; padding-left: var(--sp-20); font-size: var(--fs-base); }
.doc-rev { font-size: var(--fs-sm); color: var(--text-dim); margin-top: var(--sp-8); }
.doc-rev ul { margin: var(--sp-4) 0 0; padding-left: var(--sp-16); }
.doc-rev-head { font-weight: 400; color: var(--text); }

/* ---------- Plumbline IT, support access, the audit page ---------- */
/* itsite.js, support.js and auditlog.html. Shared color tokens only, so every
   color scheme, light and dark, applies. The banner is amber: it costs a
   customer's trust to forget you are on their job. */

.it-tabs { margin-bottom: var(--sp-16); overflow-x: auto; scrollbar-width: none; }
.it-tabs::-webkit-scrollbar { display: none; }
.it-tabs .tab { white-space: nowrap; flex-shrink: 0; }
.it-search { max-width: 480px; }
.it-number { font-family: var(--mono); font-size: var(--fs-sm); white-space: nowrap; }
.it-note { margin: var(--sp-8) 0 0; }
.it-person { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--sp-8); padding: var(--sp-2) 0; overflow-wrap: anywhere; }
.it-ask {
  display: grid; grid-template-columns: minmax(130px, .7fr) minmax(130px, .7fr) minmax(220px, 2fr) auto;
  gap: var(--sp-8); align-items: end;
}
.it-ask .field { margin: 0; }
.it-live {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8) var(--sp-8);
  padding: var(--sp-8) 0; border-top: 1px solid var(--border);
}
.it-live:first-of-type { border-top: 0; padding-top: 0; }
.it-live > div { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.it-requests td { vertical-align: top; }
.op-usage-note { margin: 0 0 var(--sp-12); }

.support-banner {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8) var(--sp-12);
  margin-bottom: var(--sp-12); padding: var(--sp-8) var(--sp-12);
  background: var(--amber-soft); color: var(--text);
  border: 1px solid var(--amber-line); border-left: 4px solid var(--amber);
  border-radius: var(--radius-sm); font-size: var(--fs-base);
}
.support-banner .btn { flex: none; }
.sb-text { min-width: 0; overflow-wrap: anywhere; }
.tag.support-tag { color: var(--amber); border-color: var(--amber-line); }

.co-account { font-family: var(--mono); font-weight: 400; white-space: nowrap; }
.notif-item:has(.notif-support) { flex-wrap: wrap; }
.notif-support {
  flex: 0 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8);
  padding: 0 var(--sp-8) var(--sp-8);
}
.notif-support .ar-role { margin-right: auto; }
.sr-history { display: grid; }
.sr-row { padding: var(--sp-8) 0; border-top: 1px solid var(--border); }
.sr-row:first-child { border-top: 0; }
.sr-line { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-12); }
.sr-what { min-width: 0; overflow-wrap: anywhere; }
.sr-line > .link { flex: none; }
.sr-actions {
  margin-top: var(--sp-8); padding: var(--sp-8) var(--sp-8); max-height: 320px; overflow-y: auto;
  background: var(--surface-2); border-radius: var(--radius-sm);
}

.al-page { max-width: 1040px; margin: 0 auto; padding: var(--sp-24) var(--sp-20) var(--sp-44); }
.al-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-16); margin-bottom: var(--sp-16);
}
.al-head h2 { overflow-wrap: anywhere; }
.al-head p { margin: var(--sp-2) 0 0; }

@media (max-width: 700px) {
  .it-ask { grid-template-columns: 1fr; }
  .it-live .btn { flex: 1 1 auto; }
  .support-banner { flex-wrap: wrap; }
  .support-banner .btn { flex: 1 1 100%; }
  .sr-line { flex-wrap: wrap; }
  .al-head { flex-wrap: wrap; }
  /* Settings' tabs and Management's invite row would hold the whole window
     wider than a phone, and Support access and the audit key with it. */
  .modal { min-width: 0; }
  .settings-tabs { overflow-x: auto; scrollbar-width: none; }
  .settings-tabs .tab { white-space: nowrap; flex-shrink: 0; }
  .invite-form { grid-template-columns: 1fr; }
}

/* ---------- Send, the To picker, Sent to, submittals, the secure link ---------- */
.to-chips { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.to-chips:not(:empty) { margin-bottom: var(--sp-8); }
.to-chip {
  display: inline-flex; align-items: center; gap: var(--sp-4); max-width: 100%; padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-8);
  font-size: var(--fs-sm); color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 99px; overflow-wrap: anywhere;
}
.to-remove {
  flex: none; width: 1.3rem; height: 1.3rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: inherit; font-size: var(--fs-md); line-height: 1;
}
.to-remove:hover { background: var(--surface); }
.to-old { margin: 0 0 var(--sp-8); }
.to-select { width: 100%; }
.to-email { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); }
.to-email input { flex: 1; min-width: 0; }

.send-what { margin: 0 0 var(--sp-8); }
.send-who { margin: var(--sp-12) 0; padding: var(--sp-8) var(--sp-12); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.send-who legend { padding: 0 var(--sp-4); font-size: var(--fs-sm); font-weight: 400; color: var(--text-dim); }
.send-row { display: flex; align-items: baseline; padding: var(--sp-4) 0; white-space: normal; color: var(--text); }
.send-link { margin-top: var(--sp-12); padding: var(--sp-8) var(--sp-12); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.send-link-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); overflow-wrap: anywhere; }
.send-link-row { display: flex; gap: var(--sp-8); margin: var(--sp-8) 0 var(--sp-4); }
.send-link-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-sm); }
.tag.sent-not { color: var(--amber); border-color: var(--amber-line); }

.sent-block { margin-top: var(--sp-16); }
.sent-block h4 { margin: 0 0 var(--sp-8); }
.sent-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-8); }
.sent-row { padding: var(--sp-8) var(--sp-12); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sent-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-8); }
.sent-who { min-width: 0; overflow-wrap: anywhere; }
.sent-email { font-weight: 400; }
.sent-times {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-12);
  margin: var(--sp-8) 0 0; font-size: var(--fs-sm);
}
.sent-times dt { color: var(--text-faint); font-size: var(--fs-xs); }
.sent-times dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.sent-message { margin: var(--sp-8) 0 0; font-size: var(--fs-base); color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.sent-reply {
  margin-top: var(--sp-8); padding: var(--sp-8) var(--sp-8); font-size: var(--fs-base); background: var(--surface);
  border-left: 3px solid var(--accent-line); border-radius: var(--radius-sm); overflow-wrap: anywhere;
}
.sent-reply p { margin: var(--sp-2) 0 0; white-space: pre-wrap; }
.sent-row > .link { margin-top: var(--sp-4); }
.register .reg-title, .register .reg-sub { display: block; }
.with-line { display: block; margin-top: var(--sp-2); color: var(--amber); white-space: normal; }

.status-pill.under_review, .status-pill.revise_resubmit { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.status-pill.approved_as_noted { background: var(--green-soft); color: var(--green); }
@media (min-width: 641px) {
  #submittal-list .reg-item { grid-template-columns: 8rem minmax(0, 1fr) auto; }
}
.sm-state { margin: 0 0 var(--sp-8); }
.sm-head { margin: var(--sp-16) 0 var(--sp-4); }
.sm-revs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.sm-files { display: grid; gap: var(--sp-4); margin: var(--sp-4) 0 var(--sp-8); }
.sm-file { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-8); overflow-wrap: anywhere; }
.sm-actions { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-16); }

.shared-body { min-height: 100vh; background: var(--bg); color: var(--text); }
.shared-page { max-width: 46rem; margin: 0 auto; padding: var(--sp-24) var(--sp-16) var(--sp-44); }
.shared-head { margin-bottom: var(--sp-12); }
.shared-head h1 { margin: var(--sp-2) 0; font-size: var(--fs-xl); }
.shared-number { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.shared-title { margin: 0 0 var(--sp-8); font-weight: 400; overflow-wrap: anywhere; }
.shared-message { margin: var(--sp-12) 0; padding: var(--sp-8) var(--sp-12); background: var(--surface); border-left: 3px solid var(--accent-line); white-space: pre-wrap; overflow-wrap: anywhere; }
.shared-page h3 { margin: var(--sp-16) 0 var(--sp-4); font-size: var(--fs-md); }
.shared-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-8) var(--sp-12); margin: var(--sp-12) 0 0; }
.shared-fields dt { font-size: var(--fs-xs); color: var(--text-faint); }
.shared-fields dd { margin: 0; font-weight: 400; overflow-wrap: anywhere; }
.shared-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.shared-scroll { overflow-x: auto; }
.shared-ref { margin-bottom: var(--sp-8); overflow-wrap: anywhere; }
.shared-ref p { margin: var(--sp-2) 0 0; }
.shared-files { margin: 0; padding-left: var(--sp-16); overflow-wrap: anywhere; }
.shared-reply { margin-top: var(--sp-20); padding: var(--sp-12) var(--sp-12) var(--sp-16); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.shared-reply h3 { margin-top: 0; }
.shared-gone { margin-top: var(--sp-44); text-align: center; }
.shared-gone h1 { font-size: var(--fs-xl); }

/* A reviewer's submittal portal (portal.js, app/portal.py). */
.portal-page { max-width: 52rem; }
.portal-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-8); margin: var(--sp-12) 0; }
.portal-count { display: flex; flex-direction: column; padding: var(--sp-8) var(--sp-12); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); }
.portal-count strong { font-family: var(--mono); font-size: var(--fs-xl); }
.portal-count span { font-size: var(--fs-xs); color: var(--text-faint); }
.portal-item { margin-top: var(--sp-12); padding: var(--sp-12) var(--sp-12); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); }
.portal-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-8); }
.portal-item-title { flex: 1 1 14rem; min-width: 0; font-weight: 400; overflow-wrap: anywhere; }
.portal-item .shared-reply { background: var(--bg); }
.portal-desc { margin-top: var(--sp-8); }
.portal-decided { margin-top: var(--sp-8); padding: var(--sp-8) var(--sp-12); border: 1px solid var(--border); border-radius: var(--radius); }
.portal-waiting { margin-top: var(--sp-12); }
@media (max-width: 560px) { .portal-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The job's side of the portal: the register's filters and a reviewer's decision waiting (submittals.js). */
.sm-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.sm-filters .chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); }
.sm-filters .select { max-width: 14rem; }
.sm-proposal { margin: var(--sp-8) 0; padding: var(--sp-8) var(--sp-12); border: 1px solid var(--accent-line); border-radius: var(--radius); }
.sm-waiting { color: var(--accent); font-size: var(--fs-xs); font-weight: 400; }
.pt-link { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); }
.pt-link input { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: var(--fs-sm); }
.shared-foot { margin-top: var(--sp-24); text-align: center; }

@media (max-width: 620px) {
  .sent-times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shared-fields { grid-template-columns: minmax(0, 1fr); }
  .send-link-row { flex-direction: column; }
}

/* ---------- operator screen (operator.js) ---------- */
/* Colors are the shared tokens only, so every color scheme, light and dark,
   applies here too. Near the limit is amber and at it red, as elsewhere. */

.op-view { max-width: 1280px; }
.op-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-16); margin-bottom: var(--sp-12);
}
.op-head p { margin: var(--sp-4) 0 0; max-width: 60ch; }

.op-bar { display: flex; flex-wrap: wrap; gap: var(--sp-8); align-items: flex-end; }
.op-period {
  display: inline-flex; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.op-period button {
  font: inherit; font-size: var(--fs-base); cursor: pointer;
  background: var(--surface); color: var(--text-dim);
  border: none; padding: var(--sp-8) var(--sp-12);
}
.op-period button + button { border-left: 1px solid var(--border); }
.op-period button:hover { color: var(--text); background: var(--surface-2); }
.op-period button.active { background: var(--accent); color: var(--on-accent); }
.op-period button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.op-custom { display: flex; gap: var(--sp-8); align-items: flex-end; flex-wrap: wrap; }
.op-custom .field { margin: 0; }
.op-custom input { padding: var(--sp-4) var(--sp-8); }
#op-csv { margin-left: auto; text-decoration: none; }
.op-range { margin: var(--sp-8) 0 0; }

#op-body { transition: opacity .15s; }
#op-body.op-busy { opacity: .55; }

.op-tiles {
  display: grid; gap: var(--sp-8); margin: var(--sp-16) 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
}
.op-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-8) var(--sp-12);
  display: grid; gap: var(--sp-2); align-content: start;
}
.op-tile-label { font-size: var(--fs-xs); font-weight: 400; color: var(--text-dim); }
.op-tile-value {
  font-size: var(--fs-xl); font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.op-tile-sub { font-size: var(--fs-xs); color: var(--text-faint); overflow-wrap: anywhere; }
.op-tile.warn { background: var(--amber-soft); border-color: var(--amber-line); }
.op-tile.warn .op-tile-value { color: var(--amber); }
.op-note { margin-bottom: var(--sp-16); }

.op-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto;
}
.op-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.op-table th, .op-table td {
  padding: var(--sp-8) var(--sp-8); text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.op-table thead th {
  background: var(--surface-2); color: var(--text-dim);
  font-size: var(--fs-xs); font-weight: 400; white-space: nowrap;
}
.op-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-sort {
  font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer;
}
.op-sort:hover, .op-table th[aria-sort="ascending"] .op-sort,
.op-table th[aria-sort="descending"] .op-sort { color: var(--text); }
.op-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.op-arrow { color: var(--accent); margin-left: var(--sp-4); }
.op-row:hover > td { background: var(--surface-2); }
/* A company near or at its limit carries a colored edge as well as its bar,
   so it stands out in a long table; the tag beside the count says it in words
   for anyone who can't tell the colors apart. */
.op-row.near > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.op-row.reached > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.op-co { text-align: left; font-weight: 400; overflow-wrap: anywhere; }
.op-table tfoot td { background: var(--surface-2); border-bottom: 0; font-weight: 600; }

.op-meter { min-width: 9.5rem; }
.op-meter-text { font-variant-numeric: tabular-nums; }
.op-meter .progress { margin-top: var(--sp-4); }
.op-meter.near .op-meter-text { color: var(--amber); }
.op-meter.near .progress > div { background: var(--amber); }
.op-meter.reached .op-meter-text { color: var(--red); font-weight: 400; }
.op-meter.reached .progress > div { background: var(--red); }
.op-meter.near .op-flag { color: var(--amber); border-color: var(--amber-line); }
.op-meter.reached .op-flag { color: var(--red); border-color: var(--red-line); }
.op-foot { margin-top: var(--sp-8); }
/* Sorting by header needs a header row; phones get this instead. */
.op-sort-phone { display: none; }

/* One company */
.op-detail-head h3 { font-size: var(--fs-lg); margin: var(--sp-8) 0 var(--sp-4); overflow-wrap: anywhere; }
.op-detail-head .plan-row { margin-bottom: 0; }
.op-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-12) var(--sp-16);
}
.op-panel > h4 { margin-bottom: var(--sp-8); }
.op-cols {
  display: grid; gap: var(--sp-16); margin-top: var(--sp-16);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.op-chart {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--sp-8); row-gap: var(--sp-4);
}
.op-chart-scale {
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: right; font-size: var(--fs-xs); color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.op-bars {
  display: flex; align-items: stretch; gap: 2px; height: 170px;
  border-bottom: 1px solid var(--border);
}
.op-bars.dense { gap: 1px; }
.op-col {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.op-col:hover { background: var(--surface-2); }
.op-fill { min-height: 2px; }
.op-fill:first-child { border-radius: 2px 2px 0 0; }
.op-fill.answers { background: var(--accent); }
.op-fill.other { background: var(--amber); }
.op-chart-axis {
  display: flex; justify-content: space-between; gap: var(--sp-16);
  font-size: var(--fs-xs); color: var(--text-faint);
}
.op-legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-16); margin-top: var(--sp-8);
  font-size: var(--fs-sm); color: var(--text-dim);
}
.op-key {
  display: inline-block; width: .7rem; height: .7rem; border-radius: 2px;
  margin-right: var(--sp-4); vertical-align: -1px;
}
.op-key.answers { background: var(--accent); }
.op-key.other { background: var(--amber); }

.op-list-wrap { overflow-x: auto; }
.op-list { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.op-list th, .op-list td {
  padding: var(--sp-4) var(--sp-8); text-align: left; border-bottom: 1px solid var(--border);
}
.op-list th { font-size: var(--fs-xs); font-weight: 400; color: var(--text-faint); }
.op-list tr:last-child td { border-bottom: 0; }
.op-list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-list .who { overflow-wrap: anywhere; }

.op-editor { margin-top: var(--sp-16); max-width: 680px; }
.op-editor .notice { margin-bottom: var(--sp-12); }
.op-limit {
  margin: 0; padding: var(--sp-8) var(--sp-12) var(--sp-12);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: grid; gap: var(--sp-8);
}
.op-limit legend { padding: 0 var(--sp-4); font-size: var(--fs-sm); font-weight: 400; color: var(--text-dim); }
.op-limit .check { color: var(--text); white-space: normal; }
.op-limit-row { display: flex; gap: var(--sp-8); align-items: center; flex-wrap: wrap; }
.op-limit-row input[type="number"] { width: 10rem; }

/* Layouts: density follows the Appearance setting like the rest of the page. */
html[data-density="compact"] .op-table th,
html[data-density="compact"] .op-table td { padding: var(--sp-4) var(--sp-8); }
html[data-density="compact"] .op-tile { padding: var(--sp-8) var(--sp-8); }
html[data-density="spacious"] .op-period button { min-height: 44px; }
html[data-density="spacious"] .op-table td { padding: var(--sp-8) var(--sp-12); }

/* Phones: each company becomes a card of labelled lines, since nine columns
   can't sit side by side, and the sort control above stands in for the
   header row. */
@media (max-width: 700px) {
  .op-head { flex-wrap: wrap; }
  /* Four periods don't fit in one row: two by two, the 1px gap drawing the
     dividers in the border color. */
  .op-period {
    display: grid; grid-template-columns: 1fr 1fr; width: 100%;
    gap: 1px; background: var(--border);
  }
  .op-period button + button { border-left: 0; }
  #op-csv { margin-left: 0; }
  .op-sort-phone { display: flex; gap: var(--sp-8); align-items: flex-end; margin-bottom: var(--sp-8); }
  .op-sort-phone .field { margin: 0; flex: 1; }
  .op-table-wrap { overflow-x: visible; }
  .op-table thead { display: none; }
  .op-table, .op-table tbody, .op-table tfoot, .op-table tr { display: block; }
  .op-table tr { padding: var(--sp-8) var(--sp-12); border-bottom: 1px solid var(--border); }
  .op-table tfoot tr { border-bottom: 0; background: var(--surface-2); }
  .op-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-16);
    padding: var(--sp-2) 0; border: 0; text-align: right; white-space: normal;
  }
  .op-table td::before {
    content: attr(data-label); flex: none;
    font-size: var(--fs-sm); color: var(--text-dim); text-align: left;
  }
  .op-table td:empty { display: none; }
  .op-table td.op-name {
    justify-content: flex-start; flex-wrap: wrap; gap: var(--sp-8);
    font-size: var(--fs-md); text-align: left; padding-bottom: var(--sp-4);
  }
  .op-table td.op-name::before { content: none; }
  .op-table tfoot td { background: none; }
  .op-row:hover > td { background: none; }
  .op-row.near > td:first-child, .op-row.reached > td:first-child { box-shadow: none; }
  .op-row.near { box-shadow: inset 3px 0 0 var(--amber); }
  .op-row.reached { box-shadow: inset 3px 0 0 var(--red); }
  .op-meter { min-width: 0; flex: 0 1 13rem; }
  .op-bars { height: 130px; }
}

/* ---------- answer reuse (reuse.js) ---------- */
/* An answer handed back from an earlier one: a quiet note above the answer
   card, in the scheme's own colors, with "Ask again" beside it. */
.reuse-note {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-8) var(--sp-12); flex-wrap: wrap; color: var(--text-dim);
}
.reuse-note .btn { padding: var(--sp-4) var(--sp-12); font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- developer view as */

/* The bar sits in the page's flow at the very top and the app takes what is left,
   so it pushes everything down instead of covering the sidebar or the tabs. Amber:
   the color already used for "mind this". --dev-bar-h is measured (devmode.js), so
   the window-sized overlays start under it however many lines it wraps to. */
:root { --dev-bar-h: 0px; }

.dev-bar {
  position: relative; z-index: 75;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-12);
  padding: var(--sp-4) var(--sp-16);
  background: var(--amber-soft); color: var(--text);
  border-bottom: 1px solid var(--amber-line);
  font-size: var(--fs-sm);
}
.dev-bar-who { min-width: 0; overflow-wrap: anywhere; }
.dev-bar-tag { color: var(--amber); font-weight: 400; }
.dev-bar-switch { margin-left: auto; max-width: 18rem; padding-top: var(--sp-2); padding-bottom: var(--sp-2); font-size: var(--fs-sm); }
.dev-bar-back { padding: var(--sp-2) var(--sp-8); font-size: var(--fs-sm); white-space: nowrap; }

body.dev-viewing { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.dev-viewing .app { flex: 1; min-height: 0; height: auto; }
body.dev-viewing .modal-backdrop,
body.dev-viewing .vw,
body.dev-viewing .fl-photo-view { top: var(--dev-bar-h); }

.dev-people { display: grid; gap: var(--sp-2); }
.dev-person {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12);
  padding: var(--sp-8) 0; border-bottom: 1px solid var(--border);
}
.dev-person:last-child { border-bottom: none; }
.dev-person-who { display: grid; gap: var(--sp-2); min-width: 0; }
.dev-person .btn { flex: none; }
.dev-progress { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-8); }
.dev-progress progress { width: 100%; height: .5rem; accent-color: var(--accent); }
.dev-note { margin-top: var(--sp-8); }
.dev-claude { margin: 0; }

@media (max-width: 820px) {
  .dev-bar { padding: var(--sp-4) var(--sp-12); }
  body.dev-viewing .app .sidebar,
  body.dev-viewing .app.drawer-open .drawer-backdrop { top: var(--dev-bar-h); }
  /* min-width: 0, or the longest option holds the select at its own width. */
  .dev-bar-switch { margin-left: 0; flex: 1 1 8rem; min-width: 0; max-width: none; }
}

/* ---------------------------------------------------------------- overview */
/* The project overview tab (overview.js). */
.overview { margin-top: 0; }
.ov-section {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); margin-bottom: var(--sp-8);
}
.ov-section > summary {
  display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap;
  padding: var(--sp-12) var(--sp-16); cursor: pointer; list-style: none; font-weight: 400;
}
.ov-section > summary::-webkit-details-marker { display: none; }
.ov-section > summary::before {
  content: "▸"; color: var(--text-faint); transition: transform .15s ease;
}
.ov-section[open] > summary::before { transform: rotate(90deg); }
.ov-section > summary:hover { background: var(--surface-2); }
.ov-note { font-weight: 400; }
.ov-body { padding: var(--sp-2) var(--sp-12) var(--sp-12) var(--sp-28); }
.ov-list { list-style: none; margin: 0; padding: 0; }
.ov-list > li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8);
  padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-soft);
}
.ov-list > li:last-child { border-bottom: 0; }
.ov-list.ov-cols { columns: 2 260px; column-gap: var(--sp-24); }
.ov-list.ov-cols > li { break-inside: avoid; }
.ov-what { font-weight: 400; color: var(--text); }
.ov-value { color: var(--accent); }
.ov-text { flex-basis: 100%; font-size: var(--fs-base); color: var(--text-dim); }
.ov-fact-group h5 { margin: var(--sp-12) 0 var(--sp-2); font-size: var(--fs-sm); color: var(--text-dim); }
.ov-fact-group:first-child h5 { margin-top: var(--sp-4); }
.ov-details { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-4) var(--sp-16); margin: var(--sp-4) 0; }
.ov-details dt { color: var(--text-dim); }
.ov-details dd { margin: 0; }
.link.small, .small.link { font-size: var(--fs-sm); }

.cmd-choices { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-8); }
@media (max-width: 640px) {
  .ov-body { padding-left: var(--sp-12); }
  .ov-details { grid-template-columns: 1fr; gap: var(--sp-2); }
  .ov-details dd { margin-bottom: var(--sp-4); }
}

/* ---------------------------------------------------------------- where it's found (10-29) */
/* DRAWINGS / SPECS / CONTRACTS on every answer, the sources grouped under them,
   disagreements in plain words and "Send to RFIs" (app.js renderAnswer). */
.cat-label {
  display: inline-block; white-space: nowrap; line-height: 1.4;
  font-size: var(--fs-xs); font-weight: 400; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 4px; padding: var(--sp-2) var(--sp-8);
}
.src-link {
  font: inherit; font-size: var(--fs-base); text-align: left; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; overflow-wrap: anywhere;
  text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 2px;
}
.src-link:hover { text-decoration-color: currentColor; }

.found-in {
  display: grid; gap: var(--sp-8); margin-top: var(--sp-12); padding: var(--sp-8) var(--sp-12);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.found-row {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--sp-8);
  align-items: baseline; font-size: var(--fs-base);
}
.found-row .cat-label { justify-self: start; }
.found-row.none .cat-label { color: var(--text-faint); background: var(--surface); border-color: var(--border); }
.found-where { min-width: 0; }

.send-rfi { display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-12); align-items: center; margin-top: var(--sp-12); }
.answer-card.not-listed .answer-lead > p:first-child { font-weight: 600; font-size: var(--fs-md); }

/* Severity is only the colour of the left edge. */
.disagree {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--amber-line); border-radius: var(--radius); padding: var(--sp-12) var(--sp-16);
}
.disagree.sev-high { border-left-color: var(--red-line); }
.disagree-head { margin: 0 0 var(--sp-8); font-weight: 600; }
.disagree-values { list-style: none; margin: 0 0 var(--sp-8); padding: 0; display: grid; gap: var(--sp-8); }
.disagree-value { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8); align-items: baseline; }
.disagree-val { font-family: var(--mono); color: var(--text); }
.disagree-hint { margin: 0; font-size: var(--fs-base); color: var(--text-dim); }

.src-group { margin-bottom: var(--sp-12); }
.src-cat { margin: 0 0 var(--sp-8); }
.src-none { margin: 0 0 var(--sp-8); font-size: var(--fs-base); color: var(--text-faint); }
.src-row .source-top { align-items: flex-start; }
.src-open {
  flex: 1 1 14rem; min-width: 0; display: grid; gap: var(--sp-2); text-align: left;
  font: inherit; color: var(--text); background: none; border: none; padding: 0; cursor: pointer;
}
.src-open:hover .src-place { color: var(--accent); text-decoration: underline; }
.src-place { font-weight: 400; font-size: var(--fs-base); overflow-wrap: anywhere; }
.src-doc { font-size: var(--fs-sm); color: var(--text-faint); overflow-wrap: anywhere; }
.src-row .source-excerpt { margin-top: var(--sp-8); }
.src-other { margin-top: var(--sp-8); }
.src-other > summary { cursor: pointer; font-size: var(--fs-base); color: var(--text-dim); margin-bottom: var(--sp-8); }

@media (max-width: 600px) {
  .found-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
  .disagree { padding: var(--sp-12) var(--sp-12); }
}

/* ---------------------------------------------------------------- Ask answers folded (11-02) */
/* His list: "turn them into drop downs so it doesnt clutter everything", "keep it
   minimalistic but information enough". The short answer stays on screen; Found
   in, More detail, Disagreements and Sources fold under it, closed, a row each
   that a thumb can hit on a phone (app.js renderAnswer). */
.answer-lead { font-size: var(--fs-md); }
.answer-lead > p:first-child { margin-top: 0; }
.ans-flags { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8); margin-top: var(--sp-8); }
.ans-flag {
  font: inherit; font-size: var(--fs-base); font-weight: 400; text-align: left; cursor: pointer;
  color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-line);
  border-radius: var(--radius-sm); padding: var(--sp-4) var(--sp-8);
}
.ans-flag.quiet { color: var(--text-dim); background: var(--surface-2); border-color: var(--border); font-weight: 400; }
/* "Did you mean": how a casual question was read, one click from asking it that way. */
.did-you-mean {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4) var(--sp-8); margin: 0 0 var(--sp-8);
  padding: var(--sp-8) var(--sp-12); border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: var(--radius-sm); color: var(--text-dim);
}
.did-you-mean .dym-q {
  font: inherit; font-weight: 400; color: var(--accent); background: none; border: 0; padding: 0;
  cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px;
}
.did-you-mean .dym-q:hover { text-decoration-thickness: 2px; }
.ans-folds { display: grid; margin-top: var(--sp-12); }
.ans-folds:empty { display: none; }
/* Lines between the folds, not a box around each: they sit inside the answer's own card. */
.ans-fold { border-top: 1px solid var(--border-soft); min-width: 0; }
.ans-fold > summary,
.disagree > summary,
.src-row > summary {
  display: flex; align-items: baseline; gap: var(--sp-4) var(--sp-8); flex-wrap: wrap;
  cursor: pointer; list-style: none;
}
.ans-fold > summary { align-items: center; padding: var(--sp-8) var(--sp-12); min-height: 2.75rem; font-weight: 400; }
.ans-fold > summary::-webkit-details-marker,
.disagree > summary::-webkit-details-marker,
.src-row > summary::-webkit-details-marker { display: none; }
.ans-fold > summary::before,
.disagree > summary::before,
.src-row > summary::before { content: "▸"; color: var(--text-faint); transition: transform .15s ease; }
.ans-fold[open] > summary::before,
.disagree[open] > summary::before,
.src-row[open] > summary::before { transform: rotate(90deg); }
.ans-fold > summary:hover, .disagree > summary:hover, .src-row > summary:hover { background: var(--surface-2); }
.ans-fold-note { font-weight: 400; font-size: var(--fs-sm); color: var(--text-faint); }
.ans-fold-body { padding: var(--sp-2) var(--sp-12) var(--sp-12); min-width: 0; }
.ans-fold .found-in { margin-top: 0; }
.ans-fold .sp-detail { margin-top: 0; border-top: 0; padding-top: 0; }
.ans-fold .sp-gaps { margin-top: 0; }
.ans-sub { margin: var(--sp-12) 0 var(--sp-4); font-size: var(--fs-sm); color: var(--text-dim); }
.found-where { display: grid; gap: var(--sp-4); }
.found-said { margin-top: var(--sp-8); font-size: var(--fs-base); }

/* A disagreement: the subject and each side's value on one row, opening to where each is. */
.ans-fold .disagree { padding: 0; margin-bottom: var(--sp-8); }
.disagree > summary { padding: var(--sp-8) var(--sp-12); }
.disagree .disagree-head { margin: 0; }
.disagree-short { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4) var(--sp-8); font-size: var(--fs-base); }
.disagree-says { display: inline-flex; align-items: baseline; gap: var(--sp-4); }
.disagree-vs { color: var(--text-faint); font-size: var(--fs-sm); }
.disagree > .disagree-values, .disagree > .disagree-hint { margin: var(--sp-2) var(--sp-12) var(--sp-8); }
.disagree-once { margin-top: var(--sp-8); }

/* A source: its id, place and page on one row, opening to the page link, the badge and the passage. */
.src-row, html[data-density="compact"] .src-row { padding: 0; }
.src-row > summary { padding: var(--sp-8) var(--sp-12); }
.src-page { font-size: var(--fs-sm); color: var(--text-faint); white-space: nowrap; }
.src-row > .source-top, .src-row > .rev-note, .src-row > .source-excerpt, .src-row > .source-actions {
  margin-left: var(--sp-12); margin-right: var(--sp-12);
}
.src-row > .source-actions { margin-bottom: var(--sp-8); }
.src-open .src-doc { color: var(--accent); font-size: var(--fs-sm); }
.src-open:hover .src-doc { text-decoration: underline; }

@media (max-width: 600px) {
  .ans-fold > summary { padding: var(--sp-8) var(--sp-8); }
  .ans-fold-body { padding: var(--sp-2) var(--sp-8) var(--sp-12); }
  .disagree > summary, .src-row > summary { padding: var(--sp-8) var(--sp-8); }
  .src-row > .source-top, .src-row > .rev-note, .src-row > .source-excerpt, .src-row > .source-actions,
  .disagree > .disagree-values, .disagree > .disagree-hint { margin-left: var(--sp-8); margin-right: var(--sp-8); }
}

/* ---------------------------------------------------------------- schedule (10-29) */
/* The Schedule tab (schedule.js): Week, Month, Year and the lookahead, all the
   same events. Shared tokens only, so light, dark and every team scheme follow. */
.panel[data-panel="schedule"] { max-width: none; }
.sch-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-12); }
.sch-toolbar .subtabs { margin-bottom: 0; }
.sch-toolbar .subtab.active { color: var(--accent); }
.sch-nav { display: inline-flex; align-items: center; gap: var(--sp-4); }
.sch-nav .btn { padding: var(--sp-4) var(--sp-8); }
.sch-title { margin: 0 var(--sp-4); font-size: var(--fs-md); white-space: nowrap; }
.sch-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-left: auto; }
/* The lookahead's "4+": the count of weeks, a week at a time up to a year (11-02). */
.sch-more-weeks { display: inline-flex; align-items: center; gap: var(--sp-4); }
.sch-more-weeks[hidden] { display: none; }
.sch-more-weeks .btn { padding: var(--sp-4) var(--sp-8); }
.sch-weeks-count { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-base); color: var(--text-dim); }
.sch-weeks-count input { width: 4.2rem; padding: var(--sp-4) var(--sp-4); }
.sch-new {
  width: 38px; height: 38px; padding: 0; border-radius: 50%;
  font-size: var(--fs-xl); line-height: 1; display: inline-grid; place-items: center;
}
.sch-zone { margin: var(--sp-8) 0 0; }
.sch-empty { padding: var(--sp-20); text-align: center; margin: 0; }

.sch-tell { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-12); }
.sch-tell-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm); padding: var(--sp-8) var(--sp-8); font-size: var(--fs-base);
}
.sch-tell-row > span { flex: 1 1 16rem; min-width: 0; }
.sch-tell-row .btn { padding: var(--sp-4) var(--sp-8); }

/* An event: a soft bar with a strong edge, its kind in the bar's style and its
   word. An inspection's result is coloured and always says itself. */
.sch-ev {
  display: flex; align-items: center; gap: var(--sp-4); min-width: 0; position: relative; z-index: 1;
  padding: 0 var(--sp-4); margin: 1px 2px; font-size: var(--fs-sm); line-height: 1.3; cursor: pointer; overflow: hidden;
  color: var(--text); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-left: 3px solid var(--accent);
  border-radius: 4px; user-select: none; -webkit-user-select: none;
}
.sch-ev:hover { border-color: var(--accent); }
.sch-ev:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sch-ev.kind-delivery { background: var(--surface-3); border-color: var(--border); border-left-color: var(--text-dim); }
.sch-ev.kind-meeting { background: var(--surface); border-style: dashed; border-left-style: solid; }
.sch-ev.kind-milestone { background: var(--surface-2); border-color: var(--border); border-left-color: var(--text); font-weight: 400; }
.sch-ev.kind-inspection { background: var(--surface); border-color: var(--accent); border-left-color: var(--accent); font-weight: 400; }
.sch-ev.passed { background: var(--green-soft); border-color: var(--green); }
.sch-ev.failed { background: var(--red-soft); border-color: var(--red); }
.sch-ev.follow-up { background: var(--amber-soft); border-color: var(--amber); }
.sch-ev.moving { z-index: 3; box-shadow: var(--shadow); }
/* An announcement on the day it was posted (11-02): quiet, dotted, and it says
   so. Nothing to pull; clicking opens it in Updates. */
.sch-ev.kind-update { background: var(--surface-2); border: 1px dotted var(--text-dim); border-left: 3px solid var(--text-dim); }
.sch-editable .sch-ev.kind-update { cursor: pointer; touch-action: auto; }
.sch-mark.update { color: var(--text-dim); border-color: var(--border); background: var(--surface); }
.sch-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-at { flex: none; color: var(--text-dim); font-size: .92em; }
.sch-diamond { flex: none; }
.sch-mark {
  flex: none; font-size: var(--fs-xs); font-weight: 400; line-height: 1.25;
  padding: 0 var(--sp-4); border-radius: 3px; border: 1px solid transparent;
}
.sch-mark.passed { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.sch-mark.failed { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.sch-mark.follow-up { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.sch-mark.scheduled { color: var(--text-dim); border-color: var(--border); }

/* What can be pulled. Only drawn for people who may edit. */
.sch-editable .sch-ev { cursor: grab; touch-action: none; }
.sch-body.dragging, .sch-body.dragging .sch-ev { cursor: grabbing; }
.sch-edge { position: absolute; z-index: 2; touch-action: none; }
.sch-edge.x-start, .sch-edge.x-end { top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.sch-edge.x-start { left: 0; }
.sch-edge.x-end { right: 0; }
.sch-edge.y-start, .sch-edge.y-end { left: 0; right: 0; height: 8px; cursor: ns-resize; }
.sch-edge.y-start { top: 0; }
.sch-edge.y-end { bottom: 0; }

/* Month */
.sch-month, .sch-grid, .sch-la-scroll, .sch-day-head {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.sch-month { overflow: hidden; }
.sch-dow, .sch-mweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.sch-dow {
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 400; color: var(--text-dim);
}
.sch-dow span { padding: var(--sp-4) var(--sp-8); }
.sch-mweek + .sch-mweek { border-top: 1px solid var(--border); }
.sch-mcell {
  display: flex; align-items: flex-start; justify-content: space-between; min-width: 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-8); border-left: 1px solid var(--border);
}
.sch-mcell:first-of-type { border-left: 0; }
.sch-mcell.out { background: var(--surface-2); }
.sch-mcell.out .sch-num { color: var(--text-faint); }
.sch-num { font-size: var(--fs-sm); font-weight: 400; min-width: 1.5em; text-align: center; border-radius: 99px; }
.sch-mcell.today .sch-num { background: var(--accent); color: var(--on-accent); }
.sch-more {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: var(--fs-xs); font-weight: 400; color: var(--accent); padding: 0 var(--sp-8);
}
.sch-more:hover { text-decoration: underline; }

/* A day opened from the month, large, in its place. */
.sch-day { display: grid; gap: var(--sp-8); }
.sch-day-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); padding: var(--sp-4) var(--sp-8) var(--sp-4) var(--sp-12); }
.sch-day-head h4 { font-size: var(--fs-md); margin: 0; }
.sch-exit { display: inline-flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-8); }
.sch-exit svg { width: 15px; height: 15px; }

/* Week and the expanded day: the all-day row over the hour grid. */
.sch-grid { --gutter: 3.6rem; overflow: hidden; }
.sch-head, .sch-band, .sch-time {
  display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr));
}
.sch-head { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-dim); }
.sch-dayname { padding: var(--sp-4) var(--sp-8); border-left: 1px solid var(--border); }
.sch-dayname strong { color: var(--text); }
.sch-dayname.today strong { color: var(--accent); }
.sch-band { border-bottom: 1px solid var(--border); min-height: 1.6rem; }
.sch-gutter { font-size: var(--fs-xs); color: var(--text-dim); padding: var(--sp-4) var(--sp-4); text-align: right; }
.sch-bandcell { border-left: 1px solid var(--border); }
.sch-time { position: relative; }
.sch-hours { position: relative; }
.sch-hours span {
  position: absolute; right: .35rem; font-size: var(--fs-xs); color: var(--text-dim);
  transform: translateY(1px); white-space: nowrap;
}
.sch-col {
  position: relative; border-left: 1px solid var(--border); min-width: 0;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 100% var(--hour);
}
.sch-col.today, .sch-la-cell.today, .sch-bandcell.today { background-color: var(--accent-soft); }
.sch-timed {
  position: absolute; display: block; margin: 0; padding: var(--sp-2) var(--sp-4); box-sizing: border-box;
  overflow: hidden;
}
.sch-timed .sch-name { display: block; white-space: normal; }
.sch-timed .sch-at { display: block; }
.sch-timed .sch-mark { display: inline-block; }

/* Year */
.sch-year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-12); }
@media (max-width: 1000px) { .sch-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sch-ymonth {
  display: flex; flex-direction: column; justify-content: flex-start;
  width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-8) var(--sp-8);
}
.sch-ymonth:hover, .sch-ymonth:focus-visible { border-color: var(--accent); outline: none; }
.sch-yname { display: block; font-weight: 400; margin-bottom: var(--sp-4); }
.sch-ygrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: var(--fs-xs); text-align: center; line-height: 1.55; }
.sch-ygrid .busy { font-weight: 400; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; background: var(--accent-soft); border-radius: 3px; }
.sch-ygrid .today { outline: 1px solid var(--accent); border-radius: 3px; }

/* The lookahead: a sheet of trades by working days. */
.sch-la-scroll { overflow-x: auto; }
.sch-la { --name: 11rem; min-width: 640px; }
.sch-la-row {
  display: grid; grid-template-columns: var(--name) repeat(var(--cols), minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.sch-la-top { background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-dim); }
.sch-la-top .sch-la-name { font-weight: 400; }
/* Longer than six weeks, a column is a week: its Monday's date under its month. */
.sch-la-month {
  padding: var(--sp-2) var(--sp-4); border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden;
}
.sch-la-month.week { border-left: 2px solid var(--text-faint); }
.sch-la-wk { text-align: center; padding-inline: 0; }
.sch-la-name {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: var(--sp-2) var(--sp-8);
  font-size: var(--fs-base); font-weight: 400; background: var(--surface-2);
}
.sch-la-input { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-base); font-weight: 400; background: transparent; border-color: transparent; }
.sch-la-input:hover { border-color: var(--border); }
.sch-la-del { border: 0; background: none; cursor: pointer; color: var(--text-faint); font-size: var(--fs-md); line-height: 1; padding: 0 var(--sp-2); }
.sch-la-del:hover { color: var(--red); }
.sch-la-date { display: grid; padding: var(--sp-2) var(--sp-4); line-height: 1.25; border-left: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.sch-la-date strong { color: var(--text); font-weight: 400; }
.sch-la-date.today strong { color: var(--accent); }
.sch-la-cell { position: relative; border-left: 1px solid var(--border); min-width: 0; }
/* A short bar's title runs on past its end, over empty days. */
.sch-la .sch-ev { overflow: visible; }
.sch-la .sch-name { overflow: visible; text-overflow: clip; }
.sch-la-cell.week, .sch-la-date.week { border-left: 2px solid var(--text-faint); }
.sch-la-new {
  position: absolute; top: 2px; left: 2px; z-index: 4; width: 11rem; max-width: none;
  padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); box-shadow: var(--shadow);
}
.sch-la-add { padding: var(--sp-4) var(--sp-8); }
.sch-la-add .btn { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-base); }
.sch-la-add .sch-la-input { max-width: 14rem; background: var(--surface); border-color: var(--border); }
.sch-print-head { display: none; }

/* The event form, the status strip, and the people picker. */
.sch-status { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-bottom: var(--sp-12); }
.sch-status-btn { padding: var(--sp-4) var(--sp-12); }
.sch-status-btn.on { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--text-dim); }
.sch-status-btn.on.passed { background: var(--green-soft); color: var(--green); border-color: var(--green); box-shadow: none; }
.sch-status-btn.on.failed { background: var(--red-soft); color: var(--red); border-color: var(--red); box-shadow: none; }
.sch-status-btn.on.follow-up { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); box-shadow: none; }
.sch-followup {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: var(--sp-8); align-items: end;
  margin-bottom: var(--sp-12); padding: var(--sp-8) var(--sp-8); border-radius: var(--radius-sm);
  background: var(--amber-soft); border: 1px solid var(--amber-line);
}
.sch-followup .field { margin: 0; }
.sch-followup[hidden] { display: none; }
.sch-allday { display: inline-flex; margin-bottom: var(--sp-8); }
#se-kind, #se-itype { width: 100%; }
.sch-when { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-8); }
.sch-assign, .sch-ask { margin-bottom: var(--sp-12); font-size: var(--fs-base); }
.sch-assign > summary, .sch-ask > summary { cursor: pointer; font-weight: 400; color: var(--text-dim); margin-bottom: var(--sp-4); }
.sch-pick {
  display: grid; gap: var(--sp-2); max-height: 15rem; overflow-y: auto; padding: var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.sch-pick-bar { display: flex; align-items: center; gap: var(--sp-12); margin-bottom: var(--sp-4); }
.sch-pick-bar .muted { margin-left: auto; }
.sch-pick-row { display: flex; align-items: center; gap: var(--sp-8); padding: var(--sp-4) var(--sp-4); border-radius: var(--radius-sm); cursor: pointer; }
.sch-pick-row:hover { background: var(--surface-2); }
.sch-pick-row input { width: auto; margin: 0; flex: none; }
/* Told already about the event as it stands: ticked, and not sent it twice. */
.sch-pick-row.told { cursor: default; opacity: .75; }
.sch-tell-line { margin: var(--sp-4) 0 0; }
/* "Send update": a small window over the event's editor, which stays open and
   as it was underneath (11-02). Above the modal, below the toasts. */
.sch-window { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: var(--sp-16); }
.sch-window-box {
  display: flex; flex-direction: column; gap: var(--sp-8); width: min(26rem, 100%); max-height: min(80vh, 34rem);
  padding: var(--sp-12) var(--sp-16); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.sch-window-title { margin: 0; font-size: var(--fs-md); }
.sch-window-box p { margin: 0; }
.sch-window-people { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.sch-window-people .sch-pick { max-height: none; min-height: 0; flex: 1; }
.sch-window-box .modal-actions { margin-top: var(--sp-8); }
.sch-form-actions { align-items: center; }
.sch-spacer { flex: 1; }
.sch-state { margin-bottom: var(--sp-8); font-weight: 400; }
.sch-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-4) var(--sp-12); margin: 0 0 var(--sp-12); }
.sch-facts dt { color: var(--text-dim); font-size: var(--fs-base); }
.sch-facts dd { margin: 0; white-space: pre-wrap; }

/* A phone reads a list, not a squeezed grid: Week is the agenda, a month's day
   shows how much is on it and opens to its list. */
.sch-agenda-day + .sch-agenda-day { margin-top: var(--sp-12); }
.sch-agenda-day h4 { margin: 0 0 var(--sp-4); font-size: var(--fs-base); }
.sch-agenda-day h4.today { color: var(--accent); }
.sch-day .sch-agenda-day h4 { display: none; }
.sch-agenda-row { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: var(--sp-8); align-items: start; padding: var(--sp-8) var(--sp-8); margin: 0 0 var(--sp-4); font-size: var(--fs-base); }
.sch-agenda-time { color: var(--text-dim); font-size: var(--fs-sm); }
.sch-agenda-what { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-4); min-width: 0; }
.sch-agenda-what .sch-name { white-space: normal; font-weight: 400; }
.sch-mweek.compact { min-height: 0; }
.sch-mweek.compact .sch-mcell {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); min-height: 3rem; padding: var(--sp-4) 0;
  border-top: 0; border-right: 0; border-bottom: 0; background: none; color: var(--text); font: inherit; cursor: pointer;
}
.sch-mweek.compact .sch-mcell.out { background: var(--surface-2); }
/* A day of the month opens wherever it is clicked (11-06), so it looks it, on
   a computer and a phone alike. After the phone's cells, whose button reset
   would otherwise win over the hover. The ring sits inside: the month clips. */
.sch-mweek .sch-mcell[data-day] { cursor: pointer; }
.sch-mweek .sch-mcell[data-day]:hover { background: var(--accent-soft); }
.sch-mweek .sch-mcell[data-day]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sch-count {
  font-size: var(--fs-xs); font-weight: 400; min-width: 1.3em; text-align: center; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
@media (max-width: 640px) {
  .sch-tools { margin-left: 0; width: 100%; }
  .sch-new { margin-left: auto; }
  .sch-title { white-space: normal; }
  .sch-toolbar .subtab { padding: var(--sp-8) var(--sp-8); }
  .sch-year { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-8); }
  .sch-when { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sch-followup { grid-template-columns: minmax(0, 1fr); }
}

/* The lookahead alone, on one landscape page. schedule.js sets sch-printing
   and the zoom just before printing, so printing anything else is untouched.
   Paper is white and ink is dark whatever the screen's scheme is, and the
   bars keep their shading because the words carry the meaning either way. */
@media print {
  @page sch-sheet { size: letter landscape; margin: .4in; }
  html.sch-printing body { page: sch-sheet; }
  html.sch-printing {
    --bg: white !important; --surface: white !important; --surface-2: whitesmoke !important; --surface-3: gainsboro !important;
    --border: darkgray !important; --text: black !important; --text-dim: dimgray !important; --text-faint: gray !important;
    --accent: navy !important; --accent-soft: aliceblue !important; --accent-line: lightsteelblue !important;
    --green: darkgreen !important; --green-soft: honeydew !important; --red: darkred !important; --red-soft: mistyrose !important;
    --amber: saddlebrown !important; --amber-soft: cornsilk !important; background: white; height: auto;
  }
  html.sch-printing body { height: auto; background: white; }
  html.sch-printing .app { display: block; height: auto; }
  html.sch-printing .main { display: block; overflow: visible; padding: 0; background: none; }
  html.sch-printing .sidebar, html.sch-printing .topbar, html.sch-printing .drawer-backdrop,
  html.sch-printing .project-head, html.sch-printing .main-tabs, html.sch-printing .sch-toolbar,
  html.sch-printing .sch-tell, html.sch-printing .sch-la-add, html.sch-printing .sch-la-del,
  html.sch-printing .toast-stack { display: none !important; }
  html.sch-printing .panel { max-width: none; }
  html.sch-printing .sch-print-head { display: flex; justify-content: space-between; gap: var(--sp-16); margin-bottom: var(--sp-8); font-size: 11pt; }
  html.sch-printing .sch-la-scroll { overflow: visible; border-radius: 0; }
  html.sch-printing .sch-la { --name: 9rem; min-width: 0; zoom: var(--sch-print-zoom, 1); }
  html.sch-printing .sch-la-input { border: 0; padding: 0; }
  html.sch-printing .sch-la-row { break-inside: avoid; }
  html.sch-printing .sch-la * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  html.sch-printing .sch-zone { font-size: 8pt; margin: var(--sp-4) 0 0; }
}

/* ---------------------------------------------------------------- updates and forms (10-30) */
/* Updates (updates.js): a register like the RFI tab's, one announcement to a
   row (11-02: the admins' alone, to everyone, so no To column and no replies). */
.upd-badge { background: var(--accent); color: var(--on-accent); }
.upd-bar { align-items: center; }
.upd-search { flex: 1 1 12rem; max-width: 22rem; width: auto; font-size: var(--fs-base); padding: var(--sp-4) var(--sp-8); }
.upd-who { margin: calc(-1 * var(--sp-4)) 0 var(--sp-12); }
.upd-register { display: grid; gap: var(--sp-8); }
.upd-row {
  display: grid; align-items: center; gap: var(--sp-12); padding: var(--sp-8) var(--sp-12);
  grid-template-columns: .55rem minmax(0, 2.6fr) minmax(0, 1.4fr) 7.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.upd-row:hover { border-color: var(--accent-line); }
.upd-row:focus-visible { outline: 2px solid var(--accent); }
.upd-row.upd-head {
  background: none; border: 0; padding-block: 0; cursor: default;
  font-size: var(--fs-xs); color: var(--text-faint);
}
.upd-dot { width: .55rem; height: .55rem; border-radius: 50%; }
.upd-row.unread .upd-dot { background: var(--accent); }
.upd-subject { font-weight: 400; overflow-wrap: anywhere; min-width: 0; }
.upd-row.unread .upd-subject { font-weight: 600; }
.upd-from { min-width: 0; font-size: var(--fs-sm); }
.upd-from .id-chip { font-size: inherit; }
.upd-when, .upd-replies { font-size: var(--fs-sm); color: var(--text-dim); min-width: 0; overflow-wrap: anywhere; }
.upd-replies { font-weight: 400; }
.upd-word { display: none; }
.tag.upd-dm { color: var(--accent); border-color: var(--accent-line); }
#upd-more { margin-top: var(--sp-12); }
.upd-back { display: inline-block; margin-bottom: var(--sp-12); font-size: var(--fs-base); }
.upd-topic-head { margin-bottom: var(--sp-12); }
.upd-topic-head h3 { margin: 0 0 var(--sp-4); font-size: var(--fs-lg); overflow-wrap: anywhere; }
.upd-topic-head p { margin: 0; overflow-wrap: anywhere; }
.upd-thread { display: grid; gap: var(--sp-8); }
.upd-message header { flex-wrap: wrap; align-items: center; }

@media (max-width: 640px) {
  .upd-row.upd-head { display: none; }
  .upd-row { grid-template-columns: .55rem minmax(0, 1fr); gap: var(--sp-2) var(--sp-8); align-items: baseline; }
  .upd-subject, .upd-from, .upd-when { grid-column: 2; }
  .upd-word { display: inline; }
  .upd-search { max-width: none; }
}

/* Forms (formslib.js): a kind's two forms side by side, then what has been filed. */
.fl-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--sp-12); }
.fl-box {
  display: flex; flex-direction: column; gap: var(--sp-8); min-width: 0; padding: var(--sp-12) var(--sp-12);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.fl-box h3 { margin: 0; font-size: var(--fs-md); }
.fl-box p { margin: 0; }
.fl-file { overflow-wrap: anywhere; }
.fl-file .small { display: block; }
.fl-actions { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: auto; padding-top: var(--sp-4); }
.fl-actions a.btn { text-decoration: none; }
.fl-h { margin: var(--sp-20) 0 var(--sp-8); font-size: var(--fs-md); }
#fl-more { margin-top: var(--sp-12); }
.fl-label { display: block; font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: var(--sp-4); padding: 0; }
.fl-required { color: var(--red); }
.fl-field { margin: 0 0 var(--sp-12); min-width: 0; }
fieldset.fl-field { border: 0; padding: 0; }
.fl-checks { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-12); }
.fl-checks .check { white-space: normal; }
.fl-rows { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-8); }
.fl-row { display: grid; grid-template-columns: var(--fl-cols); gap: var(--sp-8); align-items: center; }
.fl-cell { min-width: 0; }
.fl-cell-label { display: none; }
.fl-photos-edit { margin-bottom: var(--sp-8); }
.fl-thumbs { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.fl-thumb { position: relative; display: inline-flex; }
.fl-thumb-open { padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.modal-body .fl-thumb img { width: 7rem; height: 5.25rem; object-fit: cover; }
.fl-thumb-del {
  position: absolute; top: .15rem; right: .15rem; font-size: var(--fs-md); padding: 0 var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.fl-pending { margin: 0 0 var(--sp-8); padding-left: var(--sp-16); }
.fl-by { margin: 0 0 var(--sp-12); }
.fl-read { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: var(--sp-4) var(--sp-12); margin: 0; }
.fl-read dt { font-size: var(--fs-sm); color: var(--text-dim); }
.fl-read dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.fl-table-wrap { overflow-x: auto; }
.fl-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.fl-table th { text-align: left; font-size: var(--fs-sm); color: var(--text-dim); }
.fl-table th, .fl-table td { padding: var(--sp-4) var(--sp-8); border-bottom: 1px solid var(--border); vertical-align: top; }
.fl-photo-view {
  position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: var(--sp-16);
  background: var(--navy-900); cursor: zoom-out;
}
.fl-photo-view[hidden] { display: none; }
.fl-photo-view img { max-width: 100%; max-height: calc(100vh - 2rem); }
.fl-photo-view .icon-btn { position: absolute; top: .5rem; right: .75rem; color: var(--surface-3); font-size: var(--fs-2xl); }

@media (max-width: 640px) {
  .fl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fl-cell { grid-column: 1; }
  .fl-cell-label { display: block; font-size: var(--fs-xs); color: var(--text-dim); }
  .fl-row [data-fl-row-del] { grid-column: 2; grid-row: 1; }
  .fl-read { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
  .fl-read dd { margin-bottom: var(--sp-8); }
}

/* ---------------------------------------------------------------- specifics */
/* Worked-out answers: grades around a feature, reinforcing, pipe slopes (specifics.js). */
.sp-detail { margin-top: var(--sp-12); border-top: 1px solid var(--border); padding-top: var(--sp-12); }
.sp-block + .sp-block { margin-top: var(--sp-16); }
.sp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4) var(--sp-12); margin-bottom: var(--sp-8); }
.sp-grid { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: var(--sp-12); align-items: start; }
.sp-image { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: zoom-in;
  background: var(--surface); }
.sp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.sp-table th, .sp-table td { text-align: left; padding: var(--sp-4) var(--sp-8); border-bottom: 1px solid var(--border);
  vertical-align: top; }
.sp-table th { background: var(--surface-2); font-weight: 400; }
.sp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-wide { margin-top: var(--sp-8); }
.sp-in td { color: var(--text); }
.sp-in td:nth-child(3) { font-weight: 400; color: var(--green); }
.sp-context td { color: var(--text-dim); }
.sp-out td { color: var(--text-faint); }
.sp-flag { background: var(--amber-soft); }
.sp-sub { margin: var(--sp-4) 0 var(--sp-4); font-size: var(--fs-sm);
  color: var(--text-dim); }
.sp-rules { margin: 0 0 var(--sp-8); padding-left: var(--sp-16); font-size: var(--fs-base); }
.sp-rules li { margin: var(--sp-2) 0; }
.sp-gaps { margin-top: var(--sp-16); }
.sp-gaps h4 { margin: 0 0 var(--sp-8); }
.sp-gap { border: 1px solid var(--amber-line); background: var(--amber-soft); border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-8); }
.sp-gap.conflict { border-color: var(--red-line); background: var(--red-soft); }
.sp-gap-head { display: flex; gap: var(--sp-8); align-items: baseline; flex-wrap: wrap; }
.sp-gap p { margin: var(--sp-4) 0; }
.sp-rfi summary { cursor: pointer; font-size: var(--fs-base); color: var(--accent); margin: var(--sp-4) 0; }
.sp-rfi p { font-size: var(--fs-base); }
@media (max-width: 760px) { .sp-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- change order finder */
/* "Find change orders" (changeorders.js). */
.co-opps { display: grid; gap: var(--sp-8); margin-top: var(--sp-8); }
.co-opp { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-8) var(--sp-12);
  background: var(--surface); }
.co-opp.co-low { opacity: .8; }
.co-opp-head { display: flex; gap: var(--sp-8); align-items: baseline; flex-wrap: wrap; }
.co-opp-meta { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-12); align-items: center; margin: var(--sp-4) 0; }
.co-opp-refs { margin-bottom: var(--sp-8); }
.co-opp p { margin: var(--sp-4) 0; }

/* ---------------------------------------------------------------- settings */
/* One window of tabs (app.js openSettings). The bar sticks flush under the
   title bar: it reaches up over the window's 1.25rem top padding (margin) and
   fills it (padding), and sticks that far up (top), so nothing scrolled past
   shows above the tabs. At rest the tabs sit where they always did. */
.settings-tabs {
  margin: calc(-1 * var(--sp-20)) 0 var(--sp-16); padding-top: var(--sp-20); position: sticky; top: calc(-1 * var(--sp-20));
  background: var(--surface); z-index: 1;
}
.settings-panel { min-height: 320px; }
.settings-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-4) var(--sp-16); margin: var(--sp-4) 0; font-size: var(--fs-base); }
.settings-facts dt { color: var(--text-dim); }
.settings-facts dd { margin: 0; }
@media (max-width: 640px) { .settings-facts { grid-template-columns: 1fr; } .settings-facts dd { margin-bottom: var(--sp-8); } }
.security-facts { gap: var(--sp-8) var(--sp-16); }
.tag.security-on { color: var(--green); }
.tag.security-off { color: var(--red); }
.tag.security-info { color: var(--text-dim); }
.sp-scroll { overflow-x: auto; }
.sp-slopes td:nth-child(2), .sp-slopes td:last-child { white-space: nowrap; }
.sp-materials td:first-child { min-width: 10rem; }
.sp-materials td:nth-child(2) { min-width: 16rem; }
.sp-materials td:last-child { white-space: nowrap; }

/* ---------------------------------------------------------- notice clock */
/* The board a PM checks each morning (noticeclock.js). */
.nc-top { display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-16); align-items: center; justify-content: space-between; margin: var(--sp-4) 0 var(--sp-8); }
.nc-counts { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.nc-form select { margin-left: var(--sp-8); }
.nc-list { display: grid; gap: var(--sp-8); margin-top: var(--sp-8); }
.nc-card { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-12); background: var(--surface); }
.nc-card.nc-overdue { border-left-color: var(--red); }
.nc-card.nc-due_soon { border-left-color: var(--amber); }
.nc-card.nc-open { border-left-color: var(--accent); }
.nc-card.nc-sent, .nc-card.nc-not_a_change { opacity: .8; }
.nc-head { display: flex; gap: var(--sp-8); align-items: baseline; flex-wrap: wrap; }
.nc-rule { margin: var(--sp-4) 0 var(--sp-4); }
.nc-hint { margin: var(--sp-4) 0; color: var(--amber); font-weight: 400; }
.nc-deadlines { margin: var(--sp-4) 0 var(--sp-4) var(--sp-16); padding: 0; }
.nc-what p { margin: var(--sp-4) 0; }
.nc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-8); }
.nc-letter { width: 100%; font-family: var(--mono); font-size: var(--fs-base); line-height: 1.45; margin-top: var(--sp-8); }
.nc-done { margin-top: var(--sp-16); }

/* ------------------------------------------------------------- importer */
.imp-link { margin: var(--sp-8) 0 0; }
.imp-summary { margin: 0; padding-left: var(--sp-16); }
.imp-summary li { margin: var(--sp-4) 0; }

/* ---------------------------------------------------------------- profiles, logo (10-29) */
/* "Plumbline" alone in the sidebar head (no motto, 11-02), the company's logo and name
   at the top of the sidebar, who is signed in at its foot, the profile fields,
   the Company window's logo and member cards (app.js). Shared tokens only, so
   light, dark and every color scheme apply. */
.sidebar-head { flex-wrap: wrap; row-gap: 0; }
.sidebar-company {
  display: flex; align-items: center; gap: var(--sp-8); width: 100%; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-8); font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.sidebar-company:hover { border-color: var(--accent-line); }
.sidebar-company:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-company-name {
  min-width: 0; font-size: var(--fs-base); font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.company-logo {
  width: 28px; height: 28px; flex: none; object-fit: contain;
  border-radius: 4px; background: var(--surface);
}
.company-logo.large { width: 72px; height: 72px; border: 1px solid var(--border); padding: 4px; }

.user-row .user-who { display: grid; min-width: 0; }
.user-name {
  font-size: var(--fs-sm); font-weight: 400; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-title {
  font-size: var(--fs-xs); color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.co-logo { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-12); }
.co-logo-empty {
  display: inline-grid; place-items: center; width: 72px; height: 72px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  font-size: var(--fs-xs); color: var(--text-faint);
}
.co-logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8) var(--sp-8); flex: 1; min-width: 200px; }

/* A member row opens that member's card. */
.member-link { cursor: pointer; border-radius: var(--radius-sm); }
.member-link:hover { background: var(--surface-2); }
.member-open {
  display: grid; min-width: 0; padding: 0; text-align: left; cursor: pointer;
  background: none; border: 0; font: inherit; color: inherit;
}
.member-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-open .member-email { display: block; }
.member-card { margin-top: var(--sp-8); }
.member-card .mc-name { font-size: var(--fs-lg); font-weight: 400; }
.member-card .mc-title { color: var(--text-dim); margin-bottom: var(--sp-8); }
.mc-projects .member-row { grid-template-columns: minmax(0, 1fr) auto auto; }

.tl-note .tl-title { font-size: var(--fs-sm); color: var(--text-dim); }

/* ---------------------------------------------------------------- access and notifications (10-29) */
/* Selective access (access.js): the bell at the top of the sidebar and in the
   phone's top bar with its list, Find a job, access request cards, a job's
   People & access, Settings' sections, Management's member rows and invite
   form, and the RFI's "needs approval or review". Shared tokens only, so
   light, dark and every color scheme apply; phone widths at the end. */
.sidebar-top { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.sidebar-top .sidebar-company { flex: 1; }
.bell-btn {
  position: relative; flex: none; width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center; border-radius: var(--radius-sm); color: var(--text-dim);
}
.bell-btn svg { width: 21px; height: 21px; }
.bell-btn:hover, .bell-btn[aria-expanded="true"] { color: var(--accent); background: var(--surface-2); }
.bell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bell-count {
  position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--red); color: var(--surface);
  font-size: var(--fs-xs); font-weight: 600; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface);
}
.topbar-bell { margin-left: auto; color: var(--side-text); }

.notif-pop {
  position: fixed; z-index: 55; width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 520px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-12); border-bottom: 1px solid var(--border);
}
.notif-head .link:disabled { color: var(--text-faint); cursor: default; text-decoration: none; }
.notif-list { overflow-y: auto; padding: var(--sp-4); }
.notif-empty { padding: var(--sp-12) var(--sp-12); margin: 0; }
.notif-item { display: flex; align-items: flex-start; gap: var(--sp-4); border-radius: var(--radius-sm); }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-open {
  flex: 1; min-width: 0; display: grid; gap: var(--sp-2); text-align: left;
  background: none; border: 0; padding: var(--sp-8) var(--sp-8); font: inherit; color: inherit; cursor: pointer;
}
.notif-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.notif-title { font-size: var(--fs-base); font-weight: 400; color: var(--text-dim); }
.notif-item.unread .notif-title { font-weight: 600; color: var(--text); }
.notif-body { font-size: var(--fs-sm); color: var(--text-dim); overflow-wrap: anywhere; }
.notif-time { font-size: var(--fs-xs); color: var(--text-faint); }
.notif-read {
  flex: none; width: 26px; height: 26px; margin: var(--sp-8) var(--sp-4) 0 0; padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer; display: grid; place-items: center;
}
.notif-read::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.notif-read:hover { background: var(--accent-soft); }
.notif-read:focus-visible { outline: 2px solid var(--accent); }

.find-job-btn { font-size: var(--fs-sm); color: var(--text-dim); text-align: left; padding: var(--sp-8) var(--sp-8); }
.find-job-btn:hover { color: var(--accent); }
.empty-find { margin-top: var(--sp-16); }
.find-job { display: flex; gap: var(--sp-8); margin: var(--sp-8) 0 var(--sp-12); }
.find-job input { flex: 1; min-width: 0; }
.fj-match {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  padding: var(--sp-8) var(--sp-12); margin-bottom: var(--sp-8);
}
.fj-match .field { margin: var(--sp-8) 0 var(--sp-8); }
.fj-match p { margin: var(--sp-4) 0; }
.fj-mine-head { margin: var(--sp-16) 0 var(--sp-4); font-size: var(--fs-base); }
.tag.ar-pending { color: var(--amber); border-color: var(--amber-line); }
.tag.ar-approved { color: var(--green); border-color: var(--green); }
.tag.ar-denied { color: var(--red); border-color: var(--red-line); }

.ar-list { display: grid; gap: var(--sp-8); margin: var(--sp-8) 0 var(--sp-12); }
.ar-card {
  border: 1px solid var(--accent-line); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface); padding: var(--sp-8) var(--sp-12);
}
.ar-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-8); }
.ar-email { overflow-wrap: anywhere; }
.ar-note { margin: var(--sp-8) 0; }
.ar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-top: var(--sp-8); }
.ar-role { display: inline-flex; align-items: center; gap: var(--sp-4); margin-right: auto; }
.ar-deny { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-8); }
.ar-deny[hidden] { display: none; }
.ar-deny input { flex: 1 1 220px; width: auto; }

.pa-job { margin-top: calc(-1 * var(--sp-4)); }
.pa-h { margin: var(--sp-16) 0 var(--sp-8); }
.pa-table { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pa-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem minmax(0, 15rem) 4.5rem;
  gap: var(--sp-8); align-items: center; padding: var(--sp-8) var(--sp-12); font-size: var(--fs-base);
}
.pa-row + .pa-row { border-top: 1px solid var(--border); }
.pa-headrow { font-size: var(--fs-xs); font-weight: 400; color: var(--text-dim); background: var(--surface-2); }
.pa-who { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-8); }
.pa-email { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-role { max-width: none; width: 100%; }
.pa-jobs { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-12); }
.pa-check { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-sm); color: var(--text-dim); white-space: nowrap; }
.pa-check input { width: auto; margin: 0; }
.pa-remove { color: var(--red); justify-self: end; font-size: var(--fs-sm); }
.pa-admins { margin: var(--sp-8) 0 0; }
.pa-find { max-width: 360px; }
.pa-candidates { margin-top: var(--sp-4); }
.pa-cand { grid-template-columns: minmax(0, 1fr) auto auto; }
.pa-invite { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.pa-invite input { flex: 1 1 220px; width: auto; }

.settings-section + .settings-section { margin-top: var(--sp-24); padding-top: var(--sp-16); border-top: 1px solid var(--border); }
.perm-job { max-width: 460px; }
.perm-job .select { max-width: none; width: 100%; }
.co-name { margin-bottom: var(--sp-8); }
.co-member-row { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.co-role { font-size: var(--fs-sm); }
.co-every { min-width: 5.5rem; }
.invite-form {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1.4fr) minmax(110px, .7fr) auto;
  gap: var(--sp-8); align-items: end;
}
.invite-form .field { margin: 0; }
.invite-form .select { max-width: none; width: 100%; }

.rfi-review {
  display: flex; align-items: flex-start; gap: var(--sp-8); padding: var(--sp-8) var(--sp-12);
  border: 1px solid var(--border-soft); background: var(--surface-2); border-radius: var(--radius-sm);
}
.rfi-review input { width: auto; margin: var(--sp-4) 0 0; flex: none; }
.rfi-review > span { display: grid; gap: var(--sp-2); }
.tag.review { color: var(--amber); border-color: var(--amber-line); }

@media (max-width: 820px) {
  .topbar-bell { width: 44px; height: 44px; margin-right: calc(-1 * var(--sp-8)); }
  .notif-pop { left: 8px; right: 8px; width: auto; }
}
@media (max-width: 640px) {
  .pa-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pa-headrow { display: none; }
  .pa-who { grid-column: 1 / -1; }
  .pa-jobs { grid-column: 1 / -1; order: 3; }
  .co-member-row { grid-template-columns: minmax(0, 1fr) auto; }
  .co-member-row .member-open { grid-column: 1 / -1; }
  .invite-form { grid-template-columns: 1fr; }
  .ar-role { margin-right: 0; flex-basis: 100%; }
}

/* ---------------------------------------------------------------- subcontractors (10-29) */
/* The identity chip (app.js idChip): [logo] Jordan Ellis · Foreman · ACME, the
   same wherever someone appears in a communication. Tokens only, so it follows
   light, dark and every scheme. */
.id-chip { display: inline-flex; align-items: center; gap: var(--sp-4); max-width: 100%; min-width: 0;
           vertical-align: middle; color: var(--text); font-size: var(--fs-sm); line-height: 1.25; }
/* Under .id-chip so it outranks `.modal-body img`, which stretches page previews. */
.id-chip .id-logo { flex: none; width: 1.3rem; height: 1.3rem; border-radius: 4px; object-fit: contain;
                    background: var(--surface); border: 1px solid var(--border); }
.id-chip .id-letter { display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs);
                      font-weight: 400; color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.id-text { display: inline; min-width: 0; overflow-wrap: anywhere; }
.id-name { font-weight: 400; }
.id-title, .id-company { color: var(--text-dim); }
.id-title::before, .id-company::before { content: "\00b7"; margin: 0 .3em; color: var(--text-faint); }
.id-company { font-weight: 400; }
.id-firm { font-size: var(--fs-md); }
.id-chip.id-firm .id-logo { width: 1.7rem; height: 1.7rem; }
.reg-sub .id-chip, .tl-event .id-chip { font-size: inherit; }
.rfi-who, .rfi-subs { margin: 0 0 var(--sp-8); }
.notif-who { display: block; margin: var(--sp-2) 0; }

/* What a sub's person doesn't get: the server refuses all of it anyway. */
.sub-view #ov-sources, .sub-view #nc-count, .sub-view [data-sch-view="deadlines"],
.sub-view #ov-inventory-wrap,
.sub-view [data-sub-tab="conflicts"], .sub-view [data-sub-tab="cos"],
.sub-view #dropzone, .sub-view #ov-dropzone,
.sub-view [data-action="reindex"], .sub-view [data-action="delete"],
.sub-view #f-respond, .sub-view #f-close, .sub-view #f-co, .sub-view .rfi-review { display: none !important; }

.subs-bar { align-items: flex-start; justify-content: space-between; gap: var(--sp-16); }
.subs-bar p { margin: 0; max-width: 62ch; }
.subs-bar .btn { flex: none; }
.subs-h { margin: var(--sp-20) 0 var(--sp-8); font-size: var(--fs-md); }
.sb-await { margin-bottom: var(--sp-12); }
.sub-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--sp-12); }
.sub-card { display: flex; flex-direction: column; gap: var(--sp-8); padding: var(--sp-12) var(--sp-12); background: var(--surface);
            border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.sub-card.sb-gone { opacity: .68; }
.sub-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-width: 0; }
.sub-card-head .status-pill { flex: none; }
.sub-what { font-size: var(--fs-base); color: var(--text-dim); }
.sub-scope { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.sub-contact { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.sub-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8);
                 margin-top: auto; padding-top: var(--sp-4); }
.sb-owed { color: var(--amber); font-weight: 600; }
.sb-done { color: var(--green); font-weight: 400; }
.badge.sb-waiting { background: var(--amber-soft); color: var(--amber); }

.sn-list { display: flex; flex-direction: column; gap: var(--sp-8); }
.sn-row, .sn-card { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); width: 100%;
                    padding: var(--sp-8) var(--sp-12); text-align: left; font: inherit; color: var(--text);
                    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sn-row { cursor: pointer; }
.sn-row:hover { border-color: var(--accent-line); background: var(--surface-2); }
.sn-card-waiting { border-color: var(--amber-line); background: var(--amber-soft); }
.sn-main { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.sn-title { font-weight: 400; overflow-wrap: anywhere; }
.sn-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); }
.sn-note { color: var(--text-dim); }
.sn-tally { flex: none; font-size: var(--fs-sm); }
.sn-do { flex: none; display: flex; align-items: center; gap: var(--sp-8); text-align: right; }

.sb-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin: var(--sp-8) 0 var(--sp-12); }
.sb-spacer { flex: 1; }
.sb-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sb-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) auto; align-items: center; gap: var(--sp-12);
          padding: var(--sp-8) var(--sp-12); border-top: 1px solid var(--border); }
.sb-row:first-child { border-top: none; }
.sb-row-waiting { background: var(--amber-soft); }
.sb-who, .sb-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); min-width: 0; }
.sb-matched { display: inline-flex; flex-wrap: wrap; gap: var(--sp-4); }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 0 var(--sp-24); }
.sb-people { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-8); }
.sb-person { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.sb-add { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-top: var(--sp-12); }
.sb-add .select { max-width: 100%; min-width: 0; }
.sb-earlier { margin-top: var(--sp-12); }
.sb-earlier summary { cursor: pointer; font-size: var(--fs-base); margin-bottom: var(--sp-8); }
.sb-shares { display: flex; flex-direction: column; gap: var(--sp-4); }
.sb-sent { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); }

.co-abbrev { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-8); margin: var(--sp-8) 0 var(--sp-12); }
.co-abbrev .field { margin: 0; flex: 0 1 9rem; }
.co-abbrev .small { flex: 1 1 14rem; }

@media (max-width: 640px) {
  .subs-bar { flex-direction: column; }
  .subs-bar .btn { width: 100%; }
  .sn-row, .sn-card { flex-direction: column; align-items: flex-start; }
  .sn-do { width: 100%; justify-content: space-between; text-align: left; }
  .sb-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .sb-do .btn { width: 100%; }
}

/* ---------------------------------------------------------------- viewer, sidebar row, deadlines (10-30) */
/* The document viewer (viewer.js): one window over a whole document. Pages are
   absolutely placed inside a sizer as tall as the document, so the scrollbar is
   true while only the pages near the view exist. A page is paper in every
   scheme, so it stays white. Above windows, below toasts. */
.vw {
  position: fixed; inset: 0; z-index: 58; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-3); color: var(--text);
}
.vw-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-12); padding: var(--sp-8) var(--sp-12);
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.vw-title { flex: 1 1 12rem; min-width: 0; display: grid; line-height: 1.25; }
.vw-title strong, .vw-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-title span:empty { display: none; }
.vw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-12); }
.vw-group { display: inline-flex; align-items: center; gap: var(--sp-4); }
.vw-tools .btn { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-base); line-height: 1.25; text-decoration: none; }
.vw-tools [aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); }
.vw-jump { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-base); white-space: nowrap; }
.vw-jump input { width: 3.6em; padding: var(--sp-4) var(--sp-4); text-align: center; font-size: var(--fs-base); }
.vw-pct { min-width: 2.9em; text-align: center; color: var(--text-dim); }
.vw-close { flex: none; font-size: var(--fs-xl); line-height: 1; }
.vw-loading { margin: var(--sp-16); text-align: center; }
.vw-scroll { flex: 1; min-height: 0; overflow-x: auto; overflow-y: scroll; overscroll-behavior: contain; outline: none; }
.vw-sizer { position: relative; }
.vw-page { position: absolute; background: white; color: var(--navy-800); box-shadow: var(--shadow); overflow: hidden; }
.vw-img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.vw-wait { position: absolute; inset: 0; display: grid; place-content: center; gap: var(--sp-4); font-size: var(--fs-base); text-align: center; }
.vw-wait .link { color: var(--navy-600); text-decoration: underline; }
/* What an answer measured, over the sheet it was measured on. */
.vw-closeup {
  position: absolute; top: .5rem; right: .5rem; z-index: 1; width: min(46%, 440px); padding: 0; cursor: zoom-in;
  background: var(--surface); color: var(--text); border: 2px solid var(--accent); border-radius: var(--radius-sm);
  overflow: hidden; box-shadow: var(--shadow); font: inherit; text-align: left;
}
.vw-closeup.big { width: calc(100% - 1rem); cursor: zoom-out; }
.vw-closeup img { display: block; width: 100%; height: auto; background: white; }
.vw-closeup span { display: block; padding: var(--sp-2) var(--sp-8); font-size: var(--fs-xs); font-weight: 400; }
@media (max-width: 640px) {
  .vw-bar { padding: var(--sp-4) var(--sp-8); }
  .vw-title { order: 1; flex-basis: calc(100% - 3rem); }
  .vw-close { order: 2; }
  .vw-tools { order: 3; width: 100%; justify-content: space-between; gap: var(--sp-4); }
  .vw-tools .btn { padding: var(--sp-4) var(--sp-8); }
  .vw-pct, .vw-long { display: none; }
}

/* A document's name on the overview opens the viewer. */
.doc-open {
  display: block; padding: 0; border: 0; background: none; font: inherit; font-weight: 400;
  color: var(--accent); text-align: left; cursor: pointer;
}
.doc-open:hover, .doc-open:focus-visible { text-decoration: underline; outline: none; }

/* Under the logo, alone at the top: the sort on the left, a new project across
   from it. */
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); padding: 0 var(--sp-4); }
.project-sort { display: inline-flex; align-items: center; gap: var(--sp-4); min-width: 0; color: var(--text-dim); }
.project-sort svg { width: 15px; height: 15px; flex: none; }
.project-sort .select { max-width: none; padding: var(--sp-4) var(--sp-4); font-size: var(--fs-sm); }
.sidebar-actions .new-project-btn { border-color: var(--border); color: var(--text); flex: none; padding: var(--sp-4) var(--sp-8); font-size: var(--fs-sm); font-weight: 400; white-space: nowrap; }

/* A notice deadline on the calendar: an outlined bar with a double edge, that
   always says so (schedule.js). Nothing to pull. */
.sch-ev.kind-notice { background: var(--surface); border: 1px dashed var(--amber); border-left: 4px double var(--amber); font-weight: 400; }
.sch-ev.notice-overdue { border-color: var(--red); border-left-color: var(--red); }
.sch-ev.notice-sent { border-color: var(--border); border-left-color: var(--text-faint); font-weight: 400; }
.sch-editable .sch-ev.kind-notice { cursor: pointer; touch-action: auto; }
.sch-mark.notice { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.sch-mark.notice.overdue { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.sch-mark.notice.sent { color: var(--text-dim); border-color: var(--border); background: none; }
.sch-ynote { display: block; margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); font-size: var(--fs-xs); font-weight: 400; color: var(--amber); }
.sch-ygrid .deadline { outline: 1px dashed var(--amber); outline-offset: -1px; border-radius: 3px; font-weight: 600; }
.sch-cnote { font-size: var(--fs-xs); font-weight: 400; color: var(--amber); }
#nc-board { margin-top: var(--sp-4); }

/* ---------------------------------------------------------------- inventory, subs in the overview (11-02) */
/* Inventory (inventory.js): a dropdown of the overview with a round + like the
   Schedule's over the right end of its heading. The + is beside the summary,
   not in it, so the summary keeps room for it. The job's dropdown and the
   Owner's list in Settings > Management draw the same lists, grouped by type. */
.invt-group { position: relative; }
.invt-section > summary { padding-right: var(--sp-48); }
.invt-add {
  position: absolute; top: .4rem; right: .5rem;
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  font-size: var(--fs-lg); line-height: 1; display: inline-grid; place-items: center;
}
.invt-qty { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.invt-edit { margin-left: auto; }
.invt-remove { margin-right: auto; }
.invt-yard { margin: var(--sp-8) 0 0; }
.invt-type { margin: var(--sp-12) 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 400; color: var(--text-dim); }
.invt-type:first-child { margin-top: var(--sp-4); }
.invt-co-head { margin: var(--sp-20) 0 var(--sp-4); }
.invt-co-do { display: inline-flex; align-items: center; gap: var(--sp-8); margin-left: auto; min-width: 0; }
.invt-where { max-width: 16rem; min-width: 0; padding: var(--sp-4) var(--sp-4); font-size: var(--fs-sm); }

/* Subcontractors, a dropdown of the overview where it was a tab (subs.js): its
   first heading sits under the summary, not a tab's height below it. */
#subs-panel > .subs-h:first-child { margin-top: var(--sp-4); }

@media (max-width: 640px) {
  /* A finger's worth. */
  .invt-add { width: 34px; height: 34px; top: .25rem; }
  .invt-section > summary { padding-right: var(--sp-52); }
  .invt-co-do { width: 100%; margin-left: 0; }
  .invt-where { flex: 1; max-width: none; }
}

/* ---------------------------------------------------------------- project alerts, GC, point of contact (11-02) */
/* A job's own notifications as a small bell left of its name (app.js
   alertMark), the GC beside the job number for a sub, and the point of contact
   under Company in the (i). The sidebar's accent, not red: a team scheme can
   paint the sidebar red, and its accent is the one color kept readable on it. */
.project-item .pi-alert {
  display: inline-grid; place-items: center; vertical-align: -2px;
  width: 14px; height: 14px; margin-right: var(--sp-4); color: var(--accent);
}
.project-item .pi-alert svg { width: 13px; height: 13px; }
.project-item .pi-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item .pi-gc { font-weight: 400; }
/* On a phone the list is in the drawer: a dot on its menu button says so. */
.menu-btn { position: relative; }
.menu-btn.has-alerts::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--side-accent); box-shadow: 0 0 0 2px var(--side-bg);
}
.pi-contact { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
.pi-contact input:first-child { grid-column: 1 / -1; }
.ov-details a[href^="tel:"] { color: var(--accent); }
@media (max-width: 640px) { .pi-contact { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- projects (10-28) */
/* Each project's (i) and ⋯ menu (app.js). The sidebar's own tokens, so every
   color scheme applies. The menu is placed inside the sidebar: positioned here,
   and on a phone the drawer is position: fixed, which places it just the same. */
@media not all and (max-width: 820px) { .sidebar { position: relative; } }
.project-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-2) 0 0; cursor: default;
}
.project-item .pi-main {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: none; cursor: pointer; font: inherit; color: inherit;
  padding: var(--sp-8) var(--sp-8); border-radius: var(--radius-sm);
}
.project-item .pi-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.project-item .pi-btn {
  flex-shrink: 0; width: 26px; height: 26px; padding: 0;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm); color: var(--text-faint);
}
.project-item .pi-btn svg { width: 16px; height: 16px; }
.project-item .pi-btn:hover,
.project-item .pi-btn[aria-expanded="true"] {
  color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent);
}
.project-item .pi-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.project-item.active .pi-btn { color: var(--accent); }

.menu {
  position: absolute; z-index: 30; min-width: 150px;
  display: grid; padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu button {
  text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; font-size: var(--fs-base); color: var(--text);
  padding: var(--sp-8) var(--sp-8); border-radius: 4px;
}
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button.danger { color: var(--red); }

.project-head h2 { margin: 0; }

/* The RFIs tab: RFIs, conflicts and change orders as three parts of one tab. */
.subtabs {
  display: inline-flex; flex-wrap: wrap; gap: var(--sp-4); padding: var(--sp-4);
  background: var(--surface-2); border-radius: var(--radius); margin-bottom: var(--sp-16);
}
.subtab {
  display: inline-flex; align-items: center; gap: var(--sp-4);
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: var(--fs-base); color: var(--text-dim);
  padding: var(--sp-8) var(--sp-12); border-radius: var(--radius-sm);
}
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--surface); color: var(--accent); font-weight: 400; box-shadow: var(--shadow); }
.subtab:focus-visible { outline: 2px solid var(--accent); }

/* Ask: the recently-asked clock and the FAQ dropdown. */
.ask-form { position: relative; }
.recent-btn {
  width: 32px; height: 32px; padding: 0; margin-right: auto;
  display: inline-grid; place-items: center; border-radius: var(--radius-sm);
}
.recent-btn svg { width: 20px; height: 20px; }
.recent-btn:hover, .recent-btn[aria-expanded="true"] { color: var(--accent); background: var(--surface-2); }
.recent-btn:focus-visible { outline: 2px solid var(--accent); }
.recent-pop {
  position: absolute; left: .75rem; top: calc(100% + 4px); z-index: 20;
  width: min(480px, calc(100% - 1.5rem)); max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--sp-4);
}
.recent-title {
  margin: var(--sp-4) var(--sp-8) var(--sp-4); font-size: var(--fs-sm); color: var(--text-dim);
}
.recent-q {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-12);
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; font-size: var(--fs-base); color: var(--text);
  padding: var(--sp-8) var(--sp-8); border-radius: var(--radius-sm);
}
.recent-q:hover, .recent-q:focus-visible { background: var(--surface-2); outline: none; }
.recent-q .muted { white-space: nowrap; flex-shrink: 0; }
.faq { margin: var(--sp-12) 0 var(--sp-20); }
.faq > summary {
  display: inline-flex; align-items: center; gap: var(--sp-4); cursor: pointer; list-style: none;
  font-size: var(--fs-base); font-weight: 400; color: var(--text-dim); padding: var(--sp-4) var(--sp-2);
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::before { content: "\25B8"; transition: transform .15s; }
.faq[open] > summary::before { transform: rotate(90deg); }
.faq > summary:hover { color: var(--text); }
.faq .examples { margin: var(--sp-8) 0 0; }
.ask-history { margin-top: var(--sp-24); }
.ask-history > summary {
  display: inline-flex; align-items: center; gap: var(--sp-4); cursor: pointer; list-style: none;
  font-weight: 400; color: var(--text); padding: var(--sp-4) var(--sp-2); margin-bottom: var(--sp-8);
}
.ask-history > summary::-webkit-details-marker { display: none; }
.ask-history > summary::before { content: "\25B8"; transition: transform .15s; color: var(--text-dim); }
.ask-history[open] > summary::before { transform: rotate(90deg); }
html[data-examples="off"] #faq { display: none; }

/* The project overview tab's upload box (the rest of its look: "the S07 overview", below). */
.dropzone.compact { padding: var(--sp-12) var(--sp-16); margin: var(--sp-12) 0 var(--sp-8); }
.dropzone.compact p { margin: 0; }

/* The confirming step of an edit. */
.change-list { margin: var(--sp-8) 0 0; padding-left: var(--sp-20); font-size: var(--fs-base); }
.change-list li + li { margin-top: var(--sp-4); }

/* Settings > Archived projects. */
.archive-list { display: grid; gap: var(--sp-8); }
.archive-row {
  display: flex; align-items: flex-start; gap: var(--sp-12);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-8) var(--sp-12); background: var(--surface);
}
.archive-row .grow { flex: 1; min-width: 0; }
.restore-form { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-8); }
.restore-form[hidden] { display: none; }
.restore-form input { flex: 1 1 220px; width: auto; }
.table-scroll { overflow-x: auto; }
.archive-log { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.archive-log th, .archive-log td {
  text-align: left; vertical-align: top; padding: var(--sp-8) var(--sp-8); border-bottom: 1px solid var(--border);
}
.archive-log th { color: var(--text-dim); font-weight: 400; }

/* Settings > Customization: the team schemes in one dropdown per league (the
   NFL, NBA and MLB), with "Find a team" above them. */
.ap-find { max-width: 320px; margin: var(--sp-12) 0 var(--sp-8); }
.ap-cat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: var(--sp-8);
}
.ap-cat > summary {
  display: flex; align-items: center; gap: var(--sp-8); cursor: pointer; list-style: none;
  padding: var(--sp-8) var(--sp-12); font-weight: 400;
}
.ap-cat > summary::-webkit-details-marker { display: none; }
.ap-cat > summary::before { content: "\25B8"; color: var(--text-faint); transition: transform .15s ease; }
.ap-cat[open] > summary::before { transform: rotate(90deg); }
.ap-cat > summary:hover { color: var(--accent); }
.ap-cat > .ap-grid { padding: 0 var(--sp-12) var(--sp-12); }
.ap-custom { margin-top: var(--sp-8); }


/* ---------------------------------------------------------------------------
   Changes to the drawings and specs an approved RFI or change order makes
   (docchanges.js, app/doc_changes.py).
   --------------------------------------------------------------------------- */
.dc-block { margin-top: var(--sp-12); padding-top: var(--sp-12); border-top: 1px solid var(--border); }
.dc-block h4 { margin: 0 0 var(--sp-4); }
.dc-block > p { margin: 0 0 var(--sp-8); }
.dc-row { display: grid; grid-template-columns: 1fr 1fr minmax(8rem, .8fr) auto; gap: var(--sp-8); align-items: end;
          padding: var(--sp-8) 0; border-bottom: 1px dashed var(--border); }
.dc-row .field { margin: 0; }
.dc-row .dc-rm { margin-bottom: var(--sp-8); }
.dc-row .span-all { grid-column: 1 / -1; }
.dc-found:empty { display: none; }
.dc-none { color: var(--amber); }
.dc-add { margin-top: var(--sp-8); }
.dc-where summary { cursor: pointer; color: var(--text-dim); }
.dc-places { margin: var(--sp-4) 0 0; padding-left: var(--sp-16); }
.dc-places li { margin: var(--sp-4) 0; }
.dc-places .link { display: inline; text-align: left; }
.dc-places li .muted { display: block; }
.dc-item { padding: var(--sp-8) 0; border-bottom: 1px dashed var(--border); }
.dc-item:last-child { border-bottom: 0; }
.dc-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.dc-was { text-decoration: line-through; color: var(--text-dim); }
.dc-now { color: var(--red); }
.dc-item .field-note { margin: var(--sp-4) 0 0; }
.dc-approve { margin: var(--sp-12) 0; padding: var(--sp-8) var(--sp-12); border: 1px solid var(--amber-line); background: var(--amber-soft);
              border-radius: var(--radius-sm); }
.dc-approve legend { font-weight: 400; padding: 0 var(--sp-4); }
.dc-approve ul { margin: var(--sp-4) 0 var(--sp-8); padding-left: var(--sp-16); }
.dc-choice { display: flex; gap: var(--sp-8); align-items: flex-start; margin: var(--sp-4) 0; cursor: pointer; }
.dc-choice input[type="radio"] { flex: none; width: auto; min-width: 0; margin: var(--sp-4) 0 0; }
.dc-choice span { flex: 1; }
.dc-log { display: block; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-dim); }
.dc-log.approved { color: var(--green); }
.dc-log.approved::before, .dc-log.proposed::before { content: "Δ "; font-weight: 400; }
@media (max-width: 640px) {
  .dc-row { grid-template-columns: 1fr 1fr; }
  .dc-row .dc-rm { grid-column: 2; justify-self: end; margin: 0; }
}

/* On the page: on a drawing the new words cover the old, in red, with the
   revision's delta; on a spec page the old words are struck through and the
   new ones sit just above them, so the paragraph still reads as written. */
.vw-change { position: absolute; z-index: 2; padding: 0; margin: 0; border: 0; cursor: pointer; font: inherit;
             container-type: size; background: transparent; }
.vw-change .vw-new { position: absolute; left: 0; top: 0; height: 100%; display: flex; align-items: center;
                     white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-weight: 400;
                     font-size: 82cqh; line-height: 1; color: var(--rev); }
.vw-change.on-drawing { background: var(--rev-paper); outline: 1.5px solid var(--rev); outline-offset: 1px; }
.vw-change.on-drawing .vw-new { background: var(--rev-paper); padding-right: .15em; }
.vw-change.on-spec { background: var(--rev-tint);
                     background-image: linear-gradient(transparent calc(50% - 1px), var(--rev) calc(50% - 1px),
                                                       var(--rev) calc(50% + 1px), transparent calc(50% + 1px)); }
.vw-change.on-spec .vw-new { top: auto; bottom: 88%; height: 78%; padding: 0 .2em; font-size: 66cqh;
                             background: var(--rev-veil); border: 1px solid var(--rev); border-radius: 2px; }
.vw-originals .vw-change, .vw-originals .vw-pop { display: none; }
/* The revision tag rides above the end of the new words, at the drawing's own text size, so it reads as a
   revision mark at any zoom and never covers the rest of the line. */
.vw-delta { position: absolute; left: 100%; bottom: 72%; margin-left: .1em; white-space: nowrap; padding: 0 .35em;
            border-radius: .7em; background: var(--rev); color: var(--rev-paper); font: 700 62cqh/1.3 var(--sans); }
.vw-change:hover, .vw-change:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vw-pop { position: absolute; z-index: 3; width: min(280px, 90%); padding: var(--sp-8) var(--sp-12); background: var(--surface);
          color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--rev);
          border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: var(--fs-base); }
.vw-pop .vw-pop-row { margin-top: var(--sp-4); }
.vw-pop .btn { margin-top: var(--sp-8); }
.vw-pop .vw-pop-x { position: absolute; top: .2rem; right: .3rem; }
.vw-changes { display: inline-block; align-self: flex-start; width: fit-content; margin-top: var(--sp-2); padding: 1px 8px;
              border: 0; border-radius: 99px; background: var(--rev); color: var(--rev-paper); font: inherit; font-weight: 400;
              cursor: pointer; }
.vw-changes[aria-pressed="false"] { background: transparent; color: var(--text-dim); outline: 1px solid var(--border); }

/* A keyed copy (accesskey.js): the key screen, the switched-off screen, and the
   line under the job list that says when the key ends. */
.key-title { font-size: var(--fs-lg); margin: 0 0 var(--sp-8); }
.key-why { margin: 0 0 var(--sp-4); color: var(--text-dim); }
#key-input { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin-top: var(--sp-12); }
.key-row input { flex: 1; min-width: 9rem; }
#key-yours { margin-top: var(--sp-20); }
.key-jobs {
  list-style: none; margin: var(--sp-8) 0 var(--sp-16); padding: 0; max-height: 12rem; overflow-y: auto;
  border-top: 1px solid var(--border-soft);
}
.key-jobs li {
  display: flex; justify-content: space-between; gap: var(--sp-16); padding: var(--sp-8) 0;
  border-bottom: 1px solid var(--border-soft); font-size: var(--fs-base);
}
.key-jobs .n { color: var(--text-dim); white-space: nowrap; }
.key-delete { margin-top: var(--sp-20); padding-top: var(--sp-16); border-top: 1px solid var(--border-soft); }
.key-delete summary { cursor: pointer; color: var(--red); font-weight: 400; font-size: var(--fs-base); }
.key-banner { margin-bottom: var(--sp-16); }
.key-tag { padding: 0 var(--sp-8); font-size: var(--fs-xs); color: var(--side-faint); }
.key-tag.soon { color: var(--amber); }
#key-yours a.btn { display: block; text-align: center; text-decoration: none; }
.key-delete.key-new summary { color: var(--accent); }

/* ---------------------------------------------------------------- the S07 overview (11-22) */
/* His pick from the layouts (11-22): T07 Tile Grid made simpler, in Black & White. The
   project's name as the title (11-29: no "Welcome to"); the tabs one segmented control; on the overview the
   Project details line with the dates and budget, the Documents card (five tiles over
   the list) and two cards of closed dropdowns, each a row: name, a note under it, the
   count at the right, a chevron. Drawn from the scheme's tokens, so every scheme gets
   it; Black & White adds its own turns at the end. The Owner's inventory list in
   Settings keeps the plain .ov-section card: everything here is under the overview. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.panel[data-panel="overview"] { max-width: 1180px; }

.ph-title { min-width: 0; }
.ph-title h2 { font-size: var(--fs-2xl); letter-spacing: -.02em; line-height: 1.2; }

/* The tabs: one segmented control, the open one raised. */
.main-tabs {
  width: fit-content; max-width: 100%; gap: 2px; padding: 4px;
  border-radius: 10px; background: var(--surface-3); box-shadow: none;
}
.main-tabs .tab {
  border-bottom: 0; border-radius: 7px; padding: var(--sp-4) var(--sp-16);
  color: var(--text); font-weight: 400;
}
.main-tabs .tab:hover { background: color-mix(in srgb, var(--surface) 45%, transparent); }
.main-tabs .tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 55%, transparent); }
.main-tabs .tab .badge { background: none; color: var(--text-dim); padding: 0 0 0 var(--sp-2); min-width: 0; font-size: var(--fs-base); font-weight: 400; }

/* The details line: its dropdown on the left, the dates, budget and Edit on the right. */
[data-panel="overview"] .overview { margin-bottom: var(--sp-16); }
.ov-headline { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--sp-4) var(--sp-24); }
.ov-facts {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-20); margin: 0; min-height: 2.4rem;
}
.ov-facts div { display: flex; align-items: baseline; gap: var(--sp-8); }
.ov-facts dt { color: var(--text-dim); }
.ov-facts dd { margin: 0; font-weight: 400; }
.ov-pill { border-radius: var(--radius-sm); padding: var(--sp-4) var(--sp-12); }
@media (max-width: 900px) {
  .ov-headline { grid-template-columns: minmax(0, 1fr); }
  .ov-facts { justify-content: flex-start; min-height: 0; }
}

/* Cards: the Documents card across the page, then two side by side. A card with a
   dropdown open spans both columns (overview.js syncCards). */
.ov-card { background: var(--surface); color: var(--text); border: 1px solid var(--border-soft); border-radius: 18px; }
.ov-docs { padding: var(--sp-16) var(--sp-20) var(--sp-20); margin-bottom: var(--sp-12); }
.ov-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-12); }
.ov-pair > .ov-card.open { grid-column: 1 / -1; }
.ov-list-card { padding: var(--sp-4) 0; overflow: hidden; }
@media (max-width: 900px) { .ov-pair { grid-template-columns: 1fr; } }

/* The Documents card's own line, and its tiles. */
.ov-dochead { display: flex; align-items: center; gap: var(--sp-8); min-width: 0; }
.ov-dochead .ov-title { font-size: var(--fs-lg); font-weight: 600; }
.ov-dochead .badge { background: none; padding: 0; min-width: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.ov-dochead .ov-note { flex: 1; min-width: 0; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-chev {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; color: var(--text-dim); padding: 0; cursor: pointer;
}
.ov-chev::before {
  content: ""; width: 7px; height: 7px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
button.ov-chev:hover { background: var(--surface-2); color: var(--text); }
button.ov-chev:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ov-chev[aria-expanded="true"]::before, .ov-tile[aria-pressed="true"] .ov-chev::before { transform: translateY(2px) rotate(225deg); }

.ov-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: var(--sp-12); }
.ov-tile {
  display: flex; flex-direction: column; min-width: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: none; border: 0; border-left: 1px solid var(--border-soft); border-radius: 0;
  padding: var(--sp-4) var(--sp-16) var(--sp-4) var(--sp-16);
}
.ov-tile:first-child { border-left: 0; padding-left: 0; }
.ov-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ov-tile:hover .ov-chev, .ov-tile[aria-pressed="true"] .ov-chev { color: var(--text); }
.ov-tile:hover .ov-tile-name { text-decoration: underline; text-underline-offset: 3px; }
.ov-tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-8); min-height: 2.8em; }
.ov-tile-head .ov-chev { width: 20px; height: 20px; }
.ov-tile-name { font-weight: 400; padding-top: var(--sp-2); }
.ov-tile-num {
  font-size: calc(var(--fs-2xl) * 2.6); font-weight: 600; line-height: 1.05;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: var(--sp-4);
}
.ov-tile-num[data-zero] { color: var(--text-dim); font-weight: 400; }
.ov-tile-note {
  color: var(--text-dim); font-size: var(--fs-base); margin-top: var(--sp-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 760px) {
  .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-16) 0; }
  .ov-tile, .ov-tile:first-child { border-left: 0; padding-left: 0; }
  .ov-tile-num { font-size: calc(var(--fs-2xl) * 1.8); }
}

/* The list itself opens under the tiles. */
[data-panel="overview"] .ov-doclist { background: none; border: 0; border-radius: 0; margin: 0; }
[data-panel="overview"] .ov-doclist[open] { margin-top: var(--sp-16); border-top: 1px solid var(--border-soft); }
[data-panel="overview"] .ov-doclist > .ov-body { padding: var(--sp-8) 0 0; }

/* Every other dropdown is a row: no box of its own, a hairline between rows. */
.ov-headline .ov-section, .ov-list-card .ov-section { background: none; border: 0; border-radius: 0; margin: 0; }
.ov-list-card .ov-section > summary {
  position: relative; flex-wrap: nowrap; gap: var(--sp-12);
  min-height: 4.1rem; padding: var(--sp-12) var(--sp-16) var(--sp-12) var(--sp-20); font-weight: 400;
}
.ov-list-card .ov-section > summary::after {
  content: ""; position: absolute; left: 1.4rem; right: 0; top: 0; border-top: 1px solid var(--border-soft);
}
.ov-list-card > :first-child summary::after { display: none; }
.ov-list-card .ov-child > summary { padding-left: var(--sp-40); }
.ov-list-card .ov-child > summary::after { left: 2.6rem; }
[data-panel="overview"] .ov-section > summary::before {
  content: ""; order: 3; flex: none; width: 7px; height: 7px; margin: 0 var(--sp-8) 0 var(--sp-4);
  border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: translateY(-2px) rotate(45deg);
}
[data-panel="overview"] .ov-section[open] > summary::before { transform: translateY(2px) rotate(225deg); }
.ov-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ov-label .ov-title { font-size: var(--fs-md); font-weight: 400; }
.ov-label .ov-note { color: var(--text-dim); font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-list-card .ov-section > summary .badge {
  order: 2; background: none; padding: 0; min-width: 1.6rem; text-align: right;
  font-size: var(--fs-md); font-weight: 400; color: var(--text);
}
.ov-list-card .ov-section > summary .badge[data-zero] { color: var(--text-dim); font-weight: 400; }
.ov-list-card .ov-section > summary .badge.sb-waiting { color: var(--amber); }
.ov-list-card .ov-body { padding: var(--sp-2) var(--sp-20) var(--sp-16); }
.ov-list-card .ov-child > .ov-body { padding-left: var(--sp-40); }
.ov-list-card .ov-index .index-grid { margin-top: var(--sp-8); }

/* A row's own button, beside its summary and not in it (a click there would also
   open or close the row): New submittal, Inventory's +. */
.ov-act-group { position: relative; }
.ov-has-act > summary .ov-label { margin-right: var(--sp-136); }
[data-panel="overview"] .ov-act { position: absolute; top: calc(2.05rem - 15px); right: 4.6rem; border-radius: var(--radius-sm); padding: var(--sp-4) var(--sp-12); }
[data-panel="overview"] .invt-section > summary { padding-right: var(--sp-16); }
[data-panel="overview"] .invt-section > summary .ov-label { margin-right: var(--sp-40); }
[data-panel="overview"] .invt-add { top: calc(2.05rem - 15px); right: 4.6rem; }

/* Project details, on the page under the name: its name and line, then the chevron. */
.ov-pd > summary { display: flex; align-items: center; flex-wrap: nowrap; gap: var(--sp-8); padding: var(--sp-8) 0; min-height: 2.4rem; font-weight: 400; }
.ov-pd .ov-label, .ov-pd .ov-label .ov-note { min-width: 0; }
.ov-pd > summary:hover { background: none; }
.ov-pd > summary:hover .ov-title { text-decoration: underline; text-underline-offset: 3px; }
.ov-pd .ov-label { flex: 0 1 auto; flex-direction: row; align-items: baseline; gap: var(--sp-8); }
.ov-pd .ov-label .ov-title { font-size: var(--fs-base); flex: none; }
.ov-pd > .ov-body { padding: var(--sp-8) 0 var(--sp-8); }

/* Black & White (appearance.js 'mono'), 11-29: one bright thing per screen. The Documents
   card is the other way round and the main button is solid; what is picked -- the open tab,
   the selected project -- is a quiet step of grey, so it shows where you are without
   competing with them. */
html[data-theme="mono"][data-mode="dark"] .main-tabs { background: var(--surface); }
html[data-theme="mono"][data-mode="dark"] .main-tabs .tab:hover { background: var(--surface-2); }
html[data-theme="mono"][data-mode="dark"] .main-tabs .tab.active { background: var(--surface-3); box-shadow: none; }
html[data-theme="mono"] .project-item.active { background: color-mix(in srgb, var(--text) 14%, transparent); color: var(--text); }
html[data-theme="mono"] .project-item.active .pi-btn { color: var(--text-dim); }
/* No color where nothing is wrong: the demo's allowance, a feature that is on, a
   document's type. A warning keeps its color (out of questions, a feature off, overdue,
   failed, a conflict). */
html[data-theme="mono"] .demo-meter { border-color: var(--border-soft); background: var(--surface-2); }
html[data-theme="mono"] .demo-tag { color: var(--text-dim); }
html[data-theme="mono"] .dot.on { background: var(--text); }
html[data-theme="mono"] .type-pill.drawing,
html[data-theme="mono"] .type-pill.specification,
html[data-theme="mono"] .type-pill.contract { background: var(--surface-3); color: var(--text); }
/* The other brightness's tokens come from appearance.js as --inv-*; --border-soft is
   mixed where it is declared, so the card mixes its own. */
html[data-theme="mono"] .ov-docs {
  --bg: var(--inv-bg); --surface: var(--inv-surface); --surface-2: var(--inv-surface-2);
  --surface-3: var(--inv-surface-3); --border: var(--inv-border);
  --text: var(--inv-text); --text-dim: var(--inv-text-dim); --text-faint: var(--inv-text-faint);
  --accent: var(--inv-accent); --accent-soft: var(--inv-accent-soft); --accent-line: var(--inv-accent-line);
  --on-accent: var(--inv-on-accent);
  --border-soft: color-mix(in srgb, var(--border) 55%, transparent);
  border-color: transparent;
}
html[data-theme="mono"][data-mode="dark"] .ov-docs { color-scheme: light; }
html[data-theme="mono"][data-mode="light"] .ov-docs { color-scheme: dark; }

/* ---------------------------------------------------------------- the unslop pass (11-29) */
/* A lowercase word in a pill ("high conflict", "drawing") starts with a capital, so every label
   reads in sentence case without shouting. */
.conflict-head .sev::first-letter,
.type-pill::first-letter { text-transform: uppercase; }
