/* Auto AVID — PHREG. Mobile-first compliance tool. */

/* Raleway is the brokerage web font. Self-hosted as a single variable file so
   the app renders correctly with no network — agents inspect vacant houses in
   the high desert where there is frequently no signal. */
@font-face {
  font-family: 'Raleway';
  src: url('../fonts/raleway-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --font-sans: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --accent: #009688;
  --accent-hover: #00796b;
  --accent-soft: rgba(0, 150, 136, 0.12);
  --accent-ink: #ffffff;
  --brand-teal-lt: #13b9b9;

  --ok: #2e7d32;
  --ok-soft: rgba(46, 125, 50, 0.13);
  --warn: #9a6b12;
  --warn-soft: rgba(154, 107, 18, 0.13);
  --err: #a32e2e;
  --err-soft: rgba(163, 46, 46, 0.11);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --tap: 44px;

  --shadow-1: 0 1px 2px rgba(11, 21, 36, 0.06), 0 1px 3px rgba(11, 21, 36, 0.04);
  --shadow-2: 0 10px 30px rgba(11, 21, 36, 0.14);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;
}

[data-theme='light'] {
  --bg: #f9f9f8;
  --bg-alt: #eef1f0;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --border: #dde3e2;
  --border-strong: #c4cecd;
  --ink: #262b2b;
  --ink-2: #4f5a59;
  --ink-3: #788483;
  --nav: #0d3d3a;
  --nav-ink: #e6f4f2;
  --nav-ink-dim: #93b8b4;
}

[data-theme='dark'] {
  --bg: #06110f;
  --bg-alt: #0a1917;
  --surface: #0f201e;
  --surface-2: #142927;
  --border: #1f3937;
  --border-strong: #2b4a47;
  --ink: #e6f1ef;
  --ink-2: #a7bebb;
  --ink-3: #7d9793;
  --nav: #0a1917;
  --nav-ink: #e6f1ef;
  --nav-ink-dim: #86a5a1;
  --ok: #6cc46f;
  --ok-soft: rgba(108, 196, 111, 0.15);
  --warn: #e0a944;
  --warn-soft: rgba(224, 169, 68, 0.14);
  --err: #ef7676;
  --err-soft: rgba(239, 118, 118, 0.14);
  --accent: #26c6b4;
  --accent-hover: #4fd8c7;
  --accent-soft: rgba(38, 198, 180, 0.16);
  --accent-ink: #06231f;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 14px 34px rgba(0, 0, 0, 0.45);
}

/* ------------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; display: block; }
.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;
}

/* ----------------------------------------------------------------- shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav); color: var(--nav-ink);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { flex: none; color: var(--nav-ink); }
.brand-text { min-width: 0; }
.brand-name {
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap;
}
.brand-sub {
  font-size: 10.5px; color: var(--nav-ink-dim); letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--nav-ink); border-radius: var(--radius-sm); padding: 0 10px;
  font-size: 12.5px; font-weight: 600;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.icon-btn .lbl { display: none; }
@media (min-width: 640px) { .icon-btn .lbl { display: inline; } }

/* context strip */
.ctxbar {
  position: sticky; top: 64px; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ctx-addr { font-weight: 700; font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.ctx-meta { font-size: 11.5px; color: var(--ink-3); }
.unit-switch { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; transition: box-shadow 0.25s ease; border-radius: 12px; }
.unit-switch-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); animation: unit-pulse 0.7s ease 2; }
@keyframes unit-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.02); } }
.unit-btn {
  min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
}
.unit-btn[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* nav */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--nav); border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  background: none; border: 0; color: var(--nav-ink-dim);
  min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em; padding: 6px 2px;
  border-top: 2px solid transparent;
}
.tab svg { width: 20px; height: 20px; }
.tab[aria-current='page'] { color: var(--nav-ink); border-top-color: var(--accent); }
.tab .badge {
  position: absolute; transform: translate(16px, -14px);
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  font-size: 9px; min-width: 15px; height: 15px; line-height: 15px; padding: 0 3px; text-align: center;
}

main {
  flex: 1; max-width: 1120px; width: 100%; margin: 0 auto;
  padding: 14px 14px calc(112px + env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
  .tabs {
    position: sticky; top: 64px; bottom: auto; border-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    grid-template-columns: repeat(5, max-content); padding: 0 14px; gap: 4px;
    background: var(--nav);
  }
  .tab { flex-direction: row; gap: 8px; font-size: 12.5px; min-height: 46px; padding: 0 14px; border-top: 0; border-bottom: 2px solid transparent; }
  .tab[aria-current='page'] { border-bottom-color: var(--accent); }
  .ctxbar { top: 110px; }
  main { padding: 22px 22px 60px; }
}

/* --------------------------------------------------------------- primitives */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: var(--space-4); margin-bottom: var(--space-3);
}
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: var(--space-3); }
.card-head h2, .card-head h3 { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.card-head .spacer { margin-left: auto; }
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 700; margin: var(--space-5) 0 var(--space-2);
}
.muted { color: var(--ink-3); font-size: 13px; }
.hint { color: var(--ink-3); font-size: 12px; margin-top: 4px; }

