/* ============================================================
   Greenroom Consultants — Field Checklists
   Minimalist, mobile-first, fast-scanning
   ============================================================ */

:root {
  /* Color — quiet earth + one calm green accent */
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-alt: #fbfbf8;
  --ink: #14201a;
  --ink-soft: #4a5752;
  --ink-mute: #8a9590;
  --line: #e6e6df;
  --line-strong: #d2d4cb;

  --accent: #2f6b4a;          /* deep green for actions */
  --accent-soft: #e6f1ea;
  --accent-ink: #0f1a14;

  --danger: #b3392b;
  --danger-soft: #fbe9e6;

  /* Semantic status colors. These exist so the four modules stop each
     hand-rolling their own success/warn/info hexes (~190 one-off colors today).
     success reuses the brand green; warn/info are tuned to the earthy palette. */
  --success: var(--accent);
  --success-soft: var(--accent-soft);
  --warn: #b7791f;
  --warn-soft: #fbf1dd;
  --info: #3a5a8a;
  --info-soft: #e7edf5;

  /* Aliases for tokens submittals.css / fb-clients.css REFERENCE but that were
     never defined — they've been silently painting hardcoded fallbacks. Pointing
     them at the real tokens snaps those two modules onto the canonical palette. */
  --border: var(--line);
  --text: var(--ink);
  --text-muted: var(--ink-soft);
  --surface-2: var(--surface-alt);

  --shadow-sm: 0 1px 2px rgba(20,32,26,.04), 0 1px 1px rgba(20,32,26,.03);
  --shadow-md: 0 4px 14px rgba(20,32,26,.06), 0 2px 4px rgba(20,32,26,.04);
  --shadow-lg: 0 20px 60px rgba(20,32,26,.14), 0 6px 18px rgba(20,32,26,.08);

  /* One focus ring for the whole app (fb-clients had none; :focus-visible was
     used twice total). */
  --focus-ring: 0 0 0 3px rgba(47,107,74,.32);

  /* Two transition speeds, replacing 24 ad-hoc durations. */
  --t-fast: 120ms ease;
  --t-med: 200ms ease;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;

  /* Spacing tokens */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  /* Root overflow guard. Nothing clipped at the root before, so any child wider
     than the viewport scrolled the WHOLE page sideways. `clip` — not `hidden` —
     because hidden makes body a scroll container and breaks the Submittals
     position:sticky header. */
  overflow-x: clip;
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  /* 1320, matching the widest views (home/projects/submittals). At 980 the header
     was capped narrower than its own content on the busy checklist view — the
     centering left a 150px margin that pushed New/Export/chip past the viewport
     edge (a pre-existing sideways-scroll, now that overflow-x is clipped it would
     have clipped Export). A header may span wider than a reading column. */
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand-mark { color: var(--accent); width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 2px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px 28px 8px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  max-width: 180px;
  text-overflow: ellipsis;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5752' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-alt); border-color: var(--ink-mute); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #245a3c; border-color: #245a3c; }
.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.btn-secondary:hover { background: #d8e9dd; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-alt); }

@media (max-width: 540px) {
  .btn-label { display: none; }
  .btn { padding: 8px 10px; }
  .project-select { max-width: 130px; padding: 8px 26px 8px 10px; }
  .brand-sub { display: none; }
}

/* ============================================================
   Project header
   ============================================================ */
.project-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.project-head-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 24px;
}
.project-name {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 0;
  margin: 0 0 6px;
}
.project-name:focus { outline: none; }
.project-name::placeholder { color: var(--ink-mute); font-style: italic; }

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 18px;
}
.meta-field {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  min-width: 0;
  flex: 1 1 180px;
}
.meta-field:focus { outline: none; border-bottom-color: var(--accent); color: var(--ink); }
.meta-field::placeholder { color: var(--ink-mute); }

.overall-progress { display: flex; flex-direction: column; gap: 6px; }
.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 999px;
  transition: width .3s ease;
}
.progress-text {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
#overallPct { font-weight: 600; color: var(--ink); }

/* ============================================================
   CRx integration panel
   ============================================================ */
.crx-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-alt);
}
.crx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.crx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.crx-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.crx-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background .15s ease;
  flex-shrink: 0;
}
.crx-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: left .15s ease;
}
.crx-toggle input:checked + .crx-toggle-track { background: var(--accent); }
.crx-toggle input:checked + .crx-toggle-track .crx-toggle-knob { left: 18px; }
.crx-toggle input:focus-visible + .crx-toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.crx-help {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.crx-help:hover { color: var(--accent); }

.crx-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.crx-field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  font-weight: 600;
}
.crx-field-row { display: flex; gap: 8px; align-items: center; }
.crx-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  background: var(--surface);
}
.crx-input:focus { outline: none; border-color: var(--accent); }
.btn-small { padding: 6px 10px; font-size: 13px; }
.crx-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.crx-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}
.crx-status.ok {
  background: var(--accent-soft);
  color: #1f4a31;
}
.crx-status.warn {
  background: #fff4e0;
  color: #7a4f10;
}
.crx-status .crx-status-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  opacity: 0.85;
}
.crx-status-strong { font-weight: 600; }

