/* BIG AV Home v2 design system.
   One stylesheet for the whole portal. Tokens first; every color, radius, shadow and
   ease below reads from them. Measurements follow docs/reference/demos/COMPONENTS.md.
   Graphik (400, 500, 700) when installed, Inter as the web fallback. */

:root {
  /* Surfaces */
  --page: #EEF0F4;
  --app: #F6F7F9;
  --card: #FFFFFF;
  --fill: #EFF1F5;
  --fill-2: #E6E9EF;
  --line: #E4E7EC;
  --line-soft: #EEF0F3;

  /* Ink */
  --ink: #111114;
  --ink-2: #3B3F4A;
  --muted: #62677A;
  --faint: #A3A7B1;  /* decoration only (rules, handles); never text */

  /* Brand */
  --brand-dark: #111114;
  --brand-dark-2: #1C1C24;
  --brand: #392BB3;
  --brand-press: #2E2391;
  --brand-ink: #FFFFFF;
  --brand-tint: #ECEAFB;
  --brand-text: #392BB3;

  /* Status */
  --ok: #0E7A48;     --ok-tint: #E0F5EA;
  --warn: #8A5600;   --warn-tint: #FBF0D8;
  --bad: #B23A33;    --bad-tint: #FBE6E4;
  --info: #2458C4;   --info-tint: #E8EFFC;
  --live: #3DDC84;

  /* Shape */
  --r-hero: 28px;
  --r-card: 22px;
  --r-row: 20px;
  --r-small: 18px;
  --r-field: 16px;
  --r-tile: 12px;
  --r-btn: 15px;
  --r-btn-md: 13px;
  --r-btn-sm: 11px;
  --r-btn-xs: 10px;
  --shadow: 0 1px 2px rgba(17,17,20,.04), 0 8px 28px -6px rgba(17,17,20,.07);
  --shadow-hero: 0 18px 40px -18px rgba(17,17,20,.55);
  --shadow-sheet: 0 -10px 40px rgba(0,0,0,.12);

  /* Motion */
  --ease: cubic-bezier(.2,.9,.25,1);
  --ease-spring: cubic-bezier(.3,1.25,.5,1);

  /* Type */
  --font: "Graphik", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --tabbar-h: 63px;
  --app-max: 460px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand-text); }
button { font: inherit; color: inherit; letter-spacing: inherit; }
input, textarea, select { font: inherit; letter-spacing: inherit; color: var(--ink); }
.tnum, .progress-num, .stat-num, .money { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.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; }
.logo { display: block; color: var(--ink); fill: currentColor; }

/* ---------- Buttons ---------- */
.btn, .b {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--r-btn-md);
  background: var(--brand); color: var(--brand-ink);
  font-size: 15px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.1;
  cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), background-color .2s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .b:active { transform: scale(.975); }
