/* Haven Estates & Co.: one design system for Home Base, the field app,
   the client portal, reports and proposals. The palette comes from the
   brand film (public/media/login.mp4): olive-charcoal architecture, moss
   and sage greenery, warm stone and greige interiors, cream lettering,
   and pool aqua kept for "live" moments. Inter throughout.
   Rules: nothing under 12px; text clears 4.5:1; tap targets 44px. */
@font-face { font-family: "Inter"; font-weight: 100 900; font-style: normal; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --bg-deep: #ebe7e0;
  --card: #ffffff;
  --pale: #f0ede8;
  --ink: #1e1f1a;
  --ink-soft: #3f3e37;
  --muted: #6a655d;            /* 5.7:1 on white, 5.1:1 on --bg */
  --line: #e4e0d9;
  --line-strong: #cdc6bb;
  --brand: #2a2c22;            /* olive-charcoal (the courtyard walls): white text 14:1 */
  --brand-2: #3b3d31;
  --brand-ink: #4e5a3c;        /* moss, for links and accents as text: 7.4:1 on white */
  --brand-wash: #eceee5;       /* sage wash */
  --on-brand: #ffffff;
  --cream: #ece3c6;            /* the wordmark's cream, on dark grounds */
  --stone: #9c9793;
  --sage: #81887b;
  --aqua: #22707a;             /* the pool, for live/on-site states: 5.5:1 on white */
  --aqua-fill: #3fa3b0;
  --aqua-wash: #e2f1f2;
  --brass: #b49863;            /* fill only */
  --brass-ink: #7a6234;        /* brass as text: 5.6:1 on white */
  --brass-wash: #f5efe2;
  --focus: #1d4ed8;
  --danger: #a3261d;
  --danger-wash: #fbeceb;
  --warn: #8a5a00;
  --warn-wash: #fdf3dc;
  --ok: #0f6b45;
  --ok-wash: #e4f3ea;
  --info: #24527a;
  --info-wash: #e7eff7;
  --scrim: rgba(30, 31, 26, .48);
  --shadow: 0 1px 2px rgba(30, 31, 26, .05), 0 1px 3px rgba(30, 31, 26, .06);
  --shadow-lg: 0 12px 32px rgba(30, 31, 26, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 12px;
  --dur: .16s ease;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: var(--r-sm); z-index: 99; }
.skip:focus { left: 8px; }

/* Type */
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; margin: 0; color: var(--ink); }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.022em; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; letter-spacing: -.01em; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { text-align: right; }
p { margin: 0 0 10px; }