/* Phase "sync to CRx" pill in phase header */
.crx-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}
.crx-sync:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.crx-sync .crx-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.crx-sync.synced {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.crx-sync.errored {
  background: #fef2f2;
  color: #b42318;
  border-color: #fecaca;
}
.crx-sync.errored .crx-sync-dot { background: #b42318; }
.crx-sync.errored:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b42318;
}
.crx-sync[data-busy="1"] {
  opacity: .7;
  pointer-events: none;
}
.crx-open-link {
  font: 500 12px/1 var(--font-sans);
  color: var(--text-2);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}
.crx-open-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.phase-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ============================================================
   Phase tabs (horizontal scroll on mobile)
   ============================================================ */
.phases {
  position: sticky;
  top: 56px;
  z-index: 40;
  background: rgba(247,247,244,.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.phases-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.phases-inner::-webkit-scrollbar { display: none; }
.phase-tab {
  flex: 0 0 auto;
  padding: 14px 4px;
  margin-right: 16px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s ease, border-color .15s ease;
}
.phase-tab:hover { color: var(--ink); }
.phase-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.phase-tab .tab-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  background: var(--line);
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 30px;
  text-align: center;
}
.phase-tab.active .tab-pct { color: var(--accent); background: var(--accent-soft); }
.phase-tab.complete .tab-pct { color: #fff; background: var(--accent); }

/* ============================================================
   Phase view
   ============================================================ */
.phase-view {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.phase {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.phase-head {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.phase-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.phase-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 60ch;
}
.phase-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.phase-progress .progress-track { flex: 1; }
.phase-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-width: 36px;
  text-align: right;
}

@media (max-width: 540px) {
  .phase-head { padding: 18px 16px 14px; }
  .phase-progress { width: 100%; margin-left: 0; }
}

/* ============================================================
   Checklist items
   ============================================================ */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.item {
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--surface-alt); }
.item.done .item-text { color: var(--ink-mute); text-decoration: line-through; text-decoration-color: var(--ink-mute); text-decoration-thickness: 1.5px; }

.item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
}

/* Custom checkbox */
.item-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.item-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.checkmark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all .15s ease;
  margin-top: 1px;
}
.checkmark svg { width: 14px; height: 14px; }
.item-check:hover .checkmark { border-color: var(--accent); }
.item-check input:focus-visible + .checkmark {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.item-check input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.item-text {
  flex: 1;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.45;
  min-width: 0;
  word-wrap: break-word;
  outline: none;
  padding: 1px 2px;
  border-radius: 4px;
}
.item-text:focus { background: var(--accent-soft); }

/* Tools */
.item-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--ink-mute);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  position: relative;
}
.icon-btn:hover { background: var(--line); color: var(--ink); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn.has-content::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.icon-btn.delete-item:hover { color: var(--danger); background: var(--danger-soft); }

/* Extras (notes + photos) */
.item-extras {
  padding: 0 18px 14px 50px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-extras.hidden { display: none; }
.item-notes {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-alt);
  resize: vertical;
  min-height: 60px;
  font-family: var(--font-sans);
}
.item-notes:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.photo-grid:empty { display: none; }
.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--line);
  cursor: pointer;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-tile .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 32, 26, .75);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease;
}
.photo-tile:hover .photo-remove { opacity: 1; }
@media (hover: none) { .photo-tile .photo-remove { opacity: 1; } }

/* Phase actions */
.phase-actions {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}

@media (max-width: 540px) {
  .item-row { padding: 12px 14px; }
  .item-extras { padding: 0 14px 12px 46px; }
  .item-text { font-size: 15px; }
}

/* ============================================================
   Footer
   ============================================================ */
