/* =====================================================================================
   LotLedger design system — mobile-first, professional, low-chrome.
   ===================================================================================== */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --border: #E2DFD8;
  --border-strong: #CFCAC0;

  --ink: #1B2431;
  --ink-2: #47515F;
  --ink-3: #737D8A;
  --ink-inverse: #F7F7F4;

  --primary: #1F3A5F;
  --primary-hover: #182F4D;
  --primary-soft: #E7EDF5;
  --primary-ink: #FFFFFF;

  --accent: #C2703D;
  --accent-hover: #A85E30;
  --accent-soft: #F7E9DF;

  --success: #2C7A57;
  --success-soft: #E1F2E8;
  --success-strong: #1F5C41;
  --warning: #A66A12;
  --warning-soft: #FBF0DA;
  --danger: #B33A3A;
  --danger-soft: #F9E3E3;
  --info: #2E64A6;
  --info-soft: #E4ECF8;
  --neutral: #6B7480;
  --neutral-soft: #ECEBE7;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(27, 36, 49, 0.06);
  --shadow: 0 4px 16px rgba(27, 36, 49, 0.08);
  --shadow-lg: 0 16px 40px rgba(27, 36, 49, 0.18);

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --bottom-nav-h: 64px;
  --touch: 44px;
  --content-max: 1280px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; scroll-padding-top: calc(var(--topbar-h) + 12px); }  /* #section jumps land below the pinned top bar */
body {
  margin: 0; font-family: var(--font-sans); color: var(--ink); background: var(--bg);
  line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: 0.95rem; }
p { margin: 0 0 0.75rem; } p:last-child { margin-bottom: 0; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
small, .small { font-size: 0.8125rem; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.inline { display: inline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
img, svg { max-width: 100%; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.icon-sm { width: 16px; height: 16px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(46, 100, 166, 0.45); outline-offset: 2px; }

/* --------------------------------------------------------------------------- Shell */
.shell { min-height: 100dvh; display: flex; }
.sidebar { display: none; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; flex: none; width: 34px; height: 34px; }
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand-mark-lg { width: 52px; height: 52px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-text small { color: rgba(255,255,255,0.65); font-size: 0.7rem; }
.brand-compact strong { font-size: 1rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--touch); height: var(--touch);
  border-radius: 10px; color: var(--ink-2); background: transparent; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--neutral-soft); color: var(--ink); text-decoration: none; }
.badge-dot {
  position: absolute; top: 6px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent);
  color: #fff; font-size: 0.7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 0.8rem; flex: 0 0 auto; letter-spacing: 0.02em;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.7rem; }
.avatar-btn { text-decoration: none; }
.content { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 16px 16px calc(var(--bottom-nav-h) + var(--safe-bottom) + 24px); }

/* Global search */
.global-search { position: relative; display: none; flex: 1; max-width: 560px; align-items: center; }
.global-search > .icon { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.global-search input {
  width: 100%; height: 40px; padding: 0 12px 0 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font: inherit; color: var(--ink);
}
.global-search input:focus { background: var(--surface); border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(31,58,95,0.12); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; max-height: 70vh; overflow-y: auto;
}
.search-results[hidden] { display: none; }
.search-result { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: inherit; min-height: var(--touch); }
.search-result:last-child { border-bottom: 0; }
.search-result:hover, .search-result.is-focused { background: var(--surface-2); text-decoration: none; }
.search-result-main { flex: 1; min-width: 0; }
.search-result-main strong { display: block; }
.search-result-main small { color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 14px; color: var(--ink-3); text-align: center; }
.search-overlay { position: fixed; inset: 0; z-index: 60; background: var(--surface); display: flex; flex-direction: column; }
.search-overlay[hidden] { display: none; }
.search-overlay-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.search-overlay-bar input { flex: 1; height: 44px; border-radius: 10px; border: 1px solid var(--border); padding: 0 12px; font: inherit; font-size: 1rem; }
.search-overlay .search-results { position: static; border: 0; box-shadow: none; max-height: none; flex: 1; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-nav a, .bottom-nav button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font: inherit; font-size: 0.68rem;
  background: none; border: 0; text-decoration: none; cursor: pointer; padding: 6px 0;
}
.bottom-nav .icon { width: 22px; height: 22px; }
.bottom-nav .is-active { color: var(--primary); font-weight: 600; }
.bottom-nav .nav-badge { position: absolute; top: 4px; right: calc(50% - 22px); }
.bottom-nav-search .icon { width: 24px; height: 24px; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 700; margin-left: auto; }

/* Drawer (mobile "More") */
.drawer { position: fixed; inset: 0; z-index: 70; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(27,36,49,0.45); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(88vw, 340px); background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px; }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; color: var(--ink); font-weight: 500; min-height: var(--touch); }
.drawer-nav a:hover { background: var(--surface-2); text-decoration: none; }
.drawer-footer { padding: 12px 14px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip-text strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { color: var(--ink-3); }

.hide-mobile { display: none !important; }
.show-mobile-only { display: flex; }

/* --------------------------------------------------------------------------- Desktop */
@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: sticky; top: 0; height: 100dvh;
    background: var(--primary); color: var(--ink-inverse); padding: 18px 14px;
  }
  .sidebar .brand { padding: 4px 8px 18px; color: #fff; }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
  .nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: rgba(255,255,255,0.78); font-weight: 500; font-size: 0.92rem; }
  .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
  .nav-link.is-active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; }
  .sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); display: flex; flex-direction: column; gap: 8px; }
  .sidebar-footer .user-chip { padding: 4px 6px; color: #fff; }
  .sidebar-footer .user-chip-text small { color: rgba(255,255,255,0.6); }
  .sidebar-footer .avatar { background: rgba(255,255,255,0.16); color: #fff; }
  .sidebar-footer .btn-ghost { color: rgba(255,255,255,0.8); }
  .sidebar-footer .built-by { color: rgba(255,255,255,0.5); }
  .sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
  .brand-compact { display: none; }
  .global-search { display: flex; }
  .bottom-nav, .drawer { display: none !important; }
  .content { padding: 28px 32px 48px; }
  .hide-mobile { display: inline-flex !important; }
  .show-mobile-only { display: none !important; }
  h1 { font-size: 1.75rem; }
  .topbar { padding: 0 32px; }
}
@media (min-width: 1400px) { :root { --sidebar-w: 264px; } }

/* --------------------------------------------------------------------------- Auth */
.auth-shell { background: linear-gradient(180deg, var(--primary) 0 240px, var(--bg) 240px); min-height: 100dvh; }
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px 24px; }
.auth-brand { text-align: center; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-brand h1 { font-size: 1.6rem; }
.auth-footer { font-size: 0.8rem; }
.error-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--primary); letter-spacing: -0.04em; margin: 4px 0 0; line-height: 1; }