.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font-weight: 650; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn svg { flex: none; width: 16px; height: 16px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn-sm { min-height: 34px; font-size: 12.5px; padding: 0 10px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

label.field { display: block; margin-bottom: var(--space-3); min-width: 0; }
label.field > span.lab {
  display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px;
}
input[type='text'], input[type='date'], input[type='time'], input[type='search'], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--ink); font-size: 15px;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2);
  max-width: 100%; overflow-wrap: anywhere;
}
.pill-ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pill-err { color: var(--err); background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.pill-accent { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: var(--space-6) var(--space-4); text-align: center; color: var(--ink-3);
  background: var(--surface);
}
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 44ch; margin: 0 auto var(--space-4); }
.empty svg { color: var(--ink-3); margin: 0 auto var(--space-3); }

.banner {
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface-2); margin-bottom: var(--space-3);
  display: flex; gap: 8px; align-items: flex-start;
}
.banner-err { color: var(--err); background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.banner-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* ------------------------------------------------------------ room cards */
.room {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-3);
}
.room[data-state='blank'] { border-left-color: var(--err); }
.room[data-state='flagged'] { border-left-color: var(--warn); }
.room[data-state='ok'] { border-left-color: var(--ok); }
.room-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.room-name { font-size: 15px; font-weight: 750; min-width: 0; overflow-wrap: anywhere; }
.room-code {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.room-head .spacer { margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  min-height: 36px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
details.chipbox { margin-top: 10px; }
details.chipbox > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--accent);
  min-height: 34px; display: flex; align-items: center; gap: 6px; list-style: none;
}
details.chipbox > summary::-webkit-details-marker { display: none; }
details.chipbox > summary::before { content: '＋'; font-size: 13px; }
details.chipbox[open] > summary::before { content: '－'; }