.appfoot {
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.appfoot-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 12px;
}
.appfoot-text { margin: 0 0 6px; }
.appfoot-credit { margin: 0; letter-spacing: 0.04em; }
.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
}
.link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.link-danger:hover { color: var(--danger); text-decoration-color: var(--danger); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-ok {
  background: #14532d;
}
.toast.toast-error {
  background: #b42318;
  max-width: min(90vw, 520px);
  padding: 12px 18px;
  border-radius: 12px;
  text-align: center;
  line-height: 1.4;
}

/* ============================================================
   Print (used by browser fallback / PDF visual fallback)
   ============================================================ */
@media print {
  .topbar, .phases, .phase-actions, .item-tools, .appfoot { display: none !important; }
  body { background: #fff; }
  .phase { box-shadow: none; border: 0; }
  .item { break-inside: avoid; }
}

/* Small util */
.hidden { display: none !important; }

/* ============================================================
   Top nav
   ============================================================ */
.topnav {
  display: flex;
  gap: 4px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.topnav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.topnav-link:hover { color: var(--ink); background: var(--surface-alt); }
.topnav-link.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}
/* Below 900px the 6-link strip (~430px, unshrinkable) plus the brand and actions
   can't fit — on a 768 tablet it ran off the edge and put Integrations
   off-screen. It's replaced by the bottom tab bar (.tabbar). 900 keeps the top
   nav for landscape tablets/laptops and hands phones + portrait tablets the
   thumb-reachable bar. */
@media (max-width: 900px) {
  .topnav { display: none; }
}

/* ============================================================
   Bottom tab bar — mobile primary navigation (<=720px)
   ============================================================
   Five daily-driver sections as thumb-reachable tabs. Integrations (set-once
   admin) lives behind the gear in the topbar instead. Hidden on desktop, where
   .topnav is the nav. */
.tabbar { display: none; }
.tabbar-gear { display: none; }

@media (max-width: 900px) {
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: rgba(255,255,255,.94);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar-link {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 7px 2px 6px;
    text-decoration: none;
    color: var(--ink-mute);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: .01em;
    transition: color var(--t-fast);
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar-link svg {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none;
    stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  }
  .tabbar-link.is-active { color: var(--accent); }
  .tabbar-link.is-active svg { stroke-width: 2.1; }

  /* Gear shows in the topbar to reach Integrations on mobile. */
  .tabbar-gear {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid transparent;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .tabbar-gear:hover { background: var(--surface-alt); color: var(--ink); }
  .tabbar-gear.is-active { color: var(--accent); background: var(--accent-soft); }
  .tabbar-gear svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; }

  /* Keep the last row of content clear of the fixed bar. */
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

/* Hide the per-project topbar actions on the list/overview views (they belong to
   the single-project checklist). Hidden per-child so .topbar-actions stays a flex
   parent for the user chip, which must always show. Submittals is a cross-project
   list like Projects — without it here, project-select + New + Export overflowed
   the mobile header and cut off the user chip. */
body.view-projects .topbar-actions > #projectSelect,
body.view-projects .topbar-actions > #newProjectBtn,
body.view-projects .topbar-actions > #exportPdfBtn,
body.view-home .topbar-actions > #projectSelect,
body.view-home .topbar-actions > #newProjectBtn,
body.view-home .topbar-actions > #exportPdfBtn,
body.view-billing .topbar-actions > #projectSelect,
body.view-billing .topbar-actions > #newProjectBtn,
body.view-billing .topbar-actions > #exportPdfBtn,
body.view-submittals .topbar-actions > #projectSelect,
body.view-submittals .topbar-actions > #newProjectBtn,
body.view-submittals .topbar-actions > #exportPdfBtn,
body.view-integrations .topbar-actions > #projectSelect,
body.view-integrations .topbar-actions > #newProjectBtn,
body.view-integrations .topbar-actions > #exportPdfBtn { display: none; }
/* Header wraps at ANY width rather than clipping. flex-wrap only kicks in when
   content actually exceeds the row, so wide desktops still show one line; only a
   too-tight width (e.g. the busy checklist header between the nav and desktop
   breakpoints) drops the actions/chip to a second row. This is the guarantee the
   header can never overflow horizontally. */
.topbar-inner { flex-wrap: wrap; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Touch-target minimums. Scoped to coarse pointers so DESKTOP density is
   unchanged — this only fires on phones/tablets. The worst offenders today are
   the checklist expand caret (~19px) and per-item status select (~26px), both
   below the 44px guideline and both the primary field controls. */
@media (pointer: coarse) {
  .qa-item-toggle { min-width: 40px; min-height: 40px; }
  .qa-item-status { min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .photo-remove { min-width: 32px; min-height: 32px; }
  .btn-mini, .topnav-link, .link { min-height: 40px; display: inline-flex; align-items: center; }
}

/* ============================================================
   Skeleton loading — replaces "Loading…" text with a shimmer.
   There was no loading state anywhere; the one hook reused a static box. This
   reads as a considered, responsive app rather than a blank/janky flash.
   ============================================================ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(20,32,26,.06), transparent);
  animation: gr-shimmer 1.4s infinite;
}
@keyframes gr-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }
.skeleton-line { height: 12px; margin: 7px 0; display: block; }
.skeleton-line.sk-lg { height: 20px; }
.skeleton-line.sk-sm { height: 10px; width: 55%; }
.activity-skel { list-style: none; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-skel:last-child { border-bottom: 0; }

/* ============================================================
   Projects — master sheet replacement
   ============================================================ */
.projects-view {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-12);
}
body.view-projects .topbar-actions > #projectSelect,
body.view-projects .topbar-actions > #newProjectBtn,
body.view-projects .topbar-actions > #exportPdfBtn { display: none; }

.projects-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
}
.projects-head-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.projects-eyebrow {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 6px;
  font-weight: 500;
}
.projects-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.projects-sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  max-width: 56ch;
}
.projects-head-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* Body layout */
.projects-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 900px) {
  .projects-body { grid-template-columns: 1fr; }
}

/* Sidebar — saved views */
.projects-sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
}
.projects-sidebar-section + .projects-sidebar-section { margin-top: var(--space-5); }
.projects-sidebar-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-2);
  font-weight: 600;
  padding: 0 var(--space-2);
}
.projects-views {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.projects-view-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  transition: background .12s ease, border-color .12s ease;
}
.projects-view-btn:hover { background: var(--surface-alt); }
.projects-view-btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(47,107,74,.18);
  color: var(--accent-ink);
}
.projects-view-label { font-weight: 600; grid-column: 1; }
.projects-view-count {
  grid-column: 2;
  grid-row: 1;
  font-size: 12px;
  color: var(--ink-mute);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 999px;
  align-self: center;
  font-variant-numeric: tabular-nums;
}
.projects-view-btn.is-active .projects-view-count {
  background: rgba(255,255,255,.6);
  border-color: rgba(47,107,74,.2);
  color: var(--accent);
}
.projects-view-desc {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--ink-mute);
  line-height: 1.35;
}
.projects-view-btn.is-active .projects-view-desc { color: var(--accent-ink); opacity: .75; }

@media (max-width: 900px) {
  .projects-sidebar { position: static; }
  .projects-views {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .projects-view-btn {
    width: auto;
    grid-template-columns: auto auto;
    grid-template-rows: auto;
    padding: 6px 10px;
  }
  .projects-view-desc { display: none; }
}

/* Main column */
.projects-main { min-width: 0; }

.projects-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.projects-search {
  flex: 1 1 280px;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
}
.projects-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.projects-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.projects-result-count {
  font-size: 12.5px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

/* Filter chips */
.projects-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  align-items: center;
}
.projects-filters:empty { display: none; }
.chip-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.chip-group-label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 4px;
  font-weight: 600;
}
.chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-alt); color: var(--ink); }
.chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chip-clear {
  margin-left: auto;
  color: var(--danger);
  border-color: var(--danger-soft);
  background: var(--danger-soft);
}
.chip-clear:hover {
  background: #f8d6d1;
  color: var(--danger);
}