/* Icons: the department PNG/SVGs are used as masks so they take any color. */
.ic { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; vertical-align: middle; }
.ic.lg { width: 28px; height: 28px; }
.ic.xl { width: 40px; height: 40px; }
.ic.sm { width: 16px; height: 16px; }
.dept { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 12%, white); flex: none; }
.dept.sm { width: 28px; height: 28px; border-radius: 8px; }
.dept.sm .ic { width: 16px; height: 16px; }
.dept-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--c, var(--brand)) 80%, black); }
.glyph { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 0;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; transition: background var(--dur), box-shadow var(--dur), filter var(--dur); white-space: nowrap; background: transparent; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-2); }
.btn-brass { background: var(--brass); color: #1b1408; }
.btn-brass:hover { filter: brightness(1.06); }
.btn-line { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-line:hover { background: var(--pale); }
.btn-quiet { color: var(--ink-soft); }
.btn-quiet:hover { background: var(--pale); }
.btn-danger { color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; background: var(--card); }
.btn-danger:hover { background: var(--danger-wash); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { min-width: 44px; padding: 0 10px; }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 24px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > label, .field > .label { font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.field .help { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--danger); font-weight: 700; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--card); width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--danger); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; gap: 0; } }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.seg { display: inline-flex; background: var(--pale); border-radius: var(--r); padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.search { position: relative; }
.search input { padding-left: 38px; }
.search::before { content: ""; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }

/* Surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tight { padding: 14px 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.flex.top { align-items: flex-start; }
.flex.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* Stat tiles */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.stat .k { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat .v { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.alert .v { color: var(--danger); }
.stat.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat.brand .k, .stat.brand .s { color: #d8d5cb; }
.stat.brand .v { color: #fff; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > li:first-child, .list > .li:first-child { border-top: 0; }
.list.pad > li { padding: 12px 16px; }
.li-btn { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; border-radius: var(--r-sm); }
.li-btn:hover { background: var(--pale); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink-soft); margin-bottom: 4px; }

/* Pills and badges */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: var(--pale); color: var(--ink-soft); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.s-new, .s-offered { background: var(--info-wash); color: var(--info); }
.s-accepted, .s-scheduled { background: var(--brass-wash); color: var(--brass-ink); }
.s-on_site, .s-in_progress { background: #e6effc; color: #1d4ea0; }
.s-completed { background: #efe9fb; color: #5b3a9e; }
.s-verified, .s-submitted, .s-approved, .s-signed, .s-paid, .s-sent-ok, .s-done, .s-ok, .s-resolved { background: var(--ok-wash); color: var(--ok); }
.s-reopened, .s-declined, .s-overdue, .s-failed, .s-critical { background: var(--danger-wash); color: var(--danger); }
.s-cancelled, .s-draft, .s-held, .s-acknowledged, .s-monitor { background: var(--pale); color: var(--muted); }
.s-pending, .s-quote, .s-viewed, .s-warn, .s-queued, .s-open { background: var(--warn-wash); color: var(--warn); }
.s-dispatch, .s-sent, .s-info { background: var(--info-wash); color: var(--info); }
.sev { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.sev-low { color: var(--muted); } .sev-moderate { color: var(--warn); } .sev-high { color: #b04a00; } .sev-critical { color: var(--danger); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 900; }
.badge.quiet { background: var(--brand); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.live { background: #1fa45a; box-shadow: 0 0 0 0 rgba(31, 164, 90, .6); animation: pulse 1.8s infinite; }
.dot.warn { background: #d08a00; }
.dot.bad { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 164, 90, .55); } 70% { box-shadow: 0 0 0 10px rgba(31, 164, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 164, 90, 0); } }
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } * { transition: none !important; } }

/* Health score ring */
.score { --v: 0; --col: var(--ok); position: relative; width: 64px; height: 64px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--col) calc(var(--v) * 1%), var(--pale) 0); display: grid; place-items: center; }
.score::after { content: ""; position: absolute; inset: 6px; background: var(--card); border-radius: 50%; }
.score b { position: relative; z-index: 1; font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.score.sm { width: 44px; height: 44px; } .score.sm::after { inset: 4px; } .score.sm b { font-size: 15px; }
.score.lg { width: 96px; height: 96px; } .score.lg::after { inset: 8px; } .score.lg b { font-size: 32px; }
.bar { height: 8px; background: var(--pale); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.bar.warn > span { background: #c98400; } .bar.bad > span { background: var(--danger); }

/* Avatars */
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-wash); color: var(--brand); display: inline-grid; place-items: center; font-weight: 900; font-size: 13px; flex: none; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 28px; height: 28px; font-size: 12px; }
.av.lg { width: 48px; height: 48px; font-size: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--pale); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs button, .tabs a { min-height: 44px; padding: 0 14px; border: 0; background: none; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabs [aria-selected=true] { color: var(--ink); border-bottom-color: var(--brand); }

/* Timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 14px 22px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -6px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand); }
.tl .when { font-size: 12px; color: var(--muted); }

/* Callouts */
.note { padding: 12px 14px; border-radius: var(--r); background: var(--pale); font-size: 14px; }
.note.warn { background: var(--warn-wash); color: #5c3c00; }
.note.bad { background: var(--danger-wash); color: #6e1a14; }
.note.ok { background: var(--ok-wash); color: #0a4a30; }
.note.info { background: var(--info-wash); color: #183a57; }
.note.brand { background: var(--brand-wash); color: #143627; }

/* App shell: desktop sidebar (Home Base) */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--brand); color: #ecebe5; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.side .brandmark { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; text-decoration: none; }
.side .brandmark .ic { width: 30px; height: 30px; color: #ece3c6; }
.side .brandmark b { font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: -.01em; }
.side .brandmark small { display: block; font-size: 12px; color: #bdb9ad; letter-spacing: .08em; text-transform: uppercase; }
.side .grp { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #aaa699; padding: 14px 12px 6px; }
.side a.nav { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); color: #ecebe5; text-decoration: none; font-weight: 600; font-size: 14px; }
.side a.nav:hover { background: rgba(255, 255, 255, .08); }
.side a.nav[aria-current=page] { background: #fff; color: var(--brand); }
.side a.nav .badge { margin-left: auto; }
.side .foot { margin-top: auto; padding: 12px; font-size: 12px; color: #bdb9ad; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(246, 244, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 64px; }
.topbar h1 { font-size: 22px; }
.page { padding: 24px 28px 64px; max-width: 1480px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .page { padding: 16px 16px 64px; }
}

/* App shell: phone (field app, portal) */
.mshell { min-height: 100vh; display: flex; flex-direction: column; }
.mtop { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; min-height: 56px; }
.mtop .ic { color: #ece3c6; }
.mtop b { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.mtop .btn-quiet { color: #fff; }
.mtop .btn-quiet:hover { background: rgba(255, 255, 255, .12); }
.mbody { flex: 1; padding: 16px 16px 96px; max-width: 760px; width: 100%; margin: 0 auto; }
.mnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
.mnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; position: relative; }
.mnav a[aria-current=page] { color: var(--brand); }
.mnav a .badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; }
@media (min-width: 900px) { .mbody { padding-bottom: 110px; } }

/* Sheet: a dialog on desktop, a bottom sheet on phones */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; }
.sheet { position: fixed; z-index: 90; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.sheet.wide { width: min(860px, calc(100vw - 32px)); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 20px; flex: 1; }
.sheet-b { padding: 18px 20px; overflow-y: auto; }
.sheet-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 640px) {
  .sheet, .sheet.wide { left: 0; right: 0; bottom: 0; top: auto; transform: none; width: 100%; max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet-f .btn { flex: 1; }
}

/* Popover (notifications) */
.pop { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 70; color: var(--ink); }
.pop .list > li { padding: 12px 16px; align-items: flex-start; }
.pop .unread { background: var(--brand-wash); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r); font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* Messaging */
.msgs { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); overflow: hidden; min-height: 560px; }
.msgs .threads { border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; }
.msgs .thread { display: flex; flex-direction: column; min-height: 0; max-height: 72vh; }
.msgs .bubbles { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--brand); color: #fff; border-color: var(--brand); }
.bubble.sys { align-self: center; background: transparent; border: 0; color: var(--muted); font-size: 13px; text-align: center; max-width: 90%; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.bubble.mine .who { color: #d8d5cb; }
.compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); }
.compose textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 10px 12px; border-radius: var(--r); border: 1.5px solid var(--line-strong); resize: none; }
.thread-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.thread-row:hover { background: var(--pale); }
.thread-row[aria-current=true] { background: var(--brand-wash); }
.lock { font-size: 12px; font-weight: 700; color: var(--brass-ink); background: var(--brass-wash); border-radius: 6px; padding: 1px 6px; }
@media (max-width: 760px) {
  .msgs { grid-template-columns: minmax(0, 1fr); min-height: 0; border-radius: var(--r); }
  .msgs .threads { border-right: 0; max-height: none; }
  .msgs.in-thread .threads { display: none; }
  .msgs:not(.in-thread) .thread { display: none; }
  .msgs .thread { max-height: calc(100vh - 200px); }
}

/* Map */
.map { width: 100%; height: 420px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: #e8ece6; position: relative; }
.map.tall { height: 620px; }
.map.short { height: 220px; }
.map svg { width: 100%; height: 100%; display: block; }
.map .map-note { position: absolute; left: 10px; bottom: 10px; background: rgba(255, 255, 255, .92); padding: 6px 10px; border-radius: 8px; font-size: 12px; color: var(--muted); }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--pale); }
.photos figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg); background: var(--pale); }
.thumb { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--pale); flex: none; }

/* Brief */
.brief-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brief-stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.brief-stats .bs { background: var(--pale); border-radius: var(--r); padding: 8px 12px; min-width: 96px; }
.brief-stats .bs b { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.brief-stats .bs span { font-size: 12px; font-weight: 700; color: var(--muted); }

/* Signature pad */
.sigpad { width: 100%; height: 160px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: #fffdf8; touch-action: none; cursor: crosshair; }

/* Print */
@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print, .side, .topbar, .mnav, .mtop { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .page, .mbody { padding: 0; max-width: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---------------------------------------------------------------- from the brand film
   Wordmark: HAVEN in tracked capitals over ESTATES & CO. in cream, like the
   film's title card, set in Inter. Used by every app header. */
.side .brandmark .ic, .fbrand .ic, .p-brand .ic, .sg-bar .ic { display: none; }
.side .brandmark b, .fbrand-t b, .p-brand b, .sg-bar b, .wordmark b {
  font-family: var(--font); font-weight: 500; font-size: 19px; letter-spacing: .34em; text-transform: uppercase; line-height: 1.1; color: #fff; }
.side .brandmark small, .fbrand-t small, .p-brand small, .sg-bar small, .wordmark small {
  display: block; margin-top: 5px; font-size: 12px; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--cream); }
.side .brandmark { padding: 10px 12px 22px; }
.wordmark { display: inline-flex; flex-direction: column; text-decoration: none; }

/* "On site" and anything live wear the pool's aqua. */
.s-on_site, .s-in_progress { background: var(--aqua-wash); color: var(--aqua); }
.dot.live { background: var(--aqua-fill); box-shadow: 0 0 0 0 rgba(63, 163, 176, .6); animation: pulse-aqua 1.8s infinite; }
@keyframes pulse-aqua { 0% { box-shadow: 0 0 0 0 rgba(63, 163, 176, .55); } 70% { box-shadow: 0 0 0 10px rgba(63, 163, 176, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 163, 176, 0); } }
a { color: var(--brand-ink); }

/* The daily brief sits on the film's courtyard, everywhere it appears. */
section[aria-label="Daily brief"] { color: #fff; border: 0;
  background: linear-gradient(100deg, rgba(28, 29, 22, .90) 0%, rgba(28, 29, 22, .74) 48%, rgba(28, 29, 22, .40) 100%), url(/img/haven-exterior.jpg) center 62% / cover; }
section[aria-label="Daily brief"] h2, section[aria-label="Daily brief"] h3 { color: #fff; }
section[aria-label="Daily brief"] .eyebrow { color: var(--cream); }
section[aria-label="Daily brief"] .muted, section[aria-label="Daily brief"] .small { color: #dedbd1; }
section[aria-label="Daily brief"] a { color: var(--cream); }
section[aria-label="Daily brief"] .list > li { border-top-color: rgba(255, 255, 255, .14); }
section[aria-label="Daily brief"] .brief-stats .bs { background: rgba(255, 255, 255, .08); border: 1px solid rgba(236, 227, 198, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
section[aria-label="Daily brief"] .brief-stats .bs b { color: #fff; }
section[aria-label="Daily brief"] .brief-stats .bs span { color: #dedbd1; }
section[aria-label="Daily brief"] .btn-line { background: rgba(255, 255, 255, .10); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .38); }
section[aria-label="Daily brief"] .dot.warn { background: #e0b04a; }
section[aria-label="Daily brief"] .dot.bad { background: #f07a6e; }
@media print { section[aria-label="Daily brief"] { background: #fff; color: var(--ink); } }

/* ---------------------------------------------------------------- fast entry
   Dictation: a mic inside any field marked data-dictate. */
.dict-wrap { position: relative; }
.compose .dict-wrap { flex: 1; display: flex; }
.compose .dict-wrap > textarea { flex: 1; }
.dict-wrap > input { padding-right: 52px !important; }
.dict-wrap.area > textarea { padding-right: 52px !important; }
.mic { position: absolute; right: 2px; top: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--r-sm); }
.dict-wrap.area .mic { top: auto; bottom: 2px; }
.mic:hover { color: var(--ink); background: var(--pale); }
.mic.on { color: #fff; background: var(--aqua); animation: mic-pulse 1.4s infinite; }
@keyframes mic-pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 163, 176, .5); } 70% { box-shadow: 0 0 0 10px rgba(63, 163, 176, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 163, 176, 0); } }
@media (prefers-reduced-motion: reduce) { .mic.on { animation: none; } }

/* Command palette (Home Base): ⌘K, "/", g + letter, ?. */
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--card); font: 600 12px/1.5 var(--font); color: var(--ink-soft); text-align: center; }
.pal-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 95; }
.pal { position: fixed; z-index: 96; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-in input { flex: 1; min-height: 44px; border: 0; outline: none; font-size: 16px; background: none; color: var(--ink); }
.pal-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.pal-g { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pal-i { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.pal-i[aria-selected=true] { background: var(--brand-wash); box-shadow: inset 3px 0 0 var(--brand-ink); }
.pal-empty { padding: 18px; color: var(--muted); }
.pal-foot { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--bg); }
.pal-foot kbd { margin-right: 3px; }
@media (max-width: 640px) { .pal { top: 8px; } .pal-foot { display: none; } }

/* Spoken / quick findings (field app). */
.assist { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 12px; margin: 0 0 14px; background: var(--bg); }
.assist .btn-speak { width: 100%; min-height: 52px; font-size: 16px; }
.assist .btn-speak.on { background: var(--aqua); color: #fff; }
.assist .heard { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); min-height: 20px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; }
.chip { flex: none; min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--card); font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; max-width: 260px; }
.chip small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.chip:hover { border-color: var(--brand-ink); }