.lint { margin-top: 10px; display: grid; gap: 8px; }
.lint-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; background: var(--surface-2); display: grid; gap: 6px;
}
.lint-item.tone-error { border-color: color-mix(in srgb, var(--err) 40%, transparent); background: var(--err-soft); }
.lint-item.tone-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.lint-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lint-match { font-family: var(--font-mono); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.lint-reason { font-size: 12.5px; color: var(--ink-2); }
.lint-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.avid-out {
  margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 9px 10px;
}
.avid-out .lab {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 700;
}
.avid-out pre {
  margin: 4px 0 0; font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}

/* -------------------------------------------------------------- photos */
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: flex-start; }
.thumb {
  position: relative; width: 84px; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); padding: 0;
  display: block; text-align: left;
}
.thumb img { width: 100%; height: 62px; object-fit: cover; }
.thumb .tid {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: var(--ink);
  padding: 3px 4px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb.needs-caption { border-color: var(--warn); }
.thumb .warn-dot {
  position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--warn); color: #fff; font-size: 10px; line-height: 14px; text-align: center; font-weight: 800;
}
.cap-btn {
  width: 84px; min-height: 84px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--ink-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; text-align: center; padding: 4px;
}
.cap-btn:hover { border-color: var(--accent); color: var(--accent); }
.photo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-items: stretch; }
.pcard {
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); display: flex; flex-direction: column; text-align: left; padding: 0;
}
.pcard img { width: 100%; height: 104px; object-fit: cover; background: var(--surface-2); }
.pcard .meta { padding: 7px 8px; display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pcard .meta > .btn, .pcard .meta > select { margin-top: auto; }
.pcard .eid { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accent); }
.pcard .rm { font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.pcard .cp { font-size: 11.5px; color: var(--ink); overflow-wrap: anywhere; }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 8px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------- readiness */
.score-wrap { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .val {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 800; letter-spacing: -0.03em;
}
.ring .val small { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-3); text-transform: uppercase; }
.check-list { display: grid; gap: 6px; margin-top: var(--space-3); }
.check {
  display: flex; gap: 9px; align-items: flex-start; text-align: left; width: 100%;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px 10px; min-height: var(--tap);
}
.check .mark { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; margin-top: 1px; }
.check.ok .mark { background: var(--ok-soft); color: var(--ok); }
.check.bad .mark { background: var(--err-soft); color: var(--err); }
.check .txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.check .t1 { font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.check .t2 { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }

/* ------------------------------------------------------------- tx list */
.tx-list { display: grid; gap: 10px; }
.tx {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: var(--space-4); box-shadow: var(--shadow-1);
}
.tx.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tx h3 { font-size: 15px; overflow-wrap: anywhere; }
.tx .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }
.tx .pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

/* -------------------------------------------------------------- drawer */
.drawer-back {
  position: fixed; inset: 0; background: rgba(6, 12, 22, 0.55); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.drawer-back.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
  background: var(--surface); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.drawer-head h2 { font-size: 15px; }
.drawer-body { overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.drawer-body h3 { font-size: 13.5px; margin-bottom: 6px; }
.ref details {
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface-2);
}
.ref summary {
  cursor: pointer; padding: 12px; font-weight: 700; font-size: 13.5px; min-height: var(--tap);
  display: flex; align-items: center; gap: 8px; list-style: none;
}
.ref summary::-webkit-details-marker { display: none; }
.ref summary::after { content: '▾'; margin-left: auto; color: var(--ink-3); }
.ref details[open] summary::after { content: '▴'; }
.ref .rbody { padding: 0 12px 12px; font-size: 13px; color: var(--ink-2); }
.ref .rbody ul { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.ref .rbody li { overflow-wrap: anywhere; }
.ref .rule { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.ref .rule:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ref .rule b { color: var(--ink); }
.src-list { display: grid; gap: 8px; }
.src-list a { font-size: 12.5px; }

/* --------------------------------------------------------------- modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(6, 12, 22, 0.6); z-index: 70;
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); width: 100%;
  max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-2);
}
@media (min-width: 720px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 720px; border-radius: var(--radius-lg); }
}
.modal-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.modal-body { padding: 14px; overflow-y: auto; }
.modal-foot {
  padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end; background: var(--surface);
}

.diff { display: grid; gap: 12px; }
@media (min-width: 720px) { .diff { grid-template-columns: 1fr 1fr; } }
.diff-pane { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 10px; min-width: 0; }
.diff-pane .lab { font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin-bottom: 6px; }
.diff-pane pre {
  margin: 0; font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.d-del { background: var(--err-soft); color: var(--err); text-decoration: line-through; }
.d-add { background: var(--ok-soft); color: var(--ok); }

.photo-modal-img {
  width: 100%; max-height: 42vh; object-fit: contain; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 12.5px; margin-top: 10px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* --------------------------------------------------------------- toast */
.toasts {
  position: fixed; left: 12px; right: 12px; bottom: 74px; z-index: 80;
  display: grid; gap: 8px; pointer-events: none;
}
@media (min-width: 900px) { .toasts { left: auto; right: 20px; bottom: 20px; width: 340px; } }
.toast {
  background: var(--nav); color: var(--nav-ink); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; box-shadow: var(--shadow-2);
  animation: rise 0.2s ease; overflow-wrap: anywhere;
}
.toast.err { border-left: 3px solid var(--err); }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.warn { border-left: 3px solid var(--warn); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.footer-note {
  margin-top: var(--space-5); border-top: 1px solid var(--border); padding-top: var(--space-4);
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
}
.footer-note strong { color: var(--ink-2); }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp 0.7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.skel { background: linear-gradient(90deg, var(--surface-2), var(--bg-alt), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* print container is only used by the print stylesheet */
#print-root { display: none; }

/* photo with no stored blob on this device */
img.img-missing {
  position: relative; background: var(--surface-2);
  border: 1px dashed var(--border-strong); box-sizing: border-box;
}
img.img-missing::after {
  content: attr(data-missing);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 8px; text-align: center; font-size: 10.5px; line-height: 1.4;
  color: var(--ink-3); background: var(--surface-2);
}

/* -------------------------------------- datetime inputs & calendar sheet */
.dt-field .dt-row {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  flex-wrap: wrap;
}
.dt-field .dt-row > input[type="text"] {
  flex: 1 1 160px; min-width: 0;
}
.dt-icon {
  padding: 0 12px; font-size: 18px; line-height: 1;
  min-width: 44px; min-height: 44px;
}
.dt-field .hint { display: block; margin-top: 6px; }

/* fullscreen sheet backdrop */
.dt-sheet {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(6, 12, 22, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: dtFade 0.15s ease-out;
}
@media (min-width: 640px) {
  .dt-sheet { align-items: center; }
}
@keyframes dtFade { from { opacity: 0; } to { opacity: 1; } }

body.dt-sheet-open { overflow: hidden; }

.dt-sheet-inner {
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  max-width: 380px;
  padding: 14px 14px 18px;
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.35);
  animation: dtSlide 0.18s ease-out;
}
@media (min-width: 640px) {
  .dt-sheet-inner { border-radius: 16px; }
}
@keyframes dtSlide { from { transform: translateY(12px); } to { transform: translateY(0); } }

.dt-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.dt-title { font-weight: 600; font-size: 15px; color: var(--ink); }

.dt-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  font-size: 11px; color: var(--ink-3); text-align: center;
  padding: 4px 0;
}
.dt-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.dt-cell {
  min-height: 42px; padding: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--ink); border-radius: 8px;
  font-size: 15px; cursor: pointer;
  touch-action: manipulation;
}
.dt-cell:hover { background: var(--bg-alt); }
.dt-cell.dt-empty { background: transparent; border-color: transparent; visibility: hidden; }
.dt-cell.dt-today { border-color: var(--accent); }
.dt-cell.dt-sel {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 600;
}

.dt-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}

/* time sheet */
.dt-time-sheet .dt-time-cols {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px;
}
.dt-time-label {
  font-size: 11px; color: var(--ink-3); text-align: center;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em;
}
.dt-time-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.dt-time-cols .dt-ampm { grid-template-columns: 1fr; }
.dt-time-cell {
  min-height: 42px; padding: 0 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--ink); border-radius: 8px;
  font-size: 15px; cursor: pointer;
  touch-action: manipulation;
}
.dt-time-cell:hover { background: var(--bg-alt); }
.dt-time-cell.dt-sel {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 600;
}

/* Native-label file pickers: <label> wraps a hidden file <input>.
 * The label needs to look and behave like the buttons it replaces. */
label[data-role="file-picker"] {
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
label[data-role="file-picker"].btn,
label[data-role="file-picker"].cap-btn {
  /* .btn/.cap-btn already give the visual box; just guarantee that the
     hidden file input inside doesn't disrupt the flex layout. */
}
label[data-role="file-picker"] > input[type="file"] {
  /* Keep the input focusable/tappable but visually hidden. Some Android
     builds require the input to be laid-out (not display:none) for
     capture=environment to route to the camera app. */
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Unit tab remove (×) — only shown next to accessory dwellings so the user
 * can one-tap remove an accidental extra ADU without navigating to Files. */
.unit-btn-wrap {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
}
.unit-btn-wrap .unit-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: 0;
}
.unit-btn-x {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--err);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.unit-btn-x:hover, .unit-btn-x:focus-visible {
  background: color-mix(in srgb, var(--err) 12%, var(--surface));
  border-color: var(--err);
  outline: none;
}

/* ---- weather source badge -------------------------------------------- */
/* Tells the agent at a glance whether the reading came from the lookup or
   from their own typing. Auto-filled data should never masquerade as a
   human attestation on a disclosure form. */
.wx-src { margin-left: 8px; font-style: normal; }
.wx-src em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
}
.wx-src .wx-auto {
  background: #e8f1fb;
  color: #1d4e89;
  border: 1px solid #c3dcf5;
}
.wx-src .wx-manual {
  background: #eef6ee;
  color: #2b6033;
  border: 1px solid #cfe6d1;
}


/* ---- brand mark ------------------------------------------------------- */
/* The key is the brokerage's identity element; it carries the teal so the
   wordmark beside it can stay in plain nav ink. */
.brand svg.brand-key { color: var(--brand-teal-lt); flex: 0 0 auto; }
.brand-name { letter-spacing: -0.01em; }
.brand-sub { letter-spacing: 0.01em; }


/* ---- splash ----------------------------------------------------------- */
/* Covers the viewport until the first render lands. Painted from CSS with no
   script dependency, so a slow phone shows the brand rather than a white gap. */
.splash {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav);
  opacity: 1;
  transition: opacity 260ms ease;
}
.splash.is-hiding { opacity: 0; }
.splash.is-gone { display: none; }
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
/* The V2 lockup is ~3:1, so it is capped narrower than the old 5:1 mark to
   keep the same visual mass on the panel. */
.splash-logo {
  width: 100%;
  max-width: 262px;
  height: auto;
  display: none;
}
/* The full lockup has a silver serif wordmark, so the knockout variant is the
   one that belongs on the dark splash panel. */
.splash-logo-light { display: block; }
.splash-app {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--nav-ink);
}
.splash-sub {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nav-ink-dim);
}
.splash-bar {
  margin-top: 22px;
  width: 116px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.splash-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: var(--brand-teal-lt);
  animation: splash-slide 1s ease-in-out infinite;
}
@keyframes splash-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(290%); }
}
@media (prefers-reduced-motion: reduce) {
  .splash { transition: none; }
  .splash-bar span { animation: none; width: 100%; }
}

/* ---- home card lockup ------------------------------------------------- */
/* Anchors the Files tab with the brokerage identity. Swaps variant by theme
   because the wordmark is dark ink on transparency. */
.home-lockup {
  display: flex;
  justify-content: center;
  padding: 4px 0 18px;
}
.home-lockup img { width: 100%; max-width: 212px; height: auto; }
.home-lockup .lockup-light { display: none; }
[data-theme='dark'] .home-lockup .lockup-dark { display: none; }
[data-theme='dark'] .home-lockup .lockup-light { display: block; }