/* Bulk action bar */
.projects-bulkbar[hidden] { display: none !important; }
.projects-bulkbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--accent-soft);
  border: 1px solid rgba(47,107,74,.18);
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin-bottom: var(--space-3);
  font-size: 13.5px;
  color: var(--accent-ink);
  flex-wrap: wrap;
}
.projects-bulkbar .btn-small { padding: 4px 10px; }

/* Table */
.projects-tablewrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: auto;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 280px);
  position: relative;
}
.projects-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.projects-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.projects-table thead th[data-col="_select"],
.projects-table thead th[data-col="check"] { cursor: default; }
.projects-table thead th .sort-arrow {
  opacity: 0;
  margin-left: 4px;
  font-size: 10px;
}
.projects-table thead th.sort-asc .sort-arrow,
.projects-table thead th.sort-desc .sort-arrow { opacity: 1; }
.projects-table thead th.sort-desc .sort-arrow::before { content: "↓"; }
.projects-table thead th.sort-asc .sort-arrow::before { content: "↑"; }

.projects-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
  max-width: 320px;
}
.projects-table tbody tr {
  transition: background .08s ease;
  cursor: pointer;
}
.projects-table tbody tr:hover { background: var(--surface-alt); }
.projects-table tbody tr.is-selected { background: var(--accent-soft); }
.projects-table tbody tr:last-child td { border-bottom: none; }

/* Specific cells */
.projects-table td[data-col="_select"],
.projects-table th[data-col="_select"] {
  width: 36px;
  padding-left: 12px;
  padding-right: 4px;
}
.projects-table td[data-col="_select"] input,
.projects-table th[data-col="_select"] input {
  cursor: pointer;
  accent-color: var(--accent);
}

.projects-name-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  display: block;
  line-height: 1.3;
}
.projects-name-link:hover { color: var(--accent); }
.projects-name-sub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 400;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.projects-cell-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(47,107,74,.4);
}
.projects-cell-link:hover {
  border-bottom-style: solid;
}

.projects-notes {
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 360px;
  white-space: pre-wrap;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-action-tag {
  display: inline-block;
  background: #fff5e0;
  color: #8a5a00;
  border: 1px solid #f0d68a;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

.check-yes { color: var(--accent); font-weight: 700; }
.check-no { color: var(--ink-mute); }

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.st-lead        { background: #fef5d7; color: #7a5800; border-color: #f3e3a3; }
.st-concept     { background: #e7ecf8; color: #2a4787; border-color: #c8d3ee; }
.st-precon      { background: #ddeaf7; color: #1f527e; border-color: #b8d2eb; }
.st-cd          { background: #e1ecf9; color: #134578; border-color: #b8d2eb; }
.st-construction{ background: #fde7d6; color: #8a3d05; border-color: #f4c79b; }
.st-pause       { background: #ece8f5; color: #4d3a83; border-color: #d4cce8; }
.st-done        { background: var(--accent-soft); color: var(--accent); border-color: rgba(47,107,74,.25); }
.st-dead        { background: #f1ecea; color: #6e6157; border-color: #ddd4cf; }
.st-unknown     { background: var(--surface-alt); color: var(--ink-mute); border-color: var(--line); }

/* Empty state */
.projects-empty {
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.projects-empty-title {
  font-size: 16px;
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 600;
}
.projects-empty-sub {
  margin: 0;
  color: var(--ink-mute);
  font-size: 13.5px;
}

/* Drawer */
.project-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.project-drawer[hidden] { display: none; }
.project-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20,32,26,.32);
  animation: pdScrim .15s ease-out;
}
@keyframes pdScrim {
  from { opacity: 0; }
  to { opacity: 1; }
}
.project-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(20,32,26,.12);
  display: flex;
  flex-direction: column;
  animation: pdSlide .18s ease-out;
}
@keyframes pdSlide {
  from { transform: translateX(20px); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}
.project-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--line);
}
.project-drawer-eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 4px;
  font-weight: 600;
}
.project-drawer-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}
.project-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}
.project-drawer-foot {
  border-top: 1px solid var(--line);
  padding: var(--space-3) var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-alt);
}
body.drawer-open { overflow: hidden; }

.drawer-section {
  margin-bottom: var(--space-5);
}
.drawer-section h3 {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-3);
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.drawer-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: 13.5px;
}
.drawer-field > span {
  color: var(--ink-soft);
  font-weight: 500;
}
.drawer-field input[type="text"],
.drawer-field input[type="date"],
.drawer-field select,
.drawer-field textarea {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
}
.drawer-field input:focus,
.drawer-field select:focus,
.drawer-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.drawer-field-wide {
  grid-template-columns: 1fr;
}
.drawer-field-wide > span {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-mute);
}
.drawer-field textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  line-height: 1.45;
}
.drawer-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  margin-right: var(--space-4);
  margin-bottom: 6px;
  cursor: pointer;
}
.drawer-check input { accent-color: var(--accent); }

@media (max-width: 640px) {
  .projects-view { padding: var(--space-4) var(--space-3) var(--space-10); }
  .projects-title { font-size: 30px; }
  .drawer-field { grid-template-columns: 1fr; gap: 4px; }
  .drawer-field > span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
  .project-drawer-panel { width: 100vw; }
  .projects-tablewrap { max-height: none; }
}