/* --------------------------------------------------------------------------- Page header */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-title { font-size: 1.45rem; }
.page-subtitle { color: var(--ink-3); margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--ink-3); margin-bottom: 6px; }
.back-link .icon { width: 16px; height: 16px; }
@media (min-width: 900px) { .page-title { font-size: 1.75rem; } .page-header { margin-bottom: 24px; } }

/* --------------------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.925rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn[hidden] { display: none; }
.btn:hover { text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #973030; }
.btn-danger-outline { background: var(--surface); color: var(--danger); border-color: rgba(179,58,58,0.4); }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-strong); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.is-disabled, .btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row-end { justify-content: flex-end; }
@media (max-width: 599px) { .btn-row-stack .btn { flex: 1 1 100%; } }

/* --------------------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: 0.875rem; color: var(--ink-2); }
.req { color: var(--danger); }
/* --- Justin GEE AI launcher (every page but its own) -------------------------------------- */
.assistant-widget { position: fixed; right: 18px; bottom: calc(18px + var(--bottom-nav-h) + var(--safe-bottom)); z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
@media (min-width: 900px) { .assistant-widget { right: 24px; bottom: 24px; } }  /* no bottom nav to clear on desktop */
/* the launcher is the assistant's face with the name under it; once open, just the face */
.assistant-launcher { display: inline-flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; border: 0; border-radius: 18px; background: none; color: var(--primary); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.assistant-launcher:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.assistant-face { display: block; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--primary); box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(27, 36, 49, 0.08), var(--shadow-lg); transition: transform .15s ease, width .15s ease, height .15s ease; }
.assistant-launcher:hover .assistant-face { transform: translateY(-2px) scale(1.04); }
.assistant-launcher-text { padding: 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 0.78rem; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.assistant-widget.is-open .assistant-launcher-text { display: none; }
.assistant-widget.is-open .assistant-face { width: 52px; height: 52px; }
@media (prefers-reduced-motion: reduce) { .assistant-face { transition: none; } .assistant-launcher:hover .assistant-face { transform: none; } }
.assistant-face img, .assistant-mark img, .chat-avatar img, .chat-who img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.assistant-panel { width: min(392px, calc(100vw - 32px)); height: min(560px, calc(100vh - 150px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.assistant-panel[hidden] { display: none; }
.assistant-panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.assistant-mark { flex: none; display: block; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--primary); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.assistant-title { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.assistant-title small { color: var(--ink-3); font-size: 0.75rem; }
.assistant-panel .chat { flex: 1; min-height: 0; border: 0; box-shadow: none; background: none; max-width: none; }
.assistant-panel .chat-log { flex: 1; max-height: none; padding: 14px; }
.assistant-panel .chat-bubble { max-width: 100%; font-size: 0.9rem; }
.assistant-panel .chat-composer { padding: 10px 12px; }
.assistant-panel .chat-composer .textarea { min-height: 42px; font-size: 0.9rem; }
.assistant-panel .chat-intro { padding: 14px 6px; }
.assistant-panel .chat-intro h3 { font-size: 1rem; }
.assistant-panel .chat-starters .btn { width: 100%; max-width: 100%; }
.assistant-panel .chat-starters { flex-direction: column; }
@media (max-width: 599px) {
  .assistant-widget { right: 12px; left: 12px; bottom: calc(12px + var(--bottom-nav-h) + var(--safe-bottom)); align-items: flex-end; }
  .assistant-panel { width: 100%; height: min(70vh, 520px); }
}
/* the plat map's full-screen mode owns the whole window */
html.has-fullscreen-plat .assistant-widget { display: none; }
@media print { .assistant-widget { display: none; } }

/* --- Justin GEE AI help chat ------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; max-width: 860px; }
.chat-log { display: flex; flex-direction: column; gap: 14px; padding: 18px; max-height: min(62vh, 620px); overflow-y: auto; }
.chat-turn { display: flex; gap: 10px; align-items: flex-start; }
.chat-turn.is-user { flex-direction: row-reverse; }
.chat-who { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); overflow: hidden; }
.chat-turn.is-assistant .chat-who { background: var(--accent-soft); color: var(--accent); }
.chat-bubble { max-width: min(640px, 82%); padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.55; }
.chat-turn.is-user .chat-bubble { background: var(--primary); border-color: var(--primary); color: #fff; }
.chat-turn.is-user .chat-bubble a { color: #fff; text-decoration: underline; }
.chat-turn.is-error .chat-bubble { background: var(--danger-soft); border-color: rgba(179,58,58,0.3); }
.chat-typing { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: chat-typing 1.15s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: .18s; }
.chat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes chat-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-bubble.is-typing { cursor: pointer; }
.chat-bubble.is-typing > :last-child::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; background: var(--ink-2); vertical-align: -2px; animation: chat-caret 1s steps(1) infinite; }
@keyframes chat-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .chat-typing i, .chat-bubble.is-typing > :last-child::after { animation: none; } }
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 6px 0; padding-left: 22px; }
.chat-bubble code { font-family: var(--font-mono); font-size: 0.86em; background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; }
.chat-bubble li { margin: 3px 0; }
.chat-bubble a { font-weight: 600; }
.chat-intro { text-align: center; padding: 26px 18px; }
.chat-intro h3 { margin: 10px 0 6px; }
.chat-intro p { max-width: 520px; margin: 0 auto; }
.chat-avatar { display: inline-block; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--primary); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border), var(--shadow); }
.chat-starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chat-starters .btn { text-align: left; white-space: normal; line-height: 1.35; height: auto; padding-top: 8px; padding-bottom: 8px; }
.chat-composer { display: flex; gap: 10px; align-items: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.chat-composer .textarea { flex: 1; resize: none; min-height: 52px; }
.chat-foot { padding: 0 18px 14px; margin: 0; }
@media (max-width: 599px) { .chat-bubble { max-width: 100%; } .chat-starters .btn { width: 100%; } }

/* show/hide control inside a password box (added by app.js) */
.password-field { position: relative; display: block; }
.password-field .input { padding-right: 44px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; }
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.password-toggle .icon { width: 18px; height: 18px; }

.input, .select, .textarea {
  width: 100%; min-height: var(--touch); padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; font-size: 1rem; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2347515F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,58,95,0.14); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input[type="date"], .input[type="time"] { min-width: 0; }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.field .help { color: var(--ink-3); font-size: 0.8rem; margin: 0; }
.field .error { color: var(--danger); font-size: 0.8rem; margin: 0; }
.checkbox { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; font-weight: 500; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: span 2; } .form-grid-3 { grid-template-columns: repeat(3, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .form-actions .btn { flex: 0 0 auto; } }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1 1 160px; }
.input-group { display: flex; } .input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 650; font-size: 1rem; margin-bottom: 8px; padding: 0; }
.file-drop { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px 16px; text-align: center; background: var(--surface-2); color: var(--ink-2); }
.file-drop.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.file-drop input[type="file"] { display: block; margin: 10px auto 0; max-width: 100%; }
.file-drop .btn { margin-top: 10px; }

/* --------------------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 1rem; }
.card-header .btn { flex-shrink: 0; }
/* A card that folds away (its open/closed state is remembered per viewer in app.js) */
.card-collapse > summary { cursor: pointer; list-style: none; }
.card-collapse > summary::-webkit-details-marker { display: none; }
.card-collapse:not([open]) > summary { border-bottom: 0; }
.card-collapse > summary:hover { background: var(--surface-2); }
.card-collapse > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.card-collapse-chevron { transition: transform .15s ease; vertical-align: middle; }
.card-collapse[open] .card-collapse-chevron { transform: rotate(180deg); }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { gap: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}
.card-body > .table-wrap { margin: -16px; }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-list > li:last-child { border-bottom: 0; }
.card-list .item-main { flex: 1; min-width: 0; }
.card-list .item-main strong { display: block; }
.card-list .item-main small { color: var(--ink-3); display: block; }
.card-list a.item-link { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: var(--touch); }
.card-list a.item-link:hover strong { color: var(--primary); }
.card-list .chev { color: var(--ink-3); }

/* --------------------------------------------------------------------------- Metrics */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .metrics { grid-template-columns: repeat(4, 1fr); gap: 14px; } .metrics-6 { grid-template-columns: repeat(6, 1fr); } }
.metric { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; min-height: 84px; }
.metric-link:hover { border-color: var(--primary); text-decoration: none; box-shadow: var(--shadow-sm); }
.metric-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.metric-label { font-size: 0.8rem; color: var(--ink-2); font-weight: 500; }
.metric-hint { font-size: 0.72rem; color: var(--ink-3); }
.metric.tone-warning .metric-value { color: var(--warning); }
.metric.tone-danger .metric-value { color: var(--danger); }
.metric.tone-success .metric-value { color: var(--success); }
.metric.tone-accent .metric-value { color: var(--accent); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 10px; }
.section-title h2 { font-size: 1.05rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; font-size: 0.78rem; }
.section-title a { font-size: 0.85rem; }

/* --------------------------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.01em; white-space: nowrap; line-height: 1.3; }
.badge-neutral { background: var(--neutral-soft); color: var(--ink-2); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-success-strong { background: var(--success); color: #fff; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-lg { font-size: 0.85rem; padding: 5px 12px; }

/* --------------------------------------------------------------------------- Tables (collapse to cards on mobile) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-link { color: inherit; font-weight: 600; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { min-height: 34px; }
.table-compact th, .table-compact td { padding: 8px 10px; }
@media (max-width: 767px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .table-cards tr:last-child { border-bottom: 0; }
  .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .table-cards td.num { text-align: right; }
  .table-cards td::before { content: attr(data-label); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 700; text-align: left; flex: 0 0 40%; }
  .table-cards td.primary { display: block; text-align: left; font-size: 1rem; padding-bottom: 6px; }
  .table-cards td.primary::before { display: none; }
  .table-cards td.actions { justify-content: flex-end; }
  .table-cards td.actions::before { display: none; }
  .table-cards td.no-label::before { display: none; }
}

/* --------------------------------------------------------------------------- Filters / toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .select, .toolbar .input { min-height: 40px; width: auto; flex: 1 1 140px; }
.toolbar .btn { min-height: 40px; }
.filter-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 0.8rem; font-weight: 600; }
.chip a { color: inherit; font-weight: 800; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* Bulk edit on the lots list: a bar that appears once rows are picked. */
.sidebar-account { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 8px; }
.sidebar-account a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: rgba(255,255,255,0.72); font-size: 0.82rem; text-decoration: none; }
.sidebar-account a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-account .icon { width: 16px; height: 16px; }
.bulk-cell { width: 34px; }
.table tr.is-picked td { background: var(--primary-soft); }
.table tr.is-picked td.primary a { color: var(--primary); }
.bulk-cell input[type="checkbox"] { width: 18px; height: 18px; }
.bulk-bar { position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow); }
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: 0.9rem; color: var(--ink-2); }
.bulk-count strong { color: var(--primary); font-size: 1.05rem; }
a.chip-link { text-decoration: none; border: 1px solid transparent; }
a.chip-link:hover { border-color: var(--primary); }
a.chip-link.is-active { background: var(--primary); color: #fff; }
details.filters { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
details.filters summary { padding: 12px 16px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; min-height: var(--touch); }
details.filters summary::-webkit-details-marker { display: none; }
details.filters .filters-body { padding: 0 16px 16px; }
@media (min-width: 900px) { details.filters summary { display: none; } details.filters { border: 0; background: transparent; } details.filters .filters-body { padding: 0; } details.filters:not([open]) .filters-body { display: block; } }

/* --------------------------------------------------------------------------- Flash / callouts */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 0.92rem; }
.flash-success { background: var(--success-soft); border-color: rgba(44,122,87,0.3); color: var(--success-strong); }
.flash-info { background: var(--info-soft); border-color: rgba(46,100,166,0.3); color: #1f4a80; }
.flash-warning { background: var(--warning-soft); border-color: rgba(166,106,18,0.3); color: #7a4d0c; }
.flash-danger { background: var(--danger-soft); border-color: rgba(179,58,58,0.3); color: #8a2a2a; }
.flash-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: inherit; cursor: pointer; padding: 0 2px; }
.callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.callout-accent { background: var(--accent-soft); border-color: rgba(194,112,61,0.3); }
.plat-handoff { align-items: flex-start; }
.plat-handoff-icon { display: inline-flex; padding-top: 2px; }
.plat-handoff-text { flex: 1 1 320px; }
.plat-handoff-text p { margin-top: 4px; }
.callout-warning { background: var(--warning-soft); border-color: rgba(166,106,18,0.3); }
.callout-danger { background: var(--danger-soft); border-color: rgba(179,58,58,0.3); }
.callout-info { background: var(--info-soft); border-color: rgba(46,100,166,0.3); }

/* --------------------------------------------------------------------------- Empty state */
.empty-state { text-align: center; padding: 36px 20px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { display: inline-flex; width: 48px; height: 48px; border-radius: 50%; background: var(--neutral-soft); align-items: center; justify-content: center; color: var(--ink-3); }
.empty-state h3 { color: var(--ink); }
.empty-state p { max-width: 420px; color: var(--ink-3); }
.empty-state .btn { margin-top: 6px; }

/* --------------------------------------------------------------------------- Milestone timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 0 0 4px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: -4px; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-marker { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--ink-3); z-index: 1; }
.timeline-marker .icon { width: 14px; height: 14px; }
.timeline-item.is-complete .timeline-marker { background: var(--success); border-color: var(--success); color: #fff; }
.timeline-item.is-complete::before { background: var(--success); }
.timeline-item.is-next .timeline-marker { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 3px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.timeline-item:last-child .timeline-content { border-bottom: 0; }
.timeline-title { font-weight: 600; display: block; }
.timeline-sub { color: var(--ink-3); font-size: 0.8rem; display: block; }
.timeline-date { font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline-date.is-empty { color: var(--ink-3); font-weight: 500; }
.timeline-meta { display: flex; align-items: center; gap: 10px; }
.timeline-amount { color: var(--ink-2); font-size: 0.85rem; }
/* horizontal stepper on wide screens for compact summary */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1 1 0; min-width: 76px; text-align: center; font-size: 0.68rem; color: var(--ink-3); position: relative; }
.step-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border-strong); margin: 0 auto 4px; }
.step.is-complete .step-dot { background: var(--success); } .step.is-complete { color: var(--success-strong); font-weight: 600; }
.step.is-next .step-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } .step.is-next { color: var(--accent); font-weight: 600; }

/* progress bar */
.progress { height: 8px; border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-3); margin-top: 4px; }
.status-bars { display: flex; flex-direction: column; gap: 8px; }
.status-bar { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; font-size: 0.85rem; }
@media (max-width: 599px) { .status-bar { grid-template-columns: 120px 1fr 32px; } }