.btn:hover { background: var(--brand-press); }
.btn:disabled, .b:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.ghost, .b-fill { background: var(--fill); color: var(--ink); }
.btn.ghost:hover, .b-fill:hover { background: var(--fill-2); }
.b-lg { min-height: 52px; border-radius: var(--r-btn); font-size: 16px; padding: 0 22px; }
.b-sm { min-height: 38px; border-radius: var(--r-btn-sm); font-size: 14px; padding: 0 14px; }
.b-pill { min-height: 34px; border-radius: var(--r-btn-xs); font-size: 13.5px; padding: 0 13px; }
.b-dark { background: var(--brand-dark); color: #fff; }
.b-white { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.b-glass { background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.b-glass:hover { background: rgba(255,255,255,.24); }
.b-black { background: #000; color: #fff; border-radius: 999px; }
.b-block { width: 100%; }
.b svg, .btn svg { width: 18px; height: 18px; flex: none; }
.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--brand-text); font-size: 14px; font-weight: 500; cursor: pointer; min-height: 32px; }

/* ---------- Pills and chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 16px; letter-spacing: -0.005em;
  background: var(--fill); color: var(--ink-2); white-space: nowrap;
}
.pill-ok { background: var(--ok-tint); color: var(--ok); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-bad { background: var(--bad-tint); color: var(--bad); }
.pill-info { background: var(--info-tint); color: var(--info); }
.pill-brand { background: var(--brand-tint); color: var(--brand-text); }
.pill-dark { background: rgba(0,0,0,.32); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(61,220,132,.6); animation: live-pulse 1.8s infinite; flex: none; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,.6); } 70% { box-shadow: 0 0 0 6px rgba(61,220,132,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); } }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 500; }

/* ---------- Cards and sections ---------- */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px; }
.card-flat { padding: 0; overflow: hidden; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 28px 4px 12px; }
.section-title { font-size: 19px; font-weight: 700; letter-spacing: -0.025em; display: flex; align-items: center; gap: 8px; }
.section-link { font-size: 14px; font-weight: 500; color: var(--brand-text); background: none; border: 0; cursor: pointer; padding: 6px 0; position: relative; }
.section-link::after { content: ""; position: absolute; inset: -6px -8px; }
.section-label, .eyebrow-caps { font-size: 12px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin: 24px 4px 12px; }
.screen-title { font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.12; }
.screen-kicker { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.muted { color: var(--muted); }

/* Grouped list rows */
.list { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 13px; padding: 14px 16px; position: relative; min-height: 56px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 69px; right: 0; height: 1px; background: var(--line-soft); }
.row-flat + .row-flat::before { left: 16px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; }
.row-detail { font-size: 13px; color: var(--muted); margin-top: 2px; }
button.row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.row-chev { color: var(--faint); width: 18px; height: 18px; flex: none; }

.icon-tile { width: 40px; height: 40px; border-radius: var(--r-tile); display: grid; place-items: center; flex: none; background: var(--brand-tint); color: var(--brand); }
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.t-ok { background: var(--ok-tint); color: var(--ok); }
.icon-tile.t-warn { background: var(--warn-tint); color: var(--warn); }
.icon-tile.t-bad { background: var(--bad-tint); color: var(--bad); }
.icon-tile.t-info { background: var(--info-tint); color: var(--info); }
.icon-tile.t-dark { background: var(--brand-dark); color: #fff; }

/* Needs-attention rows */
.attention { display: flex; flex-direction: column; gap: 10px; }
.attn-row { position: relative; display: flex; align-items: center; gap: 13px; padding: 15px 16px; border-radius: var(--r-row); background: var(--card); box-shadow: var(--shadow); }
.attn-row.is-urgent::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--bad); }
.attn-title { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; }
.attn-detail { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Notes */
.note { display: flex; gap: 10px; padding: 13px 14px; border-radius: var(--r-field); font-size: 13.5px; line-height: 1.45; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.note-info { background: var(--info-tint); color: #20448F; }
.note-ok { background: var(--ok-tint); color: #14653B; }
.note-brand { background: var(--brand-tint); color: #2A1F86; }
.note-warn { background: var(--warn-tint); color: #7A4C00; }

/* Spec tiles */
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec { background: var(--fill); border-radius: 14px; padding: 10px 12px; }
.spec-label { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.spec-value { font-size: 14.5px; font-weight: 500; margin-top: 3px; letter-spacing: -0.015em; }

/* Toggle switch */
.switch { position: relative; width: 51px; height: 31px; flex: none; border-radius: 16px; background: #DCDFE5; border: 0; padding: 0; cursor: pointer; transition: background-color .3s var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .35s var(--ease-spring); }
.switch[aria-checked="true"] { background: var(--brand-dark); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* Progress: ring and segmented bar */
.ring { position: relative; width: 62px; height: 62px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .ring-track { stroke: rgba(255,255,255,.18); }
.ring .ring-fill { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 500; }
.segbar { display: flex; gap: 3px; height: 4px; }
.segbar span { flex: 1; border-radius: 2px; background: rgba(255,255,255,.22); }
.segbar span.on { background: #fff; }
.segbar span.now { background: linear-gradient(90deg, #fff 50%, rgba(255,255,255,.22) 50%); }
.segbar.on-light span { background: var(--fill-2); }
.segbar.on-light span.on { background: var(--ok); }
.segbar.on-light span.now { background: linear-gradient(90deg, var(--ok) 50%, var(--fill-2) 50%); }

/* ---------- Hero card ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  border-radius: var(--r-hero); min-height: 262px;
  background: var(--brand-dark);
  box-shadow: var(--shadow-hero);
  isolation: isolate;
}
.hero-art {
  position: absolute; inset: 0; z-index: -2;
  background:
    var(--hero-photo, none) center / cover no-repeat,
    radial-gradient(120% 70% at 85% 8%, rgba(255,214,153,.38) 0%, rgba(255,214,153,0) 52%),
    radial-gradient(90% 60% at 10% 100%, rgba(57,43,179,.55) 0%, rgba(57,43,179,0) 60%),
    linear-gradient(160deg, #2A2A34 0%, #17171D 55%, #0D0D11 100%);
}
.hero-art::after {
  /* Room silhouette: a soft window band and floor line, so the placeholder reads as a finished room. */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 0 58%, rgba(255,255,255,.05) 58% 59%, transparent 59%),
    linear-gradient(90deg, transparent 0 62%, rgba(255,236,200,.10) 62% 86%, transparent 86%) top / 100% 46% no-repeat;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,10,14,.35) 0%, rgba(10,10,14,0) 30%, rgba(10,10,14,.35) 50%, rgba(10,10,14,.92) 100%);
}
.hero-inner { position: relative; min-height: 262px; padding: 18px; display: flex; flex-direction: column; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hero-body { margin-top: auto; }
.hero-title { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.hero-sub { font-size: 13.5px; opacity: .78; margin-top: 4px; }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; }
.hero-actions .b { min-height: 44px; border-radius: var(--r-btn-md); flex: 1; }
.hero-actions .b-glass { flex: 0 1 auto; padding: 0 16px; }
.hero-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; opacity: .85; margin-top: 10px; }
.hero .segbar { margin-top: 14px; }
.hero-big { font-size: 46px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; }
.glass-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.glass-tile { background: rgba(255,255,255,.12); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 14px; padding: 9px 10px; }
.glass-tile-label { font-size: 11.5px; opacity: .7; }
.glass-tile-value { font-size: 15px; font-weight: 500; margin-top: 2px; }

/* ---------- Bottom sheets (all .modal-bg) ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(10,12,14,.4);
}
.modal-bg.show { display: flex; animation: sheet-fade .35s var(--ease); }
.modal {
  position: relative; width: 100%; max-width: var(--app-max);
  max-height: calc(100dvh - 8px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--app); border-radius: 30px 30px 0 0; box-shadow: var(--shadow-sheet);
  padding: 22px 18px calc(18px + var(--safe-b));
  animation: sheet-up .45s var(--ease);
}
.modal::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: #D3D6DC; }
.modal h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.025em; margin: 8px 0 6px; padding-right: 36px; }
.modal > p, .modal p.task-modal-stage-name { font-size: 14px; color: var(--muted); margin-bottom: 16px; line-height: 1.45; }
.modal--wide { max-width: 560px; }
.modal-form-row { margin-bottom: 14px; }
.modal-form-row > label, .modal label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.modal-input, .modal-textarea, .pin-input {
  display: block; width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-field); background: var(--card);
  font-size: 16px; line-height: 1.35; outline: none; transition: border-color .2s, box-shadow .2s;
}
.modal-textarea { min-height: 104px; resize: vertical; }
.modal-input:focus, .modal-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.modal-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions {
  position: sticky; bottom: calc(-18px - var(--safe-b)); z-index: 2;
  display: flex; gap: 10px; margin: 18px -18px calc(-18px - var(--safe-b)); padding: 12px 18px calc(14px + var(--safe-b));
  background: var(--app); border-top: 1px solid var(--line);
}
.modal-actions .btn { flex: 1; min-height: 52px; border-radius: var(--r-btn); font-size: 16px; }
.modal-actions .btn.ghost { flex: 0 0 34%; }
.role-options { display: grid; gap: 8px; }
.role-option { text-align: left; border: 2px solid transparent; background: var(--card); border-radius: var(--r-small); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; min-height: 56px; transition: border-color .2s; }
.role-option.selected, .role-option[aria-pressed="true"] { border-color: var(--brand-dark); }
.role-option-name { font-size: 15px; font-weight: 500; }
.role-option-desc { font-size: 13px; color: var(--muted); margin-top: 3px; }
.sheet-close { position: absolute; top: 18px; right: 16px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--fill-2); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; z-index: 3; }
@keyframes sheet-fade { from { background: rgba(10,12,14,0); } to { background: rgba(10,12,14,.4); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- Toast ---------- */
.portal-notice {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 300;
  transform: translateX(-50%); width: min(92vw, 420px);
  background: var(--brand-dark); color: #fff; border-radius: 18px; padding: 13px 16px;
  font-size: 14px; line-height: 1.4; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  animation: toast-in .5s var(--ease-spring);
}
#project-load-error.portal-notice { position: static; transform: none; width: auto; margin: 12px 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; animation: none; background: var(--bad-tint); color: #8A231D; box-shadow: none; }
#project-load-error .btn { min-height: 38px; }
@keyframes toast-in { from { transform: translate(-50%, -24px) scale(.96); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
.action-error { margin-top: 10px; padding: 11px 14px; border-radius: 14px; background: var(--bad-tint); color: #8A231D; font-size: 13.5px; }
body.portal-saving { cursor: progress; }

/* ============================================================
   APP SHELL
   ============================================================ */
.container.app {
  position: relative; width: 100%; max-width: var(--app-max); min-height: 100vh; margin: 0 auto;
  background: var(--app); padding: 0 16px calc(var(--tabbar-h) + 40px + var(--safe-b));
}

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(18px + env(safe-area-inset-top, 0px)) 4px 6px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-dark); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark .logo { width: 30px; height: auto; color: #fff; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot-unread { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.role-pill-wrap { position: relative; }
.role-pill { width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; color: #fff; font-size: 14px; font-weight: 500; background: linear-gradient(135deg, #6E62D6, var(--brand)); display: grid; place-items: center; }
.role-pill[data-role="tech"] { background: linear-gradient(135deg, #5C6472, #2B3039); }
.role-pill[data-role="admin"] { background: linear-gradient(135deg, #3A3A46, var(--brand-dark)); }
.role-pill .dot { display: none; }
.role-pill-menu {
  position: absolute; right: 0; top: 48px; z-index: 150; width: 280px; display: none; flex-direction: column;
  background: var(--card); border-radius: var(--r-small); box-shadow: 0 18px 50px -12px rgba(17,17,20,.3), 0 0 0 1px rgba(17,17,20,.04);
  padding: 8px; animation: menu-in .3s var(--ease);
}
.role-pill-menu[data-open="true"] { display: flex; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.menu-name { font-size: 15px; font-weight: 500; }
.menu-role { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.menu-field { padding: 6px 10px 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.menu-field select { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--app); padding: 0 12px; font-size: 15px; }
.menu-sync { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 10px 8px; font-size: 12px; color: var(--muted); }
.menu-sync .btn { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.rpm-item { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; font-size: 15px; }
.rpm-item:hover { background: var(--fill); }
.rpm-item[hidden] { display: none; }
.rpm-danger { color: var(--bad); }
.rpm-divider { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.sync-status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--ink-2); cursor: pointer; }
.sync-status-pill.ss-synced { background: var(--ok-tint); color: var(--ok); }
.sync-status-pill.ss-saving { background: var(--info-tint); color: var(--info); }
.sync-status-pill.ss-offline, .sync-status-pill.ss-failed { background: var(--bad-tint); color: var(--bad); }
#updated-date { font-size: 12px; color: var(--muted); }

.view-as-banner { display: none; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; padding: 10px 14px; border-radius: 14px; background: var(--warn-tint); color: #7A4C00; font-size: 13px; }
.view-as-banner[data-open="true"] { display: flex; }
.vab-back { border: 0; background: #fff; border-radius: 10px; min-height: 34px; padding: 0 12px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }

/* Screen routing. Every part of the project view declares which screens show it. */
#project-content [data-screens] { display: none; }
body[data-screen="proposal"] #project-content [data-screens~="proposal"],
body[data-screen="home"] #project-content [data-screens~="home"],
body[data-screen="payments"] #project-content [data-screens~="payments"],
body[data-screen="documents"] #project-content [data-screens~="documents"],
body[data-screen="system"] #project-content [data-screens~="system"],
body[data-screen="atlas"] #project-content [data-screens~="atlas"],
body[data-screen="messages"] #project-content [data-screens~="messages"],
body[data-screen="build"] #project-content [data-screens~="build"],
body[data-screen="build"][data-build="progress"] #project-content [data-screens~="build-progress"],
body[data-screen="build"][data-build="items"] #project-content [data-screens~="build-items"],
body[data-screen="build"][data-build="changes"] #project-content [data-screens~="build-changes"],
body[data-screen="build"][data-build="activity"] #project-content [data-screens~="build-activity"] { display: block; animation: view-in .35s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.overview-panel { display: contents; }
.screen-head { margin: 14px 4px 16px; }
.footer { display: none; }

/* Segmented control (Build sub views) */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; border-radius: 14px; background: var(--fill-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 1 auto; min-width: 0; min-height: 38px; border: 0; border-radius: 11px; background: none; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background-color .25s var(--ease), color .25s; }
.tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(17,17,20,.1); }
.tab .count { font-size: 12px; color: var(--muted); font-weight: 400; }
.tab.has-pending .count { color: #fff; background: var(--bad); border-radius: 9px; padding: 0 6px; }

/* Bottom tab bar */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; z-index: 120; transform: translateX(-50%);
  width: 100%; max-width: var(--app-max);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 8px 4px calc(12px + var(--safe-b));
  background: rgba(250,250,252,.84); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border-top: 0.5px solid rgba(0,0,0,.09);
}
.bnav-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0 0; min-height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bnav-btn svg { width: 24px; height: 24px; stroke-width: 1.7; transition: transform .25s var(--ease-spring); }
.bnav-btn.active { color: var(--brand); }
.bnav-btn.active svg { stroke-width: 2; }
.bnav-btn:active svg { transform: scale(.9); }
.bnav-label { font-size: 10.5px; font-weight: 500; }
.bnav-badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; border: 2px solid #F8F8FA; }

/* ============================================================
   EXISTING PORTAL COMPONENTS IN THE NEW STYLE
   ============================================================ */

/* Screen header (Build) */
.header { margin: 14px 4px 16px; }
.header .eyebrow { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.header h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.12; }
.header h1 em { font-style: normal; }
.header .subhead { display: none; }

/* Job completion card (Build) */
.progress-panel { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.progress-top { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
.progress-label { font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.progress-num { font-size: 44px; font-weight: 700; letter-spacing: -0.045em; line-height: 1.05; margin-top: 4px; }
.progress-num .pct { font-size: 24px; letter-spacing: -0.02em; margin-left: 2px; color: var(--ink-2); }
.progress-sublabel { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.progress-summary { font-size: 14.5px; line-height: 1.45; margin-top: 4px; }
.job-progress-awaiting { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; margin: 6px 0 4px; }
.progress-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--fill-2); gap: 2px; }
.progress-bar span { display: block; height: 100%; transition: width .9s var(--ease); }
.seg-complete { background: var(--ok); }
.seg-input { background: var(--warn); }
.seg-attention { background: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.stat { background: var(--fill); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat-num { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.stat-label { font-size: 11px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px; }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.stat-dot.complete { background: var(--ok); } .stat-dot.input { background: var(--warn); } .stat-dot.attention { background: var(--bad); } .stat-dot.pending { background: var(--faint); }
.progress-panel.is-empty { padding: 18px 20px; }
#punch-empty-summary { margin: 6px 0; font-size: 15px; }

/* Project journey as a timeline */
.project-journey { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.journey-header { display: flex; justify-content: space-between; align-items: baseline; }
.journey-eyebrow { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.journey-sublabel { font-size: 13px; color: var(--muted); margin-top: 2px; }
.journey-summary { font-size: 14px; color: var(--ink-2); margin: 10px 0 14px; }
.stage-stepper { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 -4px 12px; scrollbar-width: none; }
.stage-stepper::-webkit-scrollbar { display: none; }
.stage-node { flex: 1 0 auto; min-width: 84px; min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--fill); cursor: pointer; text-align: left; transition: background-color .2s; }
.stage-node-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.stage-node[data-status="complete"] .stage-node-dot { background: var(--ok); }
.stage-node[data-status="in_progress"] { background: var(--brand-tint); }
.stage-node[data-status="in_progress"] .stage-node-dot { background: var(--brand); box-shadow: 0 0 0 4px rgba(57,43,179,.18); }
.stage-node.is-selected { outline: 2px solid var(--brand-dark); outline-offset: -2px; }
.stage-name { font-size: 13.5px; font-weight: 500; }
.stage-date { font-size: 11.5px; color: var(--muted); }
.stage-card { border-radius: var(--r-small); background: var(--app); padding: 16px; }
.stage-card + .stage-card { margin-top: 10px; }
.stage-card-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--brand-text); }
.stage-card[data-status="complete"] .stage-card-eyebrow { color: var(--ok); }
.stage-card[data-status="not_started"] .stage-card-eyebrow { color: var(--muted); }
.stage-card-title { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; }
.stage-card-dates { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stage-card-summary { font-size: 14px; color: var(--ink-2); margin-top: 8px; line-height: 1.45; }
.stage-checklist { list-style: none; margin: 12px 0 0; padding: 0; position: relative; }
.stage-check-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 0 12px; }
.stage-check-item:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 36px; bottom: -8px; width: 2px; background: var(--line); }
.stage-check-item[data-complete="true"]:not(:last-child)::after { background: var(--ok); }
.stage-check-box { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--line); background: var(--card); color: transparent; }
.stage-check-box svg { width: 14px; height: 14px; }
.stage-check-item[data-complete="true"] .stage-check-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.stage-check-item[data-status="in_progress"] .stage-check-box { border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-tint); }
body.can-edit-status .stage-check-item { cursor: pointer; }
.stage-check-content { flex: 1; min-width: 0; }
.stage-check-text { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; }
.stage-check-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.stage-check-chip { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--fill); color: var(--ink-2); }
.stage-check-chip[data-chip="complete"] { background: var(--ok-tint); color: var(--ok); }
.stage-check-chip[data-chip="in_progress"] { background: var(--brand-tint); color: var(--brand-text); }
.stage-check-chip[data-chip="blocked"], .stage-check-chip[data-chip="overdue"] { background: var(--bad-tint); color: var(--bad); }
.stage-check-chip[data-chip="needs_review"] { background: var(--warn-tint); color: var(--warn); }
.task-controls { display: flex; gap: 6px; flex: none; }
.task-control-btn, .add-task-btn { min-height: 32px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--fill); font-size: 13px; font-weight: 500; cursor: pointer; }
.add-task-btn { margin-top: 10px; min-height: 40px; width: 100%; color: var(--brand-text); background: var(--brand-tint); }
.toggle-stages-btn { width: 100%; min-height: 44px; margin-top: 12px; border: 0; border-radius: 13px; background: var(--fill); font-size: 14px; font-weight: 500; cursor: pointer; }
.toggle-stages-btn .arrow { display: inline-block; transition: transform .3s var(--ease); }
.toggle-stages-btn.expanded .arrow { transform: rotate(180deg); }
.all-stages { display: none; flex-direction: column; gap: 10px; margin-top: 12px; }
.all-stages.show { display: flex; }
.service-options-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.service-options-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.service-options-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.service-option { background: var(--card); border-radius: 14px; padding: 12px 14px; }
.service-option-title { font-size: 14.5px; font-weight: 500; }
.service-option-desc, .service-options-note { font-size: 13px; color: var(--muted); margin-top: 3px; }
.btn-request-service { margin-top: 10px; min-height: 44px; width: 100%; border: 0; border-radius: var(--r-btn-md); background: var(--brand); color: #fff; font-weight: 500; cursor: pointer; }

/* Punch list: filters and items */
.controls { margin: 0 0 12px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-btn { flex: none; min-height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: var(--card); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.filter-btn .count { font-size: 12px; color: var(--muted); }
.filter-btn.active { background: var(--brand-dark); color: #fff; }
.filter-btn.active .count { color: rgba(255,255,255,.7); }
.punch-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 4px 12px; flex-wrap: wrap; }
.punch-list-toolbar h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.025em; }
.punch-list-toolbar-actions { display: flex; gap: 8px; }
.punch-list-add-btn, .punch-list-add-btn-secondary { min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-btn-sm); font-size: 14px; font-weight: 500; cursor: pointer; }
.punch-list-add-btn { background: var(--brand); color: #fff; }
.punch-list-add-btn-secondary { background: var(--fill-2); color: var(--ink); }
.punch-list-empty, .co-empty, .empty-state, .thread-empty, .scope-empty { padding: 22px 18px; border-radius: var(--r-small); background: var(--card); box-shadow: var(--shadow); color: var(--muted); font-size: 14px; line-height: 1.45; text-align: center; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border-radius: var(--r-row); box-shadow: var(--shadow); overflow: hidden; }
.item.hidden { display: none; }
.item-row { display: flex; align-items: flex-start; gap: 12px; padding: 15px 16px; cursor: pointer; }
.item-num { width: 34px; height: 34px; border-radius: 11px; background: var(--fill); display: grid; place-items: center; font-size: 12.5px; font-weight: 500; color: var(--ink-2); flex: none; font-variant-numeric: tabular-nums; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; }
.item-detail { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.item-schedule { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 3px; font-size: 12.5px; }
.item-schedule .lbl { color: var(--muted); margin-right: 6px; }
.item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.item-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.item-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.item-status[data-status="completed"] { background: var(--ok-tint); color: var(--ok); }
.item-status[data-status="needs_input"] { background: var(--warn-tint); color: var(--warn); }
.item-status[data-status="needs_attention"] { background: var(--bad-tint); color: var(--bad); }
.item-status[data-status="in_progress"] { background: var(--brand-tint); color: var(--brand-text); }
.item-status[data-status="needs_admin_review"] { background: var(--info-tint); color: var(--info); }
.item-status[data-status="check"] { background: var(--brand-tint); color: var(--brand-text); }
.item-thread-count { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.item-thread-count svg { width: 14px; height: 14px; }
.item-thread-count.has-unread { color: var(--bad); }
.item-actions-wrap { position: relative; }
.item-actions-btn { width: 36px; height: 32px; border: 0; border-radius: 10px; background: var(--fill); cursor: pointer; font-size: 18px; line-height: 1; }
.item-actions-menu { position: absolute; right: 0; top: 38px; z-index: 30; min-width: 220px; display: none; flex-direction: column; padding: 6px; border-radius: 16px; background: var(--card); box-shadow: 0 18px 50px -12px rgba(17,17,20,.3), 0 0 0 1px rgba(17,17,20,.04); }
.item-actions-menu[data-open="true"] { display: flex; }
.item-action-item { min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 14.5px; cursor: pointer; }
.item-action-item:hover { background: var(--fill); }
.item-action-item-danger { color: var(--bad); }
.item-action-divider { height: 1px; background: var(--line-soft); margin: 4px; }
.item-resolution-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.item-resolution-note { font-size: 13px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--fill); }
.item[data-status="completed"] .item-title, .item[data-status="cancelled"] .item-title { color: var(--ink-2); }
.archive-toggle { width: 100%; min-height: 44px; margin-top: 4px; border: 0; border-radius: 14px; background: var(--fill); font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.archive-toggle-caret { display: inline-block; transition: transform .3s var(--ease); }
.archive-toggle[data-open="true"] .archive-toggle-caret { transform: rotate(90deg); }
.archive-section { display: none; margin-top: 10px; flex-direction: column; gap: 10px; }
.archive-section[data-open="true"] { display: flex; }
.item-thread { display: none; padding: 0 16px 16px; border-top: 1px solid var(--line-soft); }
.item.expanded .item-thread { display: block; }

/* Threads (messages) */
.thread-msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 12px; }
.thread-msg[data-author="client"] { align-items: flex-end; }
.thread-meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); margin: 0 6px 4px; }
.thread-meta .author { font-weight: 500; color: var(--ink-2); margin-right: 6px; }
.thread-body { max-width: 86%; padding: 10px 13px; border-radius: 19px 19px 19px 6px; background: var(--card); box-shadow: 0 1px 1px rgba(0,0,0,.04); font-size: 15px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-thread .thread-body { background: var(--fill); box-shadow: none; }
.thread-msg[data-author="client"] .thread-body { background: var(--brand); color: #fff; border-radius: 19px 19px 6px 19px; }
.type-tag { display: inline-flex; padding: 1px 7px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-text); font-size: 10.5px; font-weight: 500; }
.thread-loading { color: var(--muted); }
.thread-empty { margin-top: 12px; }
.composer { margin-top: 14px; }
.composer-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--fill-2); margin-bottom: 8px; }
.composer-tab { min-height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.composer-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(17,17,20,.1); }
.composer textarea { width: 100%; min-height: 84px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-field); background: var(--card); font-size: 16px; resize: vertical; outline: none; }
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.composer-hint { font-size: 12px; color: var(--muted); }

/* Messages screen */
.messages-card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px; }
#project-conversation { background: none; box-shadow: none; padding: 0; }
#project-conversation .ps-header { display: none; }
#project-thread { min-height: 40px; }
#project-thread .thread-msg[data-author="admin"] .thread-body,
#project-thread .thread-msg[data-author="tech"] .thread-body { background: var(--card); }

/* Chat: header with call, bubbles, quick replies and a pill composer pinned above the tab bar */
.chat-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; margin-top: 12px; }
.chat-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; background: var(--brand); }
.chat-avatar img { width: 100%; height: 100%; display: block; }
.chat-who { flex: 1; min-width: 0; }
.chat-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.chat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chat-call { flex: none; color: var(--brand); text-decoration: none; }
#project-thread { padding-bottom: 8px; }
#project-thread .thread-empty { text-align: center; padding: 28px 18px; background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); color: var(--muted); font-size: 14px; }
.chat-dock { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 5; margin: 8px -16px 0; padding: 8px 16px 6px; background: linear-gradient(180deg, rgba(246,247,249,0) 0, var(--app) 14px); }
.quick-replies { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 10px; }
.quick-replies::-webkit-scrollbar { display: none; }
.quick-reply { flex: none; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 17px; box-sizing: border-box; background: var(--card); color: var(--ink-2); font-size: 13.5px; cursor: pointer; position: relative; }
.quick-reply::after { content: ""; position: absolute; inset: -6px 0; }
.composer-bar { display: flex; align-items: flex-end; gap: 8px; }
#project-message { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); font-size: 16px; line-height: 1.3; resize: none; outline: none; field-sizing: content; }
#project-message:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
#send-project-message { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
#send-project-message svg { margin-left: -2px; }
body[data-screen="messages"] .container.app { padding-bottom: 8px; }

/* Contact card (residence block) */
.residence-section { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.residence-info { display: grid; gap: 12px; }
.residence-info-block { display: flex; flex-direction: column; gap: 2px; }
.residence-info-label { font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.residence-info-value { font-size: 15px; font-weight: 500; }
.residence-contact-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.contact-link { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: var(--r-small); background: var(--fill); color: var(--ink); text-decoration: none; font-size: 12.5px; font-weight: 500; }
.contact-link svg { width: 20px; height: 20px; stroke-width: 1.8; color: var(--brand); }

/* Project summary (staff only reference) */
.project-summary { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.ps-header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ps-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ps-status-line { font-size: 12px; color: var(--muted); }
.ps-body p { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.network-strip { display: none; }

/* Change orders */
.co-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 12px; flex-wrap: wrap; }
.co-toolbar-blurb { font-size: 13.5px; color: var(--muted); line-height: 1.45; flex: 1 1 220px; }
#propose-co-btn { min-height: 44px; border-radius: var(--r-btn-sm); font-size: 14px; }
.change-orders-list { display: flex; flex-direction: column; gap: 12px; }
.co-card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px; position: relative; }
.co-card[data-status="proposed"]::before { content: ""; position: absolute; left: 0; top: 18px; width: 3px; height: 40px; border-radius: 0 3px 3px 0; background: var(--bad); }
.co-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.co-title { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.co-status-pill { flex: none; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--fill); color: var(--ink-2); }
.co-status-pill[data-status="proposed"] { background: var(--warn-tint); color: var(--warn); }
.co-status-pill[data-status="approved"], .co-status-pill[data-status="scheduled"], .co-status-pill[data-status="complete"] { background: var(--ok-tint); color: var(--ok); }
.co-status-pill[data-status="declined"] { background: var(--bad-tint); color: var(--bad); }
.co-origin-pill { display: inline-flex; margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-text); font-size: 12px; font-weight: 500; }
.co-meta-row { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.co-section { margin-top: 12px; }
.co-section-label { font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.co-section-body { font-size: 14px; line-height: 1.45; margin-top: 3px; white-space: pre-wrap; color: var(--ink-2); }
.co-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.co-grid-cell { background: var(--fill); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.co-grid-cell .label { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.co-grid-cell .value { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.co-client-response { margin-top: 12px; padding: 11px 13px; border-radius: 14px; background: var(--ok-tint); color: #14653B; font-size: 13px; }
.co-client-response.declined { background: var(--bad-tint); color: #8A231D; }
.co-client-note { margin-top: 4px; font-style: italic; }
.co-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-confirm, .btn-decline { flex: 1 1 140px; min-height: 48px; border: 0; border-radius: var(--r-btn-md); font-size: 15px; font-weight: 500; cursor: pointer; }
.btn-confirm { background: var(--brand); color: #fff; }
.btn-decline { background: var(--fill-2); color: var(--ink); }
.co-actions .secondary-note { flex-basis: 100%; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.co-admin-controls { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.co-admin-btn { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--fill); font-size: 13px; font-weight: 500; cursor: pointer; }
.co-admin-btn-danger { color: var(--bad); }

/* Activity */
.activity-list { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.activity-list .empty-state { box-shadow: none; }
.activity-item { padding: 13px 16px; display: flex; flex-direction: column; gap: 2px; }
.activity-item + .activity-item { border-top: 1px solid var(--line-soft); }
.activity-time { font-size: 11.5px; color: var(--muted); }
.activity-text { font-size: 14px; line-height: 1.45; }
.activity-text .actor { font-weight: 500; }
.activity-text .item-ref { color: var(--ink-2); }

/* Scope checklist (portal-checklist.js) */
.scope-checklist { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.scope-header .ps-eyebrow { display: block; margin-bottom: 4px; }
.scope-checklist h2 { font-size: 19px; font-weight: 500; letter-spacing: -0.025em; margin: 0 0 4px; }
.scope-checklist h3 { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; margin: 20px 0 10px; }
.scope-checklist h4 { font-size: 15px; font-weight: 500; line-height: 1.35; margin: 0; letter-spacing: -0.015em; }
.scope-checklist p { font-size: 14px; line-height: 1.45; margin: 8px 0; color: var(--ink-2); }
.scope-checklist label { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.5; margin: 10px 0; color: var(--ink-2); }
.scope-checklist input:not([type=checkbox]), .scope-checklist textarea, .scope-checklist select { display: block; width: 100%; margin-top: 5px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; outline: none; }
.scope-checklist textarea { resize: vertical; }
.scope-checklist input:focus, .scope-checklist textarea:focus, .scope-checklist select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.scope-checklist summary { cursor: pointer; font-size: 14.5px; font-weight: 500; min-height: 40px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scope-checklist button:disabled { opacity: .4; cursor: not-allowed; }
.scope-checklist .btn { min-height: 44px; margin-top: 8px; font-size: 14.5px; }
.scope-import, .scope-draft { padding: 14px; border-radius: var(--r-small); background: var(--app); margin: 12px 0; }
.scope-import textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.scope-meta { font-size: 12.5px !important; color: var(--muted) !important; overflow-wrap: anywhere; }
.scope-hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px !important; }
.scope-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--fill); color: var(--ink-2); white-space: normal; }
.scope-chip[data-status="complete"] { background: var(--ok-tint); color: var(--ok); }
.scope-chip[data-status="in_progress"] { background: var(--brand-tint); color: var(--brand-text); }
.scope-chip[data-status="blocked"] { background: var(--bad-tint); color: var(--bad); }
.scope-hold { color: #8A231D !important; background: var(--bad-tint); border-radius: 12px; padding: 9px 12px; }
.scope-draft-stage { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.scope-review-task { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.scope-review-check { display: flex !important; align-items: flex-start; gap: 9px; }
.scope-review-check input, .scope-check { accent-color: var(--brand); width: 22px; height: 22px; flex: none; margin-top: 1px; cursor: pointer; }
.scope-check:disabled { cursor: not-allowed; opacity: .5; }
.scope-review-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.scope-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scope-overview { margin: 14px 0 6px; }
.scope-overview h3 { margin: 0 0 8px; font-size: 15px; }
.scope-progress { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.scope-progress strong { color: var(--ink); font-weight: 500; }
.scope-area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; margin-top: 12px; }
.scope-area-link { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 14px; background: var(--fill); color: inherit; text-decoration: none; font-size: 12.5px; min-height: 44px; }
.scope-area-link strong { font-size: 14.5px; font-weight: 500; }
.scope-area-link small { color: var(--muted); }
.scope-area-view { color: var(--brand-text); font-weight: 500; margin-top: 4px; }
.scope-published-stage { scroll-margin-top: 20px; }
.scope-task { padding: 14px; border-radius: var(--r-small); background: var(--app); margin: 8px 0; }
.scope-task-heading { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.scope-task-heading h4 { flex: 1 1 calc(100% - 40px); }
.scope-check-readonly { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: var(--ok); background: var(--ok-tint); flex: none; }
.scope-client-update { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--ok-tint); }
.scope-client-update h4 { font-size: 13px; color: #14653B; }
.scope-client-update p { white-space: pre-wrap; color: #14653B; }
.scope-client-editor, .scope-field-editor { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.scope-fields { display: grid; grid-template-columns: 1fr; }
.scope-release { border-radius: var(--r-small); background: var(--warn-tint); padding: 14px; margin: 14px 0; }
.scope-release-state { color: #7A4C00 !important; margin-top: 0 !important; }
.scope-chip[data-draft-state="walkthrough"], .scope-visibility[data-visibility="private"] { background: var(--warn-tint); color: var(--warn); }
.scope-chip[data-draft-state="client"], .scope-visibility[data-visibility="client"] { background: var(--ok-tint); color: var(--ok); }

/* Catalog and selection bar stay unreachable; keep them hidden. */
.selection-bar, #panel-catalog { display: none !important; }

/* ============================================================
   AUTH SCREENS
   ============================================================ */
.auth-overlay { position: fixed; inset: 0; z-index: 400; display: none; justify-content: center; background: var(--page); overflow-y: auto; }
.auth-overlay.show { display: flex; }
.auth-shell { position: relative; width: 100%; max-width: var(--app-max); min-height: 100%; background: var(--app); display: flex; flex-direction: column; }
.auth-hero { position: relative; height: 34vh; min-height: 210px; max-height: 360px; overflow: hidden; flex: none; }
.auth-hero .hero-art { z-index: 0; }
.auth-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(246,247,249,0) 45%, var(--app) 100%); }
.auth-card { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; padding: 0 26px calc(28px + var(--safe-b)); margin-top: -64px; }
.auth-card[style*="display:none"], .auth-card[style*="display: none"] { display: none !important; }
.auth-logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-logo-row .brand-mark { width: 56px; height: 56px; border-radius: 16px; }
.auth-logo-row .brand-mark .logo { width: 40px; }
.auth-wordmark { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.auth-wordmark span { display: block; font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: -0.01em; }
.auth-headline { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; }
.auth-sub { font-size: 15px; color: var(--muted); line-height: 1.5; margin-top: 10px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.auth-field { position: relative; background: var(--card); border-radius: var(--r-field); box-shadow: var(--shadow); }
.auth-field label { position: absolute; top: 9px; left: 14px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.auth-email-input, .auth-password-input { display: block; width: 100%; height: 58px; padding: 22px 14px 8px; border: 1.5px solid transparent; border-radius: var(--r-field); background: transparent; font-size: 16px; outline: none; }
.auth-email-input:focus { border-color: var(--brand); }
.auth-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; border: 0; border-radius: var(--r-btn); font-size: 16px; font-weight: 500; cursor: pointer; text-decoration: none; transition: transform .12s var(--ease), opacity .2s; }
.auth-btn:active { transform: scale(.975); }
.auth-btn:disabled { opacity: .45; cursor: not-allowed; }
.auth-btn-primary { background: var(--brand); color: #fff; margin-top: 4px; }
.auth-btn-google, .auth-btn-apple, .auth-btn-secondary { background: var(--fill); color: var(--ink); }
.auth-google-icon, .auth-apple-icon { width: 18px; height: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 6px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-trust { margin-top: auto; padding-top: 28px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-restore-failed-message { margin-bottom: 14px; padding: 11px 14px; border-radius: 14px; background: var(--warn-tint); color: #7A4C00; font-size: 14px; }
.auth-contact-mail { display: inline-block; margin: 16px 0; font-weight: 500; }
.auth-card-loading { justify-content: center; align-items: center; text-align: center; margin-top: 0; }
.auth-card-loading .auth-logo-row { justify-content: center; }
.auth-loading-text { font-size: 15px; color: var(--muted); }
#auth-magic-sent .auth-btn, #auth-denied .auth-btn { margin-top: 22px; }

/* ============================================================
   DESKTOP: the app keeps its phone column, centred on the page.
   Staff get a wider column for field and admin work.
   ============================================================ */
@media (min-width: 768px) {
  body { background:
      radial-gradient(60% 50% at 85% 0%, rgba(57,43,179,.08) 0%, rgba(57,43,179,0) 70%),
      radial-gradient(50% 40% at 0% 100%, rgba(17,17,20,.05) 0%, rgba(17,17,20,0) 70%),
      var(--page); background-attachment: fixed; }
  .container.app { margin: 24px auto; min-height: calc(100vh - 48px); border-radius: 36px; box-shadow: 0 30px 80px -40px rgba(17,17,20,.35), 0 0 0 1px rgba(17,17,20,.04); padding-bottom: calc(var(--tabbar-h) + 48px); }
  .bottom-nav { bottom: 24px; border-radius: 0 0 36px 36px; }
  body.is-staff { --app-max: 880px; }
  body.is-staff .progress-top { grid-template-columns: 1fr 1fr; }
  body.is-staff .scope-fields { grid-template-columns: 1fr 1fr; column-gap: 14px; }
  body.is-staff .scope-wide { grid-column: 1 / -1; }
  .modal-bg { align-items: center; padding: 24px; }
  .modal { border-radius: 30px; max-height: calc(100vh - 48px); }
  .modal::before { display: none; }
  .modal-actions { position: static; margin: 18px 0 0; padding: 0; border: 0; background: none; }
  .auth-shell { margin: 24px 0; min-height: calc(100vh - 48px); border-radius: 36px; overflow: hidden; box-shadow: 0 30px 80px -40px rgba(17,17,20,.35); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .bottom-nav, .topbar-right, .composer, .modal-bg, .portal-notice { display: none !important; }
  body, .container.app { background: #fff; box-shadow: none; }
}

/* Build screen order: header, then the segmented control, then the active view.
   #project-content is a column; the overview wrapper uses display:contents so its
   children can be reordered without moving test-anchored markup. */
#project-content { display: flex; flex-direction: column; }
#project-content > *, .overview-panel > * { order: 3; }
#project-content > .view-as-banner { order: 0; }
#home-screen, #project-content .header, #project-content .screen-head, #project-content .chat-head { order: 1; }
body[data-screen="messages"] #project-content .chat-head { display: flex; }
#tabs { order: 2; }
body[data-screen="build"] #project-content #tabs { display: flex; }

/* Tap areas: every control reaches 44px without changing how it looks (WCAG 2.5.5). */
.b-pill, .b-sm, .tab, .icon-btn, .role-pill, .filter-btn, .menu-sync .btn, .item-actions-btn,
.task-control-btn, .add-task-btn, .co-admin-btn, .scope-checklist summary { position: relative; }
.b-pill::after, .b-sm::after, .tab::after, .icon-btn::after, .role-pill::after, .filter-btn::after, .menu-sync .btn::after,
.item-actions-btn::after, .task-control-btn::after, .add-task-btn::after, .co-admin-btn::after, .scope-checklist summary::after,
.sheet-close::after { content: ""; position: absolute; inset: -6px; }
.tab::after { inset: -3px 0; }
/* Staff see four Build segments; keep them inside a 358px track. */
body.is-staff .tab { font-size: 13.5px; padding: 0 6px; gap: 4px; }

/* ---------- Home (stage-aware) ---------- */
.hero-home { margin-top: 18px; }
.hero-actions .b:not(.b-glass) { background: var(--brand); color: #fff; }
.home-next-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.home-next-head .row-title { margin-top: 3px; }
.next-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.next-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.35; }
.next-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; border: 2px solid var(--brand); }
.next-text { flex: 1; min-width: 0; }
.next-when { font-size: 12.5px; color: var(--muted); flex: none; }
.home-next-done { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-text); font-size: 13px; font-weight: 500; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-tile { min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 14px 4px 11px; border: 0; border-radius: var(--r-small); background: var(--card); box-shadow: var(--shadow); color: var(--ink-2); font-size: 12px; font-weight: 500; text-decoration: none; cursor: pointer; }
.quick-tile .icon-tile { width: 36px; height: 36px; border-radius: 11px; }
.quick-tile .icon-tile svg { width: 19px; height: 19px; }
.live-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.live-tile { background: var(--fill); border-radius: 14px; padding: 10px 6px; text-align: center; min-height: 64px; display: flex; flex-direction: column; justify-content: center; }
.live-tile-name { font-size: 13px; font-weight: 500; }
.live-tile-state { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Payments and Documents ---------- */
.pay-hero { border-radius: var(--r-hero); padding: 22px; color: #fff; background: radial-gradient(120% 120% at 100% 0, #4B3FC4 0, var(--brand-dark) 62%); box-shadow: var(--shadow-hero); margin-top: 18px; }
.pay-hero-label { font-size: 13px; opacity: .75; }
.pay-hero-amount { font-size: 40px; font-weight: 700; letter-spacing: -0.045em; line-height: 1.05; margin-top: 6px; }
.pay-hero-sub { font-size: 13.5px; opacity: .8; margin-top: 8px; line-height: 1.4; }
.doc-icon { width: 40px; height: 48px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 9px; font-weight: 700; letter-spacing: .04em; color: var(--brand-text); }
body[data-screen="documents"] #project-content .residence-section { order: 4; }

.auth-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-alt .auth-btn { margin-top: 0; }

/* Quick replies are written for the client; staff never send them by accident. */
body.is-staff #quick-replies{display:none}
.pay-hero-none{font-size:26px}

/* Phase 2 review: an empty thread keeps the composer at the bottom of the screen, and the header stays put. */
body[data-screen="messages"] #project-content { min-height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 72px); }
body[data-screen="messages"] #project-content #project-conversation { display: flex; flex-direction: column; flex: 1 0 auto; }
#project-conversation .ps-body { flex: 1; display: flex; flex-direction: column; }
#project-thread { flex: 1; }
body[data-screen="messages"] #project-content .chat-head { position: sticky; top: 0; z-index: 6; background: var(--app); }
/* Staff read the thread from their side: the client on the left, the team on the right. */
body.is-staff .thread-msg[data-author="client"] { align-items: flex-start; }
body.is-staff .thread-msg[data-author="client"] .thread-body { background: var(--card); color: var(--ink); border-radius: 19px 19px 19px 6px; }
body.is-staff #project-thread .thread-msg:not([data-author="client"]) { align-items: flex-end; }
body.is-staff #project-thread .thread-msg:not([data-author="client"]) .thread-body { background: var(--brand); color: #fff; border-radius: 19px 19px 6px 19px; }
/* Empty detail lines take no space. */
.progress-sublabel:empty, .journey-sublabel:empty, .progress-summary:empty { display: none; }

/* ---------- Proposal (packages, extras, how you'll pay, sticky bar) ---------- */
body[data-screen="proposal"] .topbar, body[data-screen="proposal"] #bottom-nav { display: none !important; }
body[data-screen="proposal"] .container.app { padding-bottom: calc(96px + var(--safe-b)); }
.prop-head { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; margin: 0 -16px; padding: 14px 8px 8px; background: rgba(246,247,249,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.prop-back { justify-self: start; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 6px; border: 0; background: none; color: var(--brand-text); font-size: 16px; font-weight: 500; cursor: pointer; }
.prop-back svg { width: 22px; height: 22px; }
.prop-head-title { font-size: 16px; font-weight: 500; letter-spacing: -0.02em; }
.prop-head-icon { justify-self: end; width: 36px; height: 36px; display: grid; place-items: center; color: var(--brand-text); }
.prop-head-icon svg { width: 22px; height: 22px; }
.prop-hero { position: relative; overflow: hidden; isolation: isolate; height: 210px; margin: 0 -16px; color: #fff; }
.prop-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10,10,14,.10) 10%, rgba(10,10,14,.92) 92%); }
.prop-hero-inner { position: absolute; left: 18px; right: 18px; bottom: 16px; }
.prop-hero-title { font-size: 25px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 10px; }
.prop-hero-sub { font-size: 13px; opacity: .8; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-signed-note { margin-top: 14px; }
.prop-label { margin: 24px 4px 12px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prop-label-row { display: flex; align-items: center; justify-content: space-between; text-transform: none; letter-spacing: 0; }
.prop-label-row > span { text-transform: uppercase; letter-spacing: .08em; }
.prop-packages { display: flex; flex-direction: column; gap: 10px; }
.prop-pkg { position: relative; display: block; width: 100%; text-align: left; font: inherit; color: inherit; padding: 18px; border-radius: var(--r-card); background: var(--card); border: 2px solid transparent; box-shadow: var(--shadow); cursor: pointer; transition: border-color .2s var(--ease); }
.prop-pkg.is-rec { margin-top: 18px; }
.prop-pkg.is-selected { border-color: var(--brand); }
.prop-pkg:disabled { cursor: default; }
.prop-pkg:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.prop-rec { position: absolute; top: -11px; left: 18px; padding: 4px 9px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 500; }
.prop-pkg-top { display: flex; justify-content: space-between; gap: 12px; }
.prop-pkg-text { display: flex; flex-direction: column; min-width: 0; }
.prop-pkg-name { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; }
.prop-pkg-desc { font-size: 13.5px; line-height: 1.45; color: var(--muted); margin-top: 3px; }
.prop-pkg-price { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.prop-price { font-size: 22px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.prop-price-sub { font-size: 11.5px; color: var(--muted); }
.prop-checks { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.prop-check { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.3; color: var(--ink-2); min-width: 0; }
.prop-check > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-check svg { width: 15px; height: 15px; flex: none; color: var(--brand); margin-top: 1px; }
.prop-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.prop-list { padding: 0; overflow: hidden; }
.prop-group { padding: 14px 16px 2px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prop-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; position: relative; }
.prop-row + .prop-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line-soft); }
.prop-row-main { flex: 1; min-width: 0; }
.prop-row-title { font-size: 14.5px; font-weight: 500; line-height: 1.4; }
.prop-row-detail { font-size: 12.5px; line-height: 1.4; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-tag-text { color: var(--brand-text); font-weight: 500; }
.prop-why { color: var(--warn); }
.prop-row.is-blocked .prop-row-detail { color: var(--warn); }
.prop-row-price { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prop-tag { margin-left: 4px; vertical-align: 1px; }
.prop-note { margin-top: 12px; }
.prop-sched { padding: 6px 16px; border-radius: var(--r-small); }
.prop-sched-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; font-size: 14.5px; }
.prop-sched-name { font-weight: 500; }
.prop-sched-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.prop-sched-amt { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prop-sched-total { border-top: 1px solid var(--line-soft); font-size: 16px; font-weight: 700; }
.prop-sched-total .prop-sched-amt { font-weight: 700; }
.prop-small { font-size: 13px; line-height: 1.45; color: var(--muted); margin: 12px 4px 0; }
.prop-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 50; width: 100%; max-width: var(--app-max); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(14px + var(--safe-b)); background: rgba(246,247,249,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.prop-bar-left { min-width: 0; }
.prop-bar-label { font-size: 12px; line-height: 1.4; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-bar-total { font-size: 22px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.prop-bar .b { flex: none; }
.prop-done { font-size: 13px; padding: 8px 12px; }
.prop-done svg { width: 14px; height: 14px; }
.prop-toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); z-index: 300; max-width: min(420px, calc(100% - 32px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 14px; background: var(--brand-dark); color: #fff; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow-hero); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.prop-toast.show { opacity: 1; transform: translate(-50%, 0); }
.prop-toast.is-bad { background: var(--bad); }
/* Sign and pay sheets */
.prop-sheet { padding: 12px 16px calc(40px + var(--safe-b)); }
.prop-sheet h2 { margin: 0; padding-right: 0; }
.prop-sum { padding: 6px 16px; border-radius: var(--r-small); }
.prop-sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.prop-sum-row + .prop-sum-row { border-top: 1px solid var(--line-soft); }
.prop-sum-row > span:last-child { font-weight: 700; color: var(--ink); text-align: right; }
.prop-sum-row.is-strong { font-size: 16px; color: var(--ink); font-weight: 700; }
.prop-pad { position: relative; height: 150px; border-radius: var(--r-small); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.prop-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.prop-pad-hint { position: absolute; top: 44%; left: 0; right: 0; text-align: center; font-size: 14px; color: var(--muted); pointer-events: none; }
.prop-pad.has-ink .prop-pad-hint { display: none; }
.prop-pad-line { position: absolute; left: 20px; right: 20px; bottom: 12px; padding-top: 6px; border-top: 1px dashed #C9CCD3; font-size: 12px; color: var(--muted); pointer-events: none; }
.modal .prop-field { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.prop-field .modal-input { margin-top: 6px; }
.modal .prop-agree { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; font-size: 14.5px; font-weight: 400; line-height: 1.45; color: var(--ink); cursor: pointer; }
.prop-agree input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--brand); }
.modal .prop-lock { display: flex; gap: 8px; margin: 12px 0 16px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.prop-lock svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.modal .prop-err { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--bad-tint); color: var(--bad); font-size: 13.5px; }
.prop-test { margin: 4px 0 12px; }
.prop-due { text-align: center; padding: 20px 16px; }
.prop-due-amt { font-size: 34px; font-weight: 700; letter-spacing: -0.04em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.prop-due-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.prop-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.prop-method { min-height: 48px; border-radius: 14px; border: 2px solid transparent; background: var(--card); box-shadow: var(--shadow); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.prop-method[aria-checked="true"] { border-color: var(--brand); }
.prop-sheet .b-block + .b-block, .prop-sheet .prop-lock + .b-block { margin-top: 10px; }
.row-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.prop-row .switch::before { content: ""; position: absolute; inset: -7px -4px; }
.prop-row .switch { position: relative; }
.prop-bar-tax { font-size: 11.5px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 6px; }

/* Phase 3 design review */
.prop-sheet { padding-top: 0; padding-bottom: 0; max-height: calc(100% - 8px); }
.prop-sheet-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -16px 4px; padding: 22px 16px 10px; background: var(--app); }
.prop-sheet-head .sheet-close { position: relative; top: auto; right: auto; }
.prop-foot { position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 10px; margin: 16px -16px 0; padding: 12px 16px calc(14px + var(--safe-b)); background: var(--app); border-top: 1px solid var(--line); }
.prop-foot .b-block + .b-block { margin-top: 0; }
.prop-label-row .link-btn { min-height: 44px; }
.prop-terms { margin: 14px 4px 0; font-size: 13px; color: var(--muted); }
.prop-terms summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--brand-text); font-weight: 500; cursor: pointer; }
.prop-terms ul { margin: 4px 0 0 18px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; color: var(--ink-2); }
.prop-terms p { line-height: 1.45; }
.modal .prop-terms { margin: 12px 0 0; }
.prop-more { width: 100%; min-height: 48px; border: 0; border-top: 1px solid var(--line-soft); background: none; color: var(--brand-text); font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; }
.prop-bar-delta { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-text); font-size: 12px; font-weight: 700; letter-spacing: 0; vertical-align: 3px; }
@media (min-width: 768px) {
  body[data-screen="proposal"] .prop-bar { bottom: 24px; border-radius: 0 0 36px 36px; }
  body[data-screen="proposal"] .container.app { padding-bottom: calc(79px + 48px); overflow: hidden; }
  .prop-head { border-radius: 36px 36px 0 0; }
  .prop-foot { margin-bottom: -18px; }
}
.prop-sheet::before { z-index: 4; }

/* Invoices (GoHighLevel). Title gets the full width; amount and status stack on the right. */
.invoice-row { align-items: flex-start; }
.invoice-row .icon-tile { margin-top: 2px; }
.invoice-row .row-main { min-width: 0; flex: 1 1 auto; }
.invoice-title, .invoice-row .row-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Line names carry the meaning: wrap to two lines before cutting. */
.invoice-row .invoice-lines { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.invoice-row.is-muted .row-title, .invoice-row.is-muted .row-amount { color: var(--muted); font-weight: 500; }
.row-amount.is-struck { text-decoration: line-through; }
.invoice-row.is-flash { animation: invoice-flash 1.6s ease-out; }
@keyframes invoice-flash { 0%, 30% { background: var(--brand-soft, rgba(57,43,179,.10)); } 100% { background: transparent; } }
.next-pay { margin-top: 14px; padding: 18px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
.next-pay-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.next-pay-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.next-pay-amount { margin-top: 6px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.next-pay-sub { margin-top: 2px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.next-pay-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }
.next-pay.is-flash { animation: invoice-flash 1.6s ease-out; }
.invoice-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.invoice-end .pill, .invoice-end .b-pill { white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- Your system: equipment room by room ---------- */
.screen-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -6px 0 2px -8px; padding: 0 8px; border: 0; background: none;
  color: var(--brand-text); font-size: 15px; font-weight: 500; cursor: pointer; }
.screen-back .row-chev { transform: rotate(180deg); color: currentColor; width: 18px; height: 18px; }
.screen-sub { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.sys-grid { display: grid; gap: 10px; }
@media (min-width: 900px) { body.is-staff .sys-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.sys-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.sys-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sys-area { padding-bottom: 6px; }
.sys-line { position: relative; display: flex; align-items: center; gap: 13px; padding: 12px 0; }
.sys-line + .sys-line::before { content: ""; position: absolute; top: 0; left: 53px; right: 0; border-top: 1px solid var(--line-soft); }
.sys-qty { flex: none; padding: 4px 9px; border-radius: 999px; background: var(--fill); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sys-name { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.sys-note { margin: 10px 0 4px; }
.sys-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 8px; }
.sys-tools .b { min-height: 44px; }
.sys-stage { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sys-stage select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-field); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.sys-ask { margin-top: 16px; }
body[data-screen="documents"] #project-content .residence-section { margin-top: 12px; }

/* ---------- Punch close-out: photo of the fix, client confirms ---------- */
.punch-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px 14px 16px; }
.punch-review-text { font-size: 14px; font-weight: 500; color: var(--ink); }
.punch-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.punch-review-actions .b { min-height: 44px; }
.punch-confirm-head { margin: 4px 4px 12px; }
.punch-confirm-head h2 { margin: 0; }
.punch-confirm-head p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.punch-confirm-head ~ .item + .punch-list-toolbar { margin-top: 24px; }
.punch-photo-preview { display: block; width: 100%; height: 220px; margin-top: 10px; border-radius: 12px; object-fit: cover; }
.punch-photo-preview[hidden] { display: none; }
.punch-photo-full { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: var(--fill); }
.modal-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }
.modal .modal-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.modal label.punch-photo-pick { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; margin: 0; border: 1.5px dashed var(--line); border-radius: var(--r-field); background: var(--fill); font-size: 15px; font-weight: 500; color: var(--brand-text); cursor: pointer; }
.modal label.punch-photo-pick svg { width: 22px; height: 22px; }
.modal--sheet { max-width: 520px; }
.modal--sheet .modal-textarea { resize: none; }
.visually-hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.visually-hidden-file:focus-visible + .punch-photo-pick { outline: 2px solid var(--brand); outline-offset: 2px; }


/* ---------- Face ID: passkey sign-in, offer sheet, settings, app lock ---------- */
.auth-btn-passkey svg { width: 20px; height: 20px; }
.auth-passkey-msg { margin: 8px 2px 0; font-size: 14px; color: var(--ink-2, var(--ink)); }
.auth-passkey-msg[hidden] { display: none; }
.faceid-sheet { text-align: center; }
.faceid-sheet .modal-actions { justify-content: center; }
.faceid-mark { display: inline-grid; place-items: center; width: 60px; height: 60px; margin: 4px auto 10px; border-radius: 18px; background: var(--brand-tint, var(--fill)); color: var(--brand); }
.faceid-mark svg { width: 32px; height: 32px; }
.faceid-list { margin: 10px 0 4px; }
.faceid-row { align-items: center; gap: 10px; }
.faceid-act { min-height: 44px; padding: 0 12px; flex: none; }
.faceid-act.is-danger { color: var(--bad); }
.faceid-rename { display: flex; flex: 1; gap: 8px; align-items: center; }
.faceid-rename input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; background: var(--card); color: var(--ink); }
.app-lock { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: var(--page); }
.app-lock[hidden] { display: none; }
.app-lock-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.app-lock-card h2 { margin: 4px 0 0; font-size: 24px; }
.app-lock-card p { margin: 0 0 10px; color: var(--muted); }
body.is-locked { overflow: hidden; }

/* ---------- Atlas: a chat with the house, built from the Messages pieces ---------- */
body[data-screen="atlas"] #project-content { min-height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 72px); }
body[data-screen="atlas"] #project-content #atlas-screen { display: flex; flex-direction: column; flex: 1 0 auto; }
body[data-screen="atlas"] #atlas-screen .chat-head { display: flex; order: -1; position: sticky; top: 0; z-index: 6; background: var(--app); }
.atlas-back { flex: none; margin-left: -8px; color: var(--brand); }
.atlas-avatar { display: grid; place-items: center; color: #fff; }
.atlas-entry { margin-top: 0; }
.atlas-log { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.atlas-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 78%; }
.atlas-msg.is-you { align-self: flex-end; align-items: flex-end; }
.atlas-bubble { padding: 10px 13px; border-radius: 19px 19px 19px 6px; background: var(--card); box-shadow: 0 1px 1px rgba(0,0,0,.03); font-size: 15px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.atlas-msg.is-you .atlas-bubble { border-radius: 19px 19px 6px 19px; background: var(--brand); color: #fff; box-shadow: none; }
.atlas-msg.is-error .atlas-bubble { background: var(--fill); color: var(--muted); box-shadow: none; }
.atlas-note { max-width: 100%; }
.atlas-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.atlas-source { padding: 4px 9px; border-radius: 999px; background: var(--fill); font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.atlas-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.atlas-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: atlas-dot 1.2s infinite ease-in-out; }
.atlas-typing span:nth-child(2) { animation-delay: .15s; } .atlas-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes atlas-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .atlas-typing span { animation: none; } }
.atlas-dock[hidden] { display: none; }
.atlas-dock .quick-replies:empty { display: none; }
#atlas-input { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); font-size: 16px; line-height: 1.3; resize: none; outline: none; field-sizing: content; }
#atlas-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.atlas-send { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.atlas-send svg { margin-left: -2px; }
/* The client's answer on the photo sheet: "Looks good" first and full width, Close last. */
.modal-actions.is-stacked { flex-direction: column-reverse; align-items: stretch; }
.modal-actions.is-stacked .btn { width: 100%; }
.items-count { margin-left: 4px; font-size: 15px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