/* ============================================================
   Home dashboard
   ============================================================ */
.home-view {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-12);
}
.home-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-6);
}
.home-eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 6px;
  font-weight: 600;
}
.home-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 40px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  font-weight: 600;
}
.home-sub {
  font-size: 15px;
  color: var(--ink-mute);
  margin: 0;
}
.home-section {
  margin-bottom: var(--space-7);
}
.home-section-title {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-4);
  font-weight: 600;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (min-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(6, 1fr); }
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--space-4);
  background: var(--surface);
}
.metric-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 8px;
  font-weight: 600;
}
.metric-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 36px;
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.metric-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0;
}
.home-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}
.priority-list, .activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.priority-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.priority-sev-1 { border-left-color: #cbd5e1; }
.priority-sev-2 { border-left-color: #f59e0b; }
.priority-sev-3 { border-left-color: #ef4444; }
.priority-name { font-weight: 600; margin: 0 0 2px; }
.priority-reason { font-size: 13px; color: var(--ink-mute); margin: 0; }
.priority-empty, .activity-empty, .activity-loading {
  list-style: none;
  font-size: 14px;
  color: var(--ink-mute);
  padding: var(--space-4);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.activity-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: 8px var(--space-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
}
.activity-when { font-size: 11px; color: var(--ink-mute); white-space: nowrap; }
.activity-msg { color: var(--ink); }
.activity-project { font-size: 11px; color: var(--ink-mute); white-space: nowrap; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.module-card {
  display: block;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, transform .15s, background .15s;
}
.module-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-alt);
  transform: translateY(-1px);
}
.module-card-name {
  font-weight: 600;
  margin: 0 0 6px;
  font-size: 16px;
}
.module-card-desc {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .home-cols { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: 1fr; }
  .home-title { font-size: 30px; }
  .activity-item { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   Placeholder & integrations views
   ============================================================ */
.placeholder-view, .integrations-view {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-12);
}
.placeholder-head {
  margin-bottom: var(--space-5);
}
.placeholder-eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 6px;
  font-weight: 600;
}
.placeholder-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 36px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  font-weight: 600;
}
.placeholder-sub {
  font-size: 15px;
  color: var(--ink-mute);
  margin: 0 0 var(--space-4);
}
.placeholder-card {
  margin-top: var(--space-4);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--space-4);
  background: var(--surface);
}
.placeholder-card-title {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 8px;
  font-weight: 600;
}
.placeholder-card-body {
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 var(--space-3);
}
.placeholder-card-actions {
  display: flex;
  gap: var(--space-2);
}

.integrations-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.integration-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--space-5);
  background: var(--surface);
}
.integration-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.integration-name {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.integration-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute);
}
.integration-status {
  font-size: 11px;
  letter-spacing: .04em;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink-mute);
  white-space: nowrap;
}
.integration-status.is-on {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.integration-help {
  font-size: 12px;
  color: var(--ink-mute);
  margin: var(--space-3) 0 0;
}
.integration-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.int-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.int-field > span {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-mute);
}
.int-field input,
.int-field select,
.int-field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}
.int-field input:focus,
.int-field select:focus,
.int-field textarea:focus {
  border-color: var(--line-strong);
  outline: none;
}
.int-field small {
  font-size: 11px;
  color: var(--ink-mute);
}
.int-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.int-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin: var(--space-2) 0 0;
}

/* ============================================================
   Smartsheet integration UI (v3 — 2026-05-07)
   ============================================================ */

/* Global: respect the HTML `hidden` attribute even on flex/grid children.
   .btn uses `display: inline-flex` which silently defeats `hidden=""` —
   this restores the expected semantics across the app. */
[hidden] { display: none !important; }

/* --- Brand logo (replaces SVG mark) --- */
.brand-logo {
  display: block;
  height: 60px;
  width: auto;
  max-width: 220px;
  border-radius: 6px;
  object-fit: contain;
  background: transparent;
}
@media (max-width: 720px) {
  .brand-logo { height: 44px; max-width: 160px; }
}