/* --------------------------------------------------------------------------- Detail lists */
.dl { display: grid; grid-template-columns: 1fr; gap: 10px 20px; margin: 0; }
@media (min-width: 640px) { .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dl-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dl > div { min-width: 0; }
.dl dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 700; margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl dd.empty { color: var(--ink-3); font-weight: 400; }

/* --------------------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; min-height: var(--touch); display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-weight: 600; font-size: 0.9rem; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tabs .is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tab-panel[hidden] { display: none; }
.count-pill { background: var(--neutral-soft); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; font-size: 0.72rem; }

/* --------------------------------------------------------------------------- Activity / notes */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-body p { margin: 0 0 2px; }
.note { padding: 12px 0; border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: 0; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 0.8rem; color: var(--ink-3); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note.is-pinned { background: var(--warning-soft); margin: 0 -16px; padding: 12px 16px; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------- Quick update sheet */
.quick-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .quick-grid { grid-template-columns: 1fr 1fr; } }
.quick-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.quick-row .field { margin: 0; }
.quick-row .quick-actions { display: flex; gap: 6px; }
.quick-row.is-complete { border-color: rgba(44,122,87,0.4); background: var(--success-soft); }

/* --------------------------------------------------------------------------- Dialog */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(94vw, 560px); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(27,36,49,0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.ll-dialog { width: min(94vw, 480px); }
.ll-dialog .modal-body { display: flex; flex-direction: column; gap: 12px; }
.ll-dialog-message { margin: 0; line-height: 1.5; color: var(--ink); }
.ll-dialog-details ul { margin: 0; padding-left: 18px; color: var(--ink-2); line-height: 1.55; }
.ll-dialog-input { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--ink-2); }
.ll-dialog-input .input { font-weight: 600; letter-spacing: 0.04em; }
.ll-progress { width: min(94vw, 440px); }
.ll-progress .modal-body { display: flex; flex-direction: column; gap: 10px; }
.ll-progress-line { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink); line-height: 1.45; }
.ll-progress-line .spinner { flex: none; }
.ll-progress-check { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--success); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.ll-progress.is-done .ll-progress-line { font-weight: 600; }
.ll-progress-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.ll-progress-steps li { margin: 3px 0; }
.ll-progress-steps li.is-current { color: var(--ink); font-weight: 600; }
.ll-progress-steps li.is-done { color: var(--success); }
.ll-workflow { width: min(94vw, 520px); }
.ll-workflow .modal-body { display: flex; flex-direction: column; gap: 12px; }
.ll-workflow-stage { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.05rem; }
.ll-workflow-meta { margin: 0; }
.ll-workflow-note { margin: 0; color: var(--warning); }
.ll-workflow-steps { margin: 0; padding-left: 20px; }
.ll-bar { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.ll-bar-fill { height: 100%; width: 4%; border-radius: 999px; background-color: var(--primary); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,0.28) 0 10px, transparent 10px 20px); background-size: 28px 28px; animation: ll-bar-move 1s linear infinite; transition: width 1s linear; }
@keyframes ll-bar-move { from { background-position: 0 0; } to { background-position: 28px 0; } }
@media (prefers-reduced-motion: reduce) { .ll-bar-fill { animation: none; } }
.plat-legend-note { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--warning); padding: 4px 6px; }
.plat-progress { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: var(--surface-2); }
.plat-progress-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.plat-progress .plat-steps { margin: 0 0 8px; }
.plat-approved-note { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; color: var(--ink-2); }
@media (max-width: 599px) { dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92dvh; } .modal-footer .btn { flex: 1; } }