/* --- Projects sync header pill (Smartsheet status, refresh) --- */
.projects-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--surface, #f5f7f4);
  border: 1px solid var(--line, #e3e7e1);
  font-size: 12px;
  color: var(--ink-mute, #5a6a5d);
  white-space: nowrap;
  vertical-align: middle;
}
.projects-sync .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b6bdb1;
  flex-shrink: 0;
}
.projects-sync.is-on .sync-dot {
  background: #2e8f57;
  box-shadow: 0 0 0 3px rgba(46,143,87,0.15);
}
.projects-sync.is-off .sync-dot { background: #b6bdb1; }
.projects-sync .sync-text { color: inherit; }
.projects-sync .sync-text strong { color: var(--ink, #1a2b1f); font-weight: 600; }
.projects-sync .sync-link {
  color: var(--accent, #2e8f57);
  text-decoration: underline;
  cursor: pointer;
}
.sync-refresh-btn {
  border: none;
  background: transparent;
  color: var(--ink-mute, #5a6a5d);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
}
.sync-refresh-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--ink, #1a2b1f);
}
.sync-refresh-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* --- New Project modal (Smartsheet-backed) --- */
.np-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.np-modal[hidden] { display: none; }
.np-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 26, 20, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.np-modal-card {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.12);
  border: 1px solid var(--line, #e3e7e1);
  display: flex;
  flex-direction: column;
}
.np-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line, #e3e7e1);
}
.np-modal-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute, #5a6a5d);
}
.np-modal-title {
  margin: 0 0 4px;
  font-family: var(--font-display, inherit);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink, #1a2b1f);
  letter-spacing: -0.01em;
}
.np-modal-sub {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute, #5a6a5d);
  line-height: 1.4;
}
.np-modal-body {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.np-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.np-field-wide { grid-column: 1 / -1; }
.np-field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute, #5a6a5d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.np-field > span em {
  color: var(--accent, #2e8f57);
  font-style: normal;
  margin-left: 2px;
}
.np-field input,
.np-field select,
.np-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line, #e3e7e1);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink, #1a2b1f);
  background: #ffffff;
  box-sizing: border-box;
}
.np-field textarea {
  resize: vertical;
  min-height: 64px;
}
.np-field input:focus,
.np-field select:focus,
.np-field textarea:focus {
  outline: none;
  border-color: var(--accent, #2e8f57);
  box-shadow: 0 0 0 3px rgba(46,143,87,0.15);
}
.np-modal-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #b8741a;
  background: #fff7e6;
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0;
  border: 1px solid #f0d9a3;
}
.np-modal-hint:empty { display: none; }
.np-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line, #e3e7e1);
  background: #fafbf9;
}
@media (max-width: 540px) {
  .np-modal-body { grid-template-columns: 1fr; }
  .np-field-wide { grid-column: 1; }
}

/* --- Integrations: Smartsheet writable fields panel --- */
.int-writable {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2, #fafbf9);
  border: 1px solid var(--line, #e3e7e1);
  border-radius: 8px;
}
.int-writable > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #1a2b1f);
  list-style: none;
  outline: none;
  user-select: none;
}
.int-writable > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
  color: var(--ink-mute, #5a6a5d);
  font-size: 10px;
}
.int-writable[open] > summary::before {
  transform: rotate(90deg);
}
.int-writable > summary::-webkit-details-marker { display: none; }
.int-writable ul {
  margin: 8px 0 4px;
  padding-left: 20px;
  font-size: 13px;
  color: var(--ink, #1a2b1f);
  line-height: 1.7;
}
.int-writable li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.int-field-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #5a6a5d);
  background: var(--line, #e3e7e1);
  padding: 1px 6px;
  border-radius: 3px;
}
.int-writable .int-writable-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-mute, #5a6a5d);
  font-style: italic;
}

/* ============================================================
   FreshBooks revenue layer — v3.1
   ============================================================ */

/* Home metric tones — accent the financial row */
.metric-card.tone-money {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 65%);
}
.metric-card.tone-money .metric-value { color: var(--accent-ink); }
.metric-card.tone-warn {
  border-color: #c98a2b;
  background: linear-gradient(180deg, #fdf3e3 0%, var(--surface) 65%);
}
.metric-card.tone-warn .metric-value { color: #7a4f12; }
.metric-card.tone-flag {
  border-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-soft) 0%, var(--surface) 65%);
}
.metric-card.tone-flag .metric-value { color: var(--danger); }
.metric-card.tone-ok {
  border-color: #b9d6c4;
  background: var(--surface);
}
.metric-card.tone-ok .metric-value { color: var(--accent); }
.metric-card.tone-muted {
  background: var(--surface-alt);
  opacity: 0.85;
}
.metric-card.tone-muted .metric-value { color: var(--ink-mute); }

/* Billing view */
.billing-loading { color: var(--ink-mute); font-size: 13px; }
.billing-totals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.billing-total { display: flex; flex-direction: column; min-width: 120px; }
.billing-total-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}
.billing-total-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.billing-total-warn { color: var(--danger); }

.billing-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  background: var(--surface);
}
.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.billing-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  white-space: nowrap;
}
.billing-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.billing-table tbody tr:last-child td { border-bottom: none; }
.billing-table tbody tr:hover td { background: var(--surface-alt); }
.billing-num { text-align: right; font-variant-numeric: tabular-nums; }
.billing-pid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-mute);
}
.billing-empty {
  text-align: center;
  padding: 40px 12px;
  color: var(--ink-mute);
  font-style: italic;
}
.billing-foot {
  margin-top: var(--space-3);
  font-size: 12px;
  color: var(--ink-mute);
}
.billing-foot a { color: var(--accent); }