/* --------------------------------------------------------------------------- Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; display: none; }
.dropdown.is-open .dropdown-menu { display: block; z-index: 60; }  /* positioned against the viewport in app.js, so a scrolling table cannot crop it */
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; border-radius: 6px; cursor: pointer; min-height: 40px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .danger { color: var(--danger); }

/* --------------------------------------------------------------------------- Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 0; }
.pagination-info, .pagination-page { color: var(--ink-3); font-size: 0.85rem; }
.pagination-links { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------------------- Documents */
.doc-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .doc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .doc-grid { grid-template-columns: repeat(3, 1fr); } }
.doc-card { display: flex; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); align-items: flex-start; }
.doc-icon { width: 42px; height: 42px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.doc-icon.is-image { background: var(--accent-soft); color: var(--accent); }
.doc-main { flex: 1; min-width: 0; }
.doc-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-main small { color: var(--ink-3); display: block; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

/* --------------------------------------------------------------------------- Review table (AI) */
.review-table td input { min-height: 38px; padding: 6px 8px; font-size: 0.9rem; }
.review-table .row-tools { white-space: nowrap; }
.confidence { font-size: 0.72rem; color: var(--ink-3); }
.diff-new { background: var(--success-soft); }
.diff-changed { background: var(--warning-soft); }
.diff-skip { color: var(--ink-3); text-decoration: line-through; }

/* --------------------------------------------------------------------------- Misc */
.kbd { font-family: var(--font-mono); font-size: 0.75rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }
.divider-v { width: 1px; background: var(--border); align-self: stretch; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.report-preview { font-size: 0.85rem; }
.report-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .report-summary { grid-template-columns: repeat(4, 1fr); } }
.sticky-actions { position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); background: var(--surface); padding: 10px 0; border-top: 1px solid var(--border); margin-top: 10px; z-index: 5; }
@media (min-width: 900px) { .sticky-actions { position: static; border: 0; padding: 0; } }
.spinner[hidden] { display: none; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

@media print {
  .sidebar, .topbar, .bottom-nav, .drawer, .page-actions, .btn, .flash-stack { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid; }
  body { background: #fff; }
}

/* Milestone inline editor */
details.milestone-edit { position: relative; }
details.milestone-edit > summary { list-style: none; cursor: pointer; }
details.milestone-edit > summary::-webkit-details-marker { display: none; }
details.milestone-edit .quick-form { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); width: min(100%, 360px); }
details.milestone-edit .quick-form .field { margin-bottom: 10px; }
.timeline-content { align-items: flex-start; }
.timeline-meta { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 599px) { .timeline-content { flex-direction: column; align-items: stretch; } .timeline-meta { justify-content: space-between; width: 100%; } details.milestone-edit { width: 100%; } details.milestone-edit .quick-form { width: 100%; } }

/* Prevent intrinsically wide children (scrolling tab strips, tables, long tokens) from stretching
   grid/flex parents past the viewport on small screens. */
.grid > *, .stack > *, .card, .tabs, .timeline-item > *, .card-body, .content > * { min-width: 0; }
.card { max-width: 100%; }
.tabs { max-width: 100%; }

/* =====================================================================================
   Interactive plat maps
   ===================================================================================== */
.plat-viewer { display: flex; flex-direction: column; gap: 12px; }
.plat-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.plat-toolbar-actions { display: flex; gap: 6px; margin-left: auto; }
.plat-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.plat-tab { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; min-height: 36px; }
.plat-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.plat-tab.is-off { opacity: 0.55; text-decoration: line-through; }
.plat-body { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) { .plat-body { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; } }
.plat-stage { position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #FFFFFF; max-height: 78vh; }
.plat-canvas { position: relative; width: 100%; line-height: 0; }
.plat-canvas img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.plat-canvas .plat-hires { position: absolute; display: block; pointer-events: none; }  /* source-resolution crop laid over the zoomed base image */
.plat-canvas .plat-hires[hidden] { display: none; }
.plat-zoom { display: inline-flex; align-items: center; gap: 2px; }
.plat-zoom-level { min-width: 46px; text-align: center; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plat-layer { position: absolute; inset: 0; user-select: none; }
.plat-layer.is-dragging { cursor: grabbing; }
.plat-layer.is-dragging .plat-dot { transition: none; }
.plat-layer.is-dragging .plat-dot::before { display: none; }  /* no tooltip while a marker is being moved */
.plat-layer.is-adding { cursor: crosshair; }
.plat-dot {
  /* one knob for the marker size: the drawn reference map has far smaller parcels than a recorded plat sheet */
  --dot-size: 16px;
  position: absolute; width: var(--dot-size); height: var(--dot-size); margin: 0; padding: 0; border-radius: 50%; border: 2px solid #fff; cursor: pointer;
  background: var(--dot, #1F3A5F); box-shadow: 0 0 0 2px var(--dot, #1F3A5F), 0 1px 4px rgba(0,0,0,0.35); transform: translate(-50%, -50%);
  transition: transform .12s;
}
/* Reference map: small lots, so a small marker — the touch target below keeps it easy to tap. */
.plat-viewer.is-reference .plat-dot { --dot-size: 9px; border-width: 1.5px; box-shadow: 0 0 0 1.5px var(--dot, #1F3A5F), 0 1px 3px rgba(0,0,0,0.3); }
.plat-viewer.is-reference .plat-dot.is-selected, .plat-viewer.is-reference .plat-dot.is-selected:hover { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--dot, #1F3A5F); }
.plat-viewer.is-reference .plat-dot.is-pulse::after { inset: -3px; border-width: 1.5px; }
.plat-dot::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; }  /* larger touch target */
.plat-dot.is-pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--dot, #1F3A5F); opacity: 0; animation: plat-pulse 2.2s ease-out infinite; }
.plat-dot.is-unlinked { background: #fff; box-shadow: 0 0 0 2px var(--dot, #9AA3AE); }
.plat-dot.is-off { opacity: 0.35; }
.plat-dot:hover { transform: translate(-50%, -50%) scale(1.25); z-index: 2; }
.plat-dot.is-selected, .plat-dot.is-selected:hover { transform: translate(-50%, -50%) scale(1.35); z-index: 3; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--dot, #1F3A5F); }  /* selection outranks hover so a dragged dot keeps one size */
.plat-dot[data-label]:hover::before { content: attr(data-label); inset: auto; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; font: 600 11px/1.3 var(--font-sans); padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.plat-dot.is-editable { cursor: grab; touch-action: none; }  /* a touch on a marker drags it; touches elsewhere still pan the sheet */
.plat-dot.is-editable:active, .plat-dot.is-dragging { cursor: grabbing; z-index: 4; }
@keyframes plat-pulse { 0% { transform: scale(0.6); opacity: 0.9; } 70% { transform: scale(2.2); opacity: 0; } 100% { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .plat-dot.is-pulse::after { animation: none; opacity: 0.35; } }
.plat-side { display: flex; flex-direction: column; gap: 10px; }
.plat-legend { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 1000px) { .plat-legend { flex-direction: column; } }
.plat-legend-item { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 10px 6px 8px; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); cursor: pointer; min-height: 36px; }
.plat-legend-item.is-off { opacity: 0.45; text-decoration: line-through; }
.plat-swatch { position: relative; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--dot, #1F3A5F); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--dot, #1F3A5F); flex: 0 0 auto; }
.plat-swatch.is-pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--dot); animation: plat-pulse 2.2s ease-out infinite; }
.plat-panel { padding: 12px 14px; }
.plat-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.plat-panel-head > div { flex: 1; }
.plat-panel-dl { grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
/* changing a lot's status from its dot (lot-status.js) */
.lot-status { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.lot-status-label { font-size: 0.78rem; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.lot-status-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lot-status-row .select { flex: 1 1 150px; min-width: 0; }
.lot-status-row .input[type=date] { flex: 1 1 130px; min-width: 0; }
.lot-status-row .input[hidden] { display: none; }
.lot-status-msg { margin: 0; min-height: 0; color: var(--ink-2); }
.lot-status-msg:empty { display: none; }
.lot-status-msg.is-success { color: var(--success-strong); }
.lot-status-msg.is-danger { color: var(--danger); }
.plat-editor-lot { border-top: 1px solid var(--border); }
/* a review row's note (an area that could not be placed, a reading to confirm) reads as a line, not a tower */
.review-note { min-width: 240px; line-height: 1.35; }
/* --- the plat on a phone: the lots at a glance (counts, then a tile per lot), details in a bottom sheet --- */
.plat-view-switch { display: none; }
.plat-lots[hidden], .plat-sheet[hidden] { display: none; }
.plat-lots { display: flex; flex-direction: column; gap: 10px; }
.plat-find { height: 42px; font-size: 1rem; }
.plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.plat-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 8px 2px 6px; border: 1px solid color-mix(in srgb, var(--dot, #9AA3AE) 45%, var(--surface)); border-radius: 10px; background: color-mix(in srgb, var(--dot, #9AA3AE) 14%, var(--surface)); color: var(--ink); font: inherit; cursor: pointer; overflow: hidden; }
.plat-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--dot, #9AA3AE); }
.plat-tile.is-unlinked { border-style: dashed; }
.plat-tile.is-selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.plat-tile-no { font-size: 1.02rem; font-weight: 700; line-height: 1.1; }
.plat-tile-label { max-width: 100%; font-size: 0.58rem; letter-spacing: -0.01em; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plat-grid-empty { margin: 4px 0 0; }
.plat-sheet { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; justify-content: flex-end; }
.plat-sheet-backdrop { position: absolute; inset: 0; background: rgba(27, 36, 49, 0.38); }
.plat-sheet-body { position: relative; max-height: 84vh; overflow-y: auto; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); padding: 8px 16px calc(18px + var(--safe-bottom)); animation: plat-sheet-up .18s ease-out; }
.plat-sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 2px auto 10px; }
.plat-sheet .plat-panel-head strong { font-size: 1.15rem; }
.plat-sheet .plat-panel-dl { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.plat-sheet .plat-panel-dl > div:first-child { grid-column: 1 / -1; }
.plat-sheet .icon-btn { width: 40px; height: 40px; font-size: 1.4rem; }
@keyframes plat-sheet-up { from { transform: translateY(28px); opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .plat-sheet-body { animation: none; } }
html.has-plat-sheet, html.has-plat-sheet body { overflow: hidden; }
@media (max-width: 699px) {
  .plat-view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
  .plat-view-switch .plat-mode-btn { min-width: 76px; min-height: 36px; }
  .plat-toolbar { gap: 8px; }
  .plat-toolbar-actions { margin-left: 0; flex-wrap: wrap; }
  /* the counts come first: the legend becomes three big numbers you can tap to filter */
  .plat-body { display: flex; flex-direction: column; }
  .plat-side { order: -1; }
  .plat-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
  .plat-legend-item { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "dot count" "label label"; align-items: center; gap: 2px 8px; border-radius: 12px; padding: 8px 10px; min-height: 0; text-align: left; }
  .plat-legend-item .plat-swatch { grid-area: dot; }
  .plat-legend-item .count-pill { grid-area: count; justify-self: start; background: none; padding: 0; font-size: 1.35rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
  .plat-legend-item > span:nth-child(2) { grid-area: label; font-size: 0.74rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plat-legend-note { grid-column: 1 / -1; }
  .plat-hint { display: none; }
  /* the lots view: no map controls */
  .plat-viewer.is-lots .plat-stage, .plat-viewer.is-lots .plat-mode, .plat-viewer.is-lots .plat-zoom, .plat-viewer.is-lots [data-plat-fullscreen], .plat-viewer.is-lots [data-plat-download], .plat-viewer.is-lots [data-plat-open], .plat-viewer.is-lots .plat-panel { display: none !important; }
  /* editing markers needs a pointer and room; a phone gets the lots and their status instead */
  .plat-viewer [data-plat-edit-link] { display: none; }
}
.plat-editor-lot .lot-status { border-top: 0; padding-top: 0; }
.plat-hint { margin: 0; }
.built-by { margin: 8px 0 0; text-align: center; font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.01em; }
/* full-screen viewer: just the map, the legend floating over it, and lot details in a popover beside the marker */
.plat-viewer.is-fullscreen { position: fixed; inset: 0; z-index: 1000; background: var(--bg); padding: 10px 12px; gap: 8px; overflow: hidden; }
.plat-viewer.is-fullscreen .plat-body { flex: 1; min-height: 0; display: block; position: relative; }
.plat-viewer.is-fullscreen .plat-stage { height: 100%; max-height: none; display: flex; }
.plat-viewer.is-fullscreen .plat-canvas { margin: auto; flex: none; }  /* a contained map sits centered; a zoomed one overflows and scrolls */
.plat-viewer.is-fullscreen .plat-side { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); background: rgba(255, 255, 255, 0.94); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
.plat-viewer.is-fullscreen .plat-legend { flex-direction: row; }
.plat-viewer.is-fullscreen .plat-panel, .plat-viewer.is-fullscreen .plat-hint { display: none; }
html.has-fullscreen-plat, html.has-fullscreen-plat body { overflow: hidden; }
.plat-popover { position: absolute; z-index: 6; width: 340px; max-width: calc(100% - 16px); max-height: min(70vh, 520px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; line-height: 1.4; text-align: left; }
.plat-popover .plat-panel-dl { grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-bottom: 8px; }  /* two columns keep eight milestone dates a quick card */
.plat-popover .plat-panel-dl > div:first-child { grid-column: 1 / -1; }
.plat-card-body { padding: 12px; }
.plat-empty { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.plat-empty > div { flex: 1 1 280px; }
.plat-steps { padding-left: 20px; color: var(--ink-2); }
.plat-steps li { margin: 4px 0; }

/* editor */
.plat-editor-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) { .plat-editor-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.plat-stage-editor { max-height: 72vh; border-radius: 0; border-left: 0; border-right: 0; }
.review-table tr.is-selected td { background: var(--primary-soft); }
.review-table input[type="checkbox"] { width: 18px; height: 18px; }

/* subdivision cards */
.sub-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .sub-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .sub-grid { grid-template-columns: repeat(3, 1fr); } }
.sub-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow .12s, border-color .12s; }
.sub-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); }
.sub-card.is-archived { opacity: 0.75; }
.sub-card-media { position: relative; aspect-ratio: 16 / 9; background: #F7F6F2; border-bottom: 1px solid var(--border); overflow: hidden; }
.sub-card-media img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.sub-card-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ink-3); font-size: 0.8rem; background: repeating-linear-gradient(45deg, #F7F6F2 0 12px, #F1EFE9 12px 24px); }
.sub-card-placeholder .icon { width: 28px; height: 28px; }
.sub-card-status { position: absolute; top: 10px; right: 10px; }
.sub-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.sub-card-title { font-size: 1.1rem; }
.sub-card-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--ink-2); margin: 4px 0 6px; }
.sub-card-stats strong { color: var(--ink); }
input[type="color"] { width: 44px; height: 36px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px; background: #fff; }

/* Simple plat mode: the image carries color + number; overlay dots become invisible hit areas (still pulse on select) */
.plat-mode { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.plat-mode-btn { border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 0.8rem; font-weight: 600; padding: 6px 12px; cursor: pointer; min-height: 34px; }
.plat-mode-btn.is-active { background: var(--primary); color: #fff; }
.plat-dot.is-hit { width: 34px; height: 34px; background: transparent; border-color: transparent; box-shadow: none; }
.plat-dot.is-hit::after { display: none; }
.plat-dot.is-hit:hover, .plat-dot.is-hit.is-selected { box-shadow: 0 0 0 3px var(--dot, #1F3A5F); border-radius: 12px; transform: translate(-50%, -50%); }


/* --- plat workflow ------------------------------------------------------------------------- */
.plat-stages li { color: var(--muted); }
.plat-stages li.is-done { color: var(--success); text-decoration: line-through; }
.plat-stages li.is-current { color: var(--ink); font-weight: 600; }
.plat-region { position: absolute; border: 2px solid #E020A0; background: rgba(224, 32, 160, 0.12); border-radius: 4px; pointer-events: none; animation: plat-region-flash 1s ease-in-out 3; }
@keyframes plat-region-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.plat-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plat-compare figure { margin: 0; }
.plat-compare img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.plat-version.is-published { border-left: 4px solid var(--success); padding-left: 12px; }
.plat-reference-bar { gap: 10px; justify-content: space-between; }
.plat-legend-note { flex-basis: 100%; }
@media (max-width: 760px) { .plat-compare { grid-template-columns: 1fr; } }

/* --- phone notifications: the first-visit prompt on a phone (push.js), and the profile controls ------------- */
.push-prompt { position: fixed; inset: 0; z-index: 1150; display: flex; flex-direction: column; justify-content: flex-end; }
.push-prompt[hidden] { display: none; }
.push-prompt-backdrop { position: absolute; inset: 0; background: rgba(27, 36, 49, 0.42); }
.push-prompt-card { position: relative; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); padding: 8px 18px calc(18px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; animation: plat-sheet-up .2s ease-out; }
.push-prompt-head { display: flex; gap: 12px; align-items: flex-start; }
.push-prompt-head h2 { font-size: 1.12rem; margin: 2px 0 4px; }
.push-prompt-head p { margin: 0; }
.push-prompt-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: #fff; }
.push-prompt-icon .icon { width: 22px; height: 22px; }
.push-variant { display: flex; flex-direction: column; gap: 8px; }
.push-variant[hidden] { display: none; }
.push-cta { min-height: 50px; font-size: 1rem; gap: 8px; }
.push-cta .icon { width: 18px; height: 18px; }
.push-note { margin: 0; text-align: center; }
.push-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.push-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; line-height: 1.4; }
.push-step-no { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 0.8rem; }
.push-glyph { display: inline-flex; vertical-align: -3px; color: var(--info); }
.push-glyph .icon { width: 18px; height: 18px; }
.push-help { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.push-msg { margin: 0; color: var(--ink-2); }
.push-msg:empty { display: none; }
.push-msg.is-success { color: var(--success-strong); }
.push-msg.is-danger { color: var(--danger); }
html.has-push-prompt, html.has-push-prompt body { overflow: hidden; }
@media (min-width: 700px) { .push-prompt { justify-content: center; align-items: center; } .push-prompt-card { width: min(440px, calc(100vw - 32px)); border-radius: var(--radius-lg); } }
.push-panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.push-panel-actions .btn[hidden] { display: none; }

/* --- profit on the lot page ---------------------------------------------------------------------------------- */
.profit-headline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.profit-headline > span { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius); background: var(--success-soft); }
.profit-headline small { color: var(--ink-2); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.profit-headline strong { font-size: 1.3rem; color: var(--success-strong); }
.profit-headline.is-loss > span { background: var(--danger-soft); }
.profit-headline.is-loss strong { color: var(--danger); }

/* --- takedowns -------------------------------------------------------------------------------------------- */
.takedown-date { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 54px; padding: 6px 6px 5px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); line-height: 1.1; }
.takedown-date strong { font-size: 0.92rem; white-space: nowrap; }
.takedown-date small { font-size: 0.68rem; opacity: 0.8; }
.takedown-date.is-warning { background: var(--warning-soft); color: var(--warning); }
.takedown-date.is-danger { background: var(--danger-soft); color: var(--danger); }
.takedown-date.is-muted { background: var(--neutral-soft); color: var(--ink-3); }
.takedown-date.is-big { min-width: 86px; padding: 10px; }
.takedown-date.is-big strong { font-size: 1.3rem; }
.takedown-hero { display: flex; gap: 16px; align-items: center; }
.takedown-amount { margin: 6px 0 0; font-size: 1.35rem; font-weight: 700; }
.takedown-amount small { font-size: 0.8rem; font-weight: 500; }

/* --- calendar ------------------------------------------------------------------------------------------------ */
.calendar-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.calendar-nav { display: flex; align-items: center; gap: 6px; }
.calendar-nav h2 { font-size: 1.15rem; min-width: 150px; text-align: center; }
.calendar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.calendar-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.82rem; font-weight: 600; color: var(--ink-3); background: var(--surface); text-decoration: none; }
.calendar-toggle.is-on { color: var(--ink); border-color: var(--border-strong); }
.calendar-toggle:not(.is-on) .agenda-dot { opacity: 0.35; }
.calendar-toggle:hover { text-decoration: none; }
.calendar-sub .select { height: 32px; font-size: 0.85rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-head { padding: 6px 8px; font-size: 0.72rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.calendar-day { min-height: 104px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calendar-day:nth-child(7n + 7) { border-right: 0; }
.calendar-day.is-other { background: var(--surface-2); }
.calendar-day.is-other .calendar-num { color: var(--ink-3); }
.calendar-num { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); align-self: flex-end; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.calendar-day.is-today .calendar-num { background: var(--primary); color: #fff; }
.calendar-chip { display: block; font-size: 0.72rem; line-height: 1.25; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: var(--primary-soft); border-left: 3px solid var(--primary); text-decoration: none; }
.calendar-chip:hover { text-decoration: none; filter: brightness(0.97); }
.calendar-more { font-size: 0.7rem; color: var(--ink-3); padding-left: 4px; }
/* one colour per kind; milestones take the plat map's recorded/sold colours for those two */
.is-task.calendar-chip { background: var(--warning-soft); border-left-color: var(--warning); }
.is-takedown.calendar-chip { background: #EFEAF8; border-left-color: #6B4FA0; }
.tone-recorded.calendar-chip { background: var(--success-soft); border-left-color: var(--success); }
.tone-closed.calendar-chip { background: var(--danger-soft); border-left-color: var(--danger); }
.agenda-dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.agenda-dot.is-task { background: var(--warning); }
.agenda-dot.is-takedown { background: #6B4FA0; }
.agenda-dot.tone-recorded { background: var(--success); }
.agenda-dot.tone-closed { background: var(--danger); }
.agenda { display: flex; flex-direction: column; }
.agenda-day { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.agenda-day:first-child { border-top: 0; }
.agenda-day.is-past { opacity: 0.72; }
.agenda-date { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 2px; }
.agenda-date strong { font-size: 1.3rem; line-height: 1; }
.agenda-date small { font-size: 0.72rem; color: var(--ink-3); text-transform: uppercase; }
.agenda-day.is-today .agenda-date strong { color: var(--primary); }
.agenda-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda-day li a { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); text-decoration: none; }
.agenda-day li a .agenda-dot { margin-top: 5px; }
.agenda-text { display: flex; flex-direction: column; min-width: 0; }
.agenda-text strong { font-size: 0.92rem; font-weight: 600; }
.agenda-text small { font-size: 0.78rem; color: var(--ink-3); }
.copy-row { display: flex; gap: 8px; margin-top: 4px; }
.copy-row .input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.8rem; }
/* phones read the month as the agenda; the grid is for wider screens */
@media (max-width: 699px) {
  .calendar-grid { display: none; }
  .calendar-bar { border-bottom: 0; }
  .calendar-nav h2 { min-width: 0; }
}

/* --- field photos on a lot ------------------------------------------------------------------------------------- */
.photo-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.photo-btn { cursor: pointer; gap: 6px; }
.photo-btn.is-busy { opacity: 0.6; pointer-events: none; }
.photo-status { flex-basis: 100%; margin: 0; }
.photo-status:empty { display: none; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-tile { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--neutral-soft); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-none { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--ink-3); }
.photo-date { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 0.7rem; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); }
@media (max-width: 699px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } .photo-btn { flex: 1 1 140px; justify-content: center; } }

/* --- two-step sign-in -------------------------------------------------------------------------------------------- */
.two-step-qr { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin: 14px 0; }
.two-step-qr-code { flex: none; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); line-height: 0; }
.two-step-qr-code svg { width: 196px; height: 196px; }
.two-step-qr > div:last-child { flex: 1 1 240px; min-width: 0; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin: 0; padding-left: 22px; font-size: 1.02rem; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
@media print { .recovery-codes { font-size: 14pt; } }

/* --- setup checklists (Settings → Turn on email) ------------------------------------------------------------------ */
.setup-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.setup-steps li.is-done { color: var(--ink-3); }
.setup-steps li.is-done::marker { content: "✓  "; color: var(--success); font-weight: 700; }
.setup-steps code { font-size: 0.82em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; word-break: break-all; }
/* the assistant's launcher floats bottom-right on phones: leave room so the last lines of a page can scroll clear of it */
@media (max-width: 699px) { body:has(.assistant-widget) .content { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 118px); } }