/* Invoice status chips */
.invstatus {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: capitalize;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink-mute);
  white-space: nowrap;
}
.invstatus-draft   { background: #f1f1ed; color: #555; }
.invstatus-sent    { background: #eaf1f7; color: #2c5d8a; border-color: #c4d8e8; }
.invstatus-viewed  { background: #ede9f5; color: #4a3a82; border-color: #d4ccea; }
.invstatus-partial { background: #fdf3e3; color: #7a4f12; border-color: #ecd6a8; }
.invstatus-paid    { background: var(--accent-soft); color: var(--accent); border-color: #b9d6c4; }
.invstatus-overdue,
.invstatus.invstatus-overdue { background: var(--danger-soft); color: var(--danger); border-color: #ecbfb6; }

/* Drawer Money panel */
.drawer-money .drawer-money-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-money-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}
.drawer-money-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--ink-mute);
  border: 1px solid var(--line);
}
.drawer-money-label { font-weight: 600; }
.drawer-money-detail {
  font-size: 12px;
  color: var(--ink-mute);
  text-align: right;
}
.drawer-money-row.drawer-money-ok {
  border-color: #b9d6c4;
  background: var(--accent-soft);
}
.drawer-money-row.drawer-money-ok .drawer-money-icon {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.drawer-money-row.drawer-money-ok .drawer-money-detail { color: var(--accent); }
.drawer-money-row.drawer-money-flag {
  border-color: #ecbfb6;
  background: var(--danger-soft);
}
.drawer-money-row.drawer-money-flag .drawer-money-icon {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.drawer-money-row.drawer-money-flag .drawer-money-detail { color: var(--danger); }
.drawer-money-row.drawer-money-warn {
  border-color: #ecd6a8;
  background: #fdf3e3;
}
.drawer-money-row.drawer-money-warn .drawer-money-icon {
  background: #c98a2b;
  color: #fff;
  border-color: #c98a2b;
}
.drawer-money-row.drawer-money-warn .drawer-money-detail { color: #7a4f12; }
.drawer-money-row.drawer-money-muted { opacity: 0.85; }
.drawer-money-linked {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
}
.drawer-money-linked.drawer-money-muted { font-style: italic; }
.drawer-money-linked code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.drawer-money-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-mute);
}
.drawer-money-hint a { color: var(--accent); }

/* ============================================================
   CRx project-name override field
   ============================================================ */
.crx-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-3);
}
.crx-name-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}
.crx-name-input {
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.crx-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.crx-name-input::placeholder {
  color: var(--ink-mute);
  font-style: italic;
  opacity: 0.65;
}
.crx-name-hint {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.4;
}

/* =====================================================================
   Permit QA v1 — drawer section styles
   ===================================================================== */

.drawer-qa-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.drawer-qa-version {
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.drawer-qa-hint {
  color: var(--ink-mute);
  font-size: 13px;
  margin: 6px 0 10px;
}
.drawer-qa-empty {
  color: var(--ink-mute);
  font-size: 13px;
  padding: 12px 0;
  text-align: center;
}
.drawer-qa-open {
  display: inline-block;
}

/* Summary tiles */
.qa-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.qa-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}
.qa-tile-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.qa-tile-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin-top: 3px;
}
.qa-tile-ok {
  border-color: rgba(67, 122, 34, 0.45);
  background: rgba(67, 122, 34, 0.06);
}
.qa-tile-flag {
  border-color: rgba(161, 44, 123, 0.45);
  background: rgba(161, 44, 123, 0.06);
}
.qa-tile-warn {
  border-color: rgba(150, 66, 25, 0.45);
  background: rgba(150, 66, 25, 0.06);
}

/* Filter bar */
.qa-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
}
.qa-filter-search {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
}
.qa-filter-select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  color: var(--ink);
}
.btn-mini {
  padding: 4px 10px;
  font-size: 12px;
}

/* Group (collapsible category) */
.qa-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.qa-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--ink);
}
.qa-group-head:hover { background: var(--surface-alt, var(--surface)); }
.qa-group-caret {
  font-size: 10px;
  color: var(--ink-mute);
  width: 12px;
  display: inline-block;
}
.qa-group-title {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}
.qa-group-count {
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* Items */
.qa-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.qa-item {
  border-bottom: 1px solid var(--line);
}
.qa-item:last-child { border-bottom: none; }
.qa-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
}
.qa-item-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-mute);
  padding: 3px 4px;
  flex-shrink: 0;
}
.qa-item-main {
  flex: 1;
  min-width: 0;
}
.qa-item-title {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}
.qa-item-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--ink-mute);
}
.qa-item-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}
.qa-item-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qa-chip {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-left: 2px;
  vertical-align: 1px;
}
.qa-chip-flag {
  background: rgba(161, 44, 123, 0.10);
  border-color: rgba(161, 44, 123, 0.45);
  color: #6a1c52;
}
.qa-chip-warn {
  background: rgba(150, 66, 25, 0.10);
  border-color: rgba(150, 66, 25, 0.45);
  color: #6d3013;
}

/* Status dropdown */
.qa-item-status {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 22px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  min-width: 130px;
}
.qa-status-not-started     { background: var(--bg); }
.qa-status-in-review       { background: rgba(0, 100, 148, 0.10);  border-color: rgba(0, 100, 148, 0.45); }
.qa-status-needs-revision  { background: rgba(150, 66, 25, 0.10);  border-color: rgba(150, 66, 25, 0.45); color: #6d3013; }
.qa-status-complete        { background: rgba(67, 122, 34, 0.10);  border-color: rgba(67, 122, 34, 0.45); color: #2f5814; }
.qa-status-n-a             { background: var(--surface); color: var(--ink-mute); }
.qa-status-deferred        { background: rgba(122, 57, 187, 0.08); border-color: rgba(122, 57, 187, 0.45); }

/* Expanded detail */
.qa-item-expanded { background: var(--surface-alt, var(--surface)); }
.qa-item-detail {
  padding: 4px 14px 14px 36px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}
.qa-item-detail p {
  margin: 4px 0;
}
.qa-detail-why {
  color: var(--ink);
}
.qa-standard-note {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.qa-standard-note blockquote {
  margin: 4px 0 6px;
  padding: 0;
  font-style: italic;
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 12.5px;
}
.qa-detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.qa-detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-mute);
}
.qa-detail-field-wide {
  grid-column: 1 / -1;
}
.qa-detail-field input,
.qa-detail-field textarea {
  font: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.qa-detail-field input:focus,
.qa-detail-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Footer */
.qa-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.qa-footer-note {
  font-size: 11px;
  color: var(--ink-mute);
}

/* ============================================================
   v3.2 — Project Milestones bar + Checklist-tab QA panel
   ============================================================ */

/* Milestones bar — top of Checklist tab */
.milestones-bar {
  margin: 16px 24px 0;
  padding: 18px 22px;
  background: #f6f1e6;
  border: 1px solid #e3d9c2;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.milestones-head { display: flex; flex-direction: column; gap: 2px; }
.milestones-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5b4d2c;
  margin: 0;
}
.milestones-sub {
  font-size: 13px;
  color: #6b6253;
  margin: 0;
}
.milestones-sub a { color: #6b5d2c; text-decoration: underline; }
.milestones-sub strong { color: #2b2410; font-weight: 600; }
.milestones-hint {
  font-size: 12px;
  color: #8b7c5a;
  margin: 0;
  font-style: italic;
}
.milestones-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.milestone-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #d9cdaf;
  color: #2b2410;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  font: inherit;
}
.milestone-btn:hover { background: #fbf6ea; border-color: #b8a674; }
.milestone-btn:active { transform: translateY(1px); }
.milestone-btn.disabled,
.milestone-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f3ecdb;
}
.milestone-btn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c4a96b;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(196, 169, 107, 0.18);
}
.milestone-btn.synced .milestone-btn-dot {
  background: #4f8a4b;
  box-shadow: 0 0 0 3px rgba(79, 138, 75, 0.18);
}
.milestone-btn.errored .milestone-btn-dot {
  background: #b34a3a;
  box-shadow: 0 0 0 3px rgba(179, 74, 58, 0.18);
}
.milestone-btn-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.milestone-btn-label {
  font-size: 14px;
  font-weight: 600;
  color: #2b2410;
}
.milestone-btn-sub {
  font-size: 12px;
  color: #6b6253;
}
.milestone-btn.synced .milestone-btn-sub { color: #4f8a4b; }
.milestone-btn.errored .milestone-btn-sub { color: #b34a3a; }

/* Checklist-tab Permit QA panel */
.checklist-view {
  padding: 8px 24px 32px;
}
.checklist-qa {
  background: #fff;
  border: 1px solid #e7e0cd;
  border-radius: 12px;
  padding: 18px 22px;
  margin-top: 16px;
}
.checklist-qa-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0e9d4;
  flex-wrap: wrap;
}
.checklist-qa-title {
  font-size: 18px;
  font-weight: 700;
  color: #2b2410;
  margin: 0;
}
.checklist-qa-version {
  font-size: 12px;
  color: #8b7c5a;
  font-style: italic;
}
.qa-hint {
  color: #6b6253;
  font-size: 14px;
  margin: 8px 0 14px;
  line-height: 1.5;
}
.qa-open {
  margin-top: 4px;
}

/* QA tiles look the same whether in drawer or tab, but give them a bit of
   breathing room in the tab context. Drawer-specific styles already exist. */
.checklist-qa .qa-tiles { margin-top: 10px; }
.checklist-qa .qa-filters { margin-top: 14px; }
.checklist-qa .qa-list { margin-top: 14px; }

@media (max-width: 720px) {
  .milestones-bar { margin: 12px 12px 0; padding: 14px; }
  .milestones-buttons { grid-template-columns: 1fr; }
  .checklist-view { padding: 8px 12px 24px; }
  .checklist-qa { padding: 14px 14px; }
}

/* ============================================================
   Auth — login view + user chip + users admin table
   ============================================================ */
.user-chip[hidden] { display: none !important; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 12px;
  background: #f4f1ea;
  border: 1px solid #d9d3c2;
  border-radius: 999px;
  color: #2d3a2f;
  font-size: 13px;
  margin-right: 4px;
}
.user-chip-email { font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2d3a2f; }
.user-chip-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2d6a4f;
  color: #ffffff;
}
.user-chip .btn { padding: 4px 10px; font-size: 12px; }
.user-chip .btn-ghost { color: #5a6b5d; }
.user-chip .btn-ghost:hover { color: #2d3a2f; background: rgba(0,0,0,0.04); }

.login-view {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #0f1a14 0%, #1a2a20 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}
.login-logo { width: 180px; height: auto; margin: 0 auto 8px; }
.login-title { font-size: 24px; margin: 8px 0 6px; color: #1a2a20; font-family: 'Fraunces', Georgia, serif; }
.login-sub { color: #6b6253; margin: 0 0 24px; font-size: 14px; line-height: 1.5; }
.login-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  text-decoration: none;
  font-weight: 500;
}
.login-google:hover { background: #f8f9fa; }
.login-error {
  background: #fdecea;
  color: #8a1f15;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 16px 0 0;
  font-size: 13px;
  text-align: left;
}
.login-foot { color: #8b8266; font-size: 12px; margin: 18px 0 0; }

.users-add-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 0.9fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.users-add-row .int-field { margin: 0; }
.users-add-row button { white-space: nowrap; }
.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}
.users-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b7c5a;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid #e8e3d2;
}
.users-table td {
  padding: 10px;
  border-bottom: 1px solid #f1ecd8;
  color: #2b2410;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table select.user-role-select {
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #d6cea8;
  background: #fff;
}
.users-table .user-remove-btn {
  background: none;
  border: none;
  color: #b04a3c;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.users-table .user-remove-btn:hover { background: #fdecea; }
.users-table .user-remove-btn:disabled { color: #b8b29c; cursor: not-allowed; background: none; }

@media (max-width: 720px) {
  .users-add-row { grid-template-columns: 1fr; }
  .user-chip-email { max-width: 120px; }
}
