:root {
  --bg: #f3f4f2; --surface: #fff; --ink: #1d2320; --muted: #5d6762; --line: #d8ddd9; --soft: #eef1ee;
  --accent: #2f6b3a; --accent-ink: #fff; --accent-soft: #e3efe5;
  --warn: #b26a00; --warn-soft: #fff3df; --danger: #b3261e; --danger-soft: #fbe9e7; --info: #24527a; --info-soft: #e5eef7;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px; --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816; --surface: #1d2320; --ink: #e8ece9; --muted: #9aa49f; --line: #2f3733; --soft: #252c28;
    --accent: #6fbf7d; --accent-ink: #0f1a12; --accent-soft: #233a28;
    --warn: #f0b354; --warn-soft: #3a2e17; --danger: #ff8a80; --danger-soft: #3b1f1d; --info: #8ab8e6; --info-soft: #1c2b3a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); letter-spacing: .01em; margin: 0; line-height: 1.1; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: .05em; }
h3 { font-size: 1.05rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 900; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.3rem; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .95rem; }
.topbar .spacer { flex: 1; }
.clockpill { font: 600 .82rem var(--body); border-radius: 999px; padding: 6px 12px; border: 1px solid var(--line); background: var(--soft); cursor: pointer; white-space: nowrap; }
.clockpill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 950; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav a { flex: 1; text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 600; padding: 4px 0; border-radius: 8px; }
.nav a svg { width: 22px; height: 22px; }
.nav a.active { color: var(--accent); }
@media (min-width: 900px) {
  .app { flex-direction: row; }
  .nav { position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; width: 92px; border-top: 0; border-right: 1px solid var(--line); padding: 16px 6px; gap: 4px; }
  .nav a { flex: 0; padding: 10px 0; font-size: .72rem; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  main { padding-bottom: 40px; }
}

/* building blocks */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel > h2 + * { margin-top: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.big { font-family: var(--display); font-size: 2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .92rem var(--body); padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 42px; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: .84rem; }
.btn.block { width: 100%; }
.btn.lg { font-size: 1.1rem; padding: 14px 18px; min-height: 54px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); min-height: 42px; }
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: .78rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 0; min-width: 64px; font: 600 .9rem var(--body); padding: 9px 8px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 .72rem var(--body); text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--info-soft); color: var(--info); }

.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--soft); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .right { text-align: right; flex-shrink: 0; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; }
.stat .big { margin-top: 6px; }

table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl input, .tbl select { padding: 6px; min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); width: 100%; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.totals { display: flex; flex-direction: column; gap: 4px; border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.totals .t { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--accent); }

/* map editor */
.fence-map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #cfd6d1; }
.fence-map { height: min(62vh, 560px); width: 100%; }
.fence-map-wrap.tall .fence-map { height: min(72vh, 680px); }
.map-tools { position: absolute; z-index: 800; left: 8px; right: 8px; top: 8px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.map-tools .btn { box-shadow: 0 1px 4px rgba(0,0,0,.25); background: #fff; color: #1d2320; border-color: #fff; }
.map-tools .btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.map-tools .btn.on { background: #1d2320; color: #fff; border-color: #1d2320; }
.map-search { display: flex; gap: 6px; flex: 1 1 260px; }
.map-search input { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); background: #fff; color: #1d2320; }
.map-hint { position: absolute; z-index: 800; left: 8px; right: 8px; bottom: 8px; background: rgba(20,24,22,.85); color: #fff; border-radius: 8px; padding: 8px 12px; font-size: .85rem; pointer-events: none; }
.seg-label { background: rgba(20,24,22,.85); color: #fff; font: 700 12px var(--body); padding: 2px 6px; border-radius: 4px; white-space: nowrap; border: 0; box-shadow: none; }
.leaflet-tooltip.seg-label::before { display: none; }
.vtx { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #1d2320; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.vtx.first { background: #ffd54f; }
.gate-pin { width: 26px; height: 26px; border-radius: 6px; background: #ffd54f; color: #1d2320; display: grid; place-items: center; font: 800 11px var(--body); border: 2px solid #1d2320; }
.runs-list .run { display: flex; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.runs-list .run.sel { background: var(--accent-soft); border-radius: 8px; }
.runs-list .swatch { width: 14px; height: 32px; border-radius: 4px; flex-shrink: 0; }

/* dialogs & toasts */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form, .dlg { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 2000; background: #1d2320; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

/* photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--soft); cursor: zoom-in; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos figcaption { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: .7rem; padding: 14px 6px 4px; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 82dvh; border-radius: 8px; }
.lightbox .cap { color: #fff; margin-top: 10px; text-align: center; }

.note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note .meta { font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.note p { margin: 4px 0 0; white-space: pre-wrap; }

/* clock */
.clock-card { text-align: center; padding: 28px 16px; }
.clock-card .timer { font-family: var(--display); font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; margin: 10px 0; }
.clock-btn { width: 100%; max-width: 360px; font: 700 1.3rem var(--display); letter-spacing: .04em; text-transform: uppercase; padding: 20px; border-radius: 14px; border: 0; cursor: pointer; }
.clock-btn.in { background: var(--accent); color: var(--accent-ink); }
.clock-btn.out { background: var(--danger); color: #fff; }

/* calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 140px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day .dh { font-size: .75rem; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.ev { font-size: .76rem; border-radius: 6px; padding: 4px 6px; cursor: pointer; text-decoration: none; display: block; line-height: 1.25; }
.ev.assess { background: var(--info-soft); color: var(--info); }
.ev.job { background: var(--accent-soft); color: var(--accent); }
.ev b { display: block; }
@media (max-width: 760px) {
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: 0; }
}

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: min(400px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.pin { letter-spacing: .4em; font-size: 1.4rem !important; text-align: center; }

.callout { border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.info { background: var(--info-soft); color: var(--info); }
.callout.green { background: var(--accent-soft); color: var(--accent); }

.loadout h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--body); margin: 12px 0 2px; }
.lo-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.lo-row .q { font-family: var(--display); font-size: 1.3rem; font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.lo-row .q small { font-family: var(--body); font-size: .7rem; color: var(--muted); margin-left: 3px; font-weight: 500; }

@media print {
  .nav, .topbar, .no-print, .map-tools, .map-hint { display: none !important; }
  main { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
  body { background: #fff; color: #000; }
}
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
@media (max-width: 420px) { .brand { font-size: 1.1rem; } }

/* ===== Brighter theme ===== */
:root {
  --bg: #f6faf7; --surface: #ffffff; --ink: #17241c; --muted: #5a6b61; --line: #dfe8e2; --soft: #eef6f0;
  --accent: #23893f; --accent-ink: #fff; --accent-soft: #e2f4e6;
  --sun: #f5b82e; --sun-soft: #fff6dc; --sky: #2f7fd1; --sky-soft: #e6f1fc; --wood: #c47a35; --wood-soft: #fbeee1;
  --info: #2f7fd1; --info-soft: #e6f1fc; --warn: #b36b00; --warn-soft: #fff3d9;
  --shadow: 0 1px 2px rgba(23,36,28,.05), 0 4px 14px rgba(23,36,28,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111814; --surface: #1a231e; --ink: #e9f1ec; --muted: #9fb0a6; --line: #2b3830; --soft: #213029;
    --accent: #5fcf7a; --accent-ink: #0d1a11; --accent-soft: #1f3a27;
    --sun: #f5c454; --sun-soft: #3a3016; --sky: #79b4ef; --sky-soft: #1a2c3e; --wood: #e09a5a; --wood-soft: #3a2a1b;
    --info: #79b4ef; --info-soft: #1a2c3e; --shadow: none;
  }
}
body { background: var(--bg); }
.topbar { background: linear-gradient(100deg, #1d7a37 0%, #2a9a49 55%, #3cae5a 100%); border-bottom: 0; color: #fff; box-shadow: 0 2px 10px rgba(29,122,55,.25); }
.topbar .brand { color: #fff; }
.topbar .brand .mark { background: #fff; color: #1d7a37; }
.topbar .btn { background: rgba(255,255,255,.95); color: #1d7a37; border-color: transparent; }
.clockpill { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); }
.clockpill.on { background: var(--sun); color: #2b2100; border-color: var(--sun); }
.brand .logo { height: 36px; width: auto; max-width: 140px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px 6px; }
.login .brand .logo { background: none; padding: 0; height: 48px; }
.panel { box-shadow: var(--shadow); border-color: var(--line); border-radius: 14px; }
.panel h2 { color: var(--accent); }
.stat { box-shadow: var(--shadow); border-radius: 14px; border-top: 4px solid var(--accent); }
.stats .stat:nth-child(2) { border-top-color: var(--sun); }
.stats .stat:nth-child(3) { border-top-color: var(--sky); }
.stats .stat:nth-child(4) { border-top-color: var(--wood); }
.btn { border-radius: 10px; }
.btn.primary { box-shadow: 0 2px 6px rgba(35,137,63,.3); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav { box-shadow: 0 -2px 10px rgba(23,36,28,.06); }
@media (min-width: 900px) { .nav { background: var(--surface); } }
.item:hover { background: var(--soft); border-radius: 8px; }
.badge.blue { background: var(--sky-soft); color: var(--sky); }
.callout.green { border-left: 4px solid var(--accent); }
.callout.info { border-left: 4px solid var(--sky); }
.callout.warn { border-left: 4px solid var(--sun); background: var(--sun-soft); }
.page-head h1 { color: var(--ink); }
.totals .grand { color: var(--accent); }
.login { background: radial-gradient(circle at 20% 0%, #d9f2df 0%, var(--bg) 55%); }

/* logo + photos */
.logo-row { gap: 16px; align-items: center; }
.logo-box { width: 140px; height: 80px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--soft); overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-btn { position: relative; width: 52px; height: 40px; border-radius: 8px; border: 1px dashed var(--line); background: var(--soft); cursor: pointer; overflow: hidden; padding: 0; font-size: .68rem; color: var(--muted); }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn .dot-desc { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); border: 1px solid #fff; }
.photo-drop { min-height: 160px; border-radius: 12px; border: 2px dashed var(--line); background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.photo-drop img { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.style-preview { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.style-preview:empty { display: none; }
.style-preview img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.showcase { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.show-card { margin: 0; border-radius: 12px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.show-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.show-card figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; }
.show-card figcaption span { color: var(--muted); }
.print-only { display: none; }
.drawing-pic { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
@media print { .print-only { display: block !important; } .drawing-pic { break-inside: avoid; } }
.fence-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .fence-picker:not(.compact) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fence-picker .label { color: var(--accent); }
.about-pic { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; margin-top: 10px; }
.layout-pic img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.pick-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--soft); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.pick-grid > div > div { font-weight: 600; }
.change-cta { border: 2px dashed var(--accent); background: var(--accent-soft); text-align: center; }
.change-cta .btn { width: 100%; max-width: 340px; }
.ac-list { position: absolute; z-index: 1200; left: 0; right: 0; top: calc(100% + 4px); background: #fff; color: #17241c; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); overflow: hidden; }
.ac-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; font: 500 .9rem var(--body); cursor: pointer; border-bottom: 1px solid #eef2ef; }
.ac-list button:hover { background: #eef6f0; }
.ac-list:empty { display: none; }
.wx { display: grid; grid-template-columns: 34px 1fr; gap: 2px 6px; align-items: center; background: var(--sky-soft); border-radius: 6px; padding: 4px; font-size: .75rem; }
.wx img { width: 34px; height: 34px; border-radius: 6px; grid-row: span 2; }
.wx b { font-size: .9rem; }
.wx span { color: var(--muted); }
.wx .wx-short { grid-column: 1 / -1; color: var(--muted); line-height: 1.2; }
.wx-pop { font-size: .7rem; color: var(--sky); font-weight: 600; }
.wx.maybe { background: var(--sun-soft); }
.wx.wet { background: var(--warn-soft); outline: 1px solid var(--sun); }
.wx-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.wx-mini { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--sky-soft); border-radius: 8px; padding: 6px 2px; }
.wx-mini img { width: 32px; height: 32px; border-radius: 6px; }
.wx-mini.maybe { background: var(--sun-soft); }
.wx-mini.wet { background: var(--warn-soft); }
.fence-map-wrap.locked [data-act="draw"], .fence-map-wrap.locked [data-act="gate"], .fence-map-wrap.locked [data-act="undo"], .fence-map-wrap.locked [data-act="finish"] { display: none; }
.run-num { width: 24px; height: 24px; border-radius: 50%; color: #fff; border: 2px solid #fff; display: grid; place-items: center; font: 800 12px var(--body); box-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* ===== customer change flow ===== */
.cta-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .cta-choices { grid-template-columns: minmax(0, 1fr); } }
.cta-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 12px; border-radius: 14px; border: 2px solid var(--accent); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; text-align: center; }
.cta-choice:hover { background: var(--accent-soft); }
.cta-choice .ic { font-size: 1.8rem; line-height: 1; }
.cta-choice b { font-size: 1.05rem; color: var(--accent); }
.cta-choice span:last-child { font-size: .85rem; color: var(--muted); }
.change-cta { text-align: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button { border: 0; background: none; padding: 12px 8px; border-radius: 9px; font: 700 .95rem var(--body); color: var(--muted); cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.opt-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.run-num.inline { display: inline-grid; width: 22px; height: 22px; font-size: 11px; vertical-align: middle; margin-right: 6px; flex-shrink: 0; }
.how-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .how-grid { grid-template-columns: minmax(0, 1fr); } }
.how { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: 10px; }
.how .ic { font-size: 1.3rem; }
.how div { display: flex; flex-direction: column; font-size: .85rem; }
.how div span { color: var(--muted); }
.mode-banner { display: flex; flex-direction: column; gap: 6px; background: var(--sun-soft); border: 2px solid var(--sun); border-radius: 12px; padding: 12px; }
.mode-banner .btn { align-self: flex-start; }
.sel-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--sky-soft); border: 1px solid var(--sky); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.save-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.12); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.sb-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sb-total { display: flex; flex-direction: column; line-height: 1.15; }
.sb-total b { font-family: var(--display); font-size: 1.6rem; color: var(--accent); }
.save-bar .btn.lg { min-height: 50px; padding: 12px 18px; }
body.editing main { padding-bottom: 110px; }
.fence-map-wrap.no-tools [data-act="draw"], .fence-map-wrap.no-tools [data-act="gate"], .fence-map-wrap.no-tools [data-act="undo"] { display: none; }
.fence-map-wrap.short .fence-map { height: 260px; }
.fence-map-wrap [data-act="finish"] { font-size: 1rem; padding: 10px 16px; }
.financing { display: flex; flex-direction: column; gap: 12px; border: 2px solid var(--sky); background: linear-gradient(135deg, var(--sky-soft), var(--surface)); }
.financing .fin-head { display: flex; gap: 12px; align-items: flex-start; }
.financing .fin-ic { font-size: 2rem; line-height: 1; }
.financing h2 { color: var(--sky) !important; }
.financing .btn.primary { background: var(--sky); border-color: var(--sky); box-shadow: none; }

/* ---- month calendar ---- */
.cal-view { flex: 0 0 auto; }
.cal-view button { flex: 0 0 auto; min-width: 70px; }
.month .mh { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.month .mh span { padding: 0 4px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mday { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mday.out { opacity: .45; }
.mday.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mday .mnum { all: unset; cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--muted); padding: 1px 3px; border-radius: 4px; align-self: flex-start; }
.mday.today .mnum { background: var(--accent); color: var(--accent-ink); }
.mday .mnum:hover { background: var(--soft); }
.mday .ev { font-size: .7rem; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mday .more { all: unset; cursor: pointer; font-size: .7rem; font-weight: 600; color: var(--accent); padding: 0 4px; }
.mdots { display: none; gap: 3px; flex-wrap: wrap; padding: 0 3px; }
.mdots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.mdots i.assess { background: var(--info); }
.mdots i.job { background: var(--accent); }
@media (max-width: 700px) {
  .mday { min-height: 56px; padding: 3px; }
  .mday .ev, .mday .more { display: none; }
  .mdots { display: flex; }
  .month .mh span { padding: 0; text-align: center; font-size: .65rem; }
  .mday .mnum { align-self: center; }
}

.edit-hist summary { cursor: pointer; }
.edit-hist div { margin: 2px 0 0 10px; }

/* ---- photo galleries ---- */
.thumb-btn .ph-n { position: absolute; bottom: 2px; right: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: .62rem; border-radius: 6px; padding: 0 4px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.ph-cell { position: relative; margin: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--soft); }
.ph-cell.cover { border-color: var(--accent); }
.ph-cell img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.ph-tag, .ph-btn { position: absolute; left: 4px; bottom: 4px; font: 600 .68rem var(--body); border-radius: 6px; padding: 2px 6px; border: 0; }
.ph-tag { background: var(--accent); color: var(--accent-ink); }
.ph-btn { background: rgba(255,255,255,.92); color: var(--ink, #17241c); cursor: pointer; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: .75rem; line-height: 1; }

.gal { display: flex; flex-direction: column; gap: 6px; }
.gal-main { all: unset; cursor: zoom-in; position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--soft); }
.gal-main img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.gal-count { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font: 600 .75rem var(--body); padding: 3px 8px; border-radius: 999px; }
.gal-thumbs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.gal-thumbs button { all: unset; cursor: pointer; flex: 0 0 64px; height: 48px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.gal-thumbs button[aria-current="true"] { border-color: var(--accent); }
.gal-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-desc { font-size: .88rem; color: var(--muted); white-space: pre-wrap; margin: 0; }

.glb { position: fixed; inset: 0; z-index: 3000; background: rgba(10,14,12,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; touch-action: pan-y; }
.glb img { max-width: 100%; max-height: 78dvh; border-radius: 8px; user-select: none; }
.glb .glb-cap { color: #fff; margin-top: 10px; text-align: center; font-size: .95rem; }
.glb .glb-cap span { opacity: .7; font-size: .85rem; }
.glb button { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }
.glb button:hover { background: rgba(255,255,255,.26); }
.glb .glb-x { top: 14px; right: 14px; }
.glb .glb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.glb .glb-next { right: 14px; top: 50%; transform: translateY(-50%); }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.rel-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.rel-card .gal-main { border-radius: 0; }
.rel-card .gal-main img { aspect-ratio: 4/3; }
.rel-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rel-body p { margin: 0; font-size: .84rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rel-body .rel-tag { font: 600 .7rem var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.rel-body .btn { margin-top: auto; }
.pick-card .gal-main img { max-height: 360px; }
@media (max-width: 700px) {
  .related { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .related::-webkit-scrollbar { display: none; }
  .rel-card { flex: 0 0 72%; scroll-snap-align: start; }
  .pick-card .gal-main img { max-height: 240px; }
}

/* Fence / Deck drawing toggle */
.kind-seg { display: inline-flex; border-radius: 999px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); padding: 3px; gap: 2px; }
.kind-seg button { border: 0; background: transparent; color: #1d2320; font: 700 13px var(--body); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 32px; }
.kind-seg button.on { background: #1d2320; color: #fff; }
.fence-map-wrap.kind-fence .k-deck, .fence-map-wrap.kind-deck .k-fence { display: none; }
.fence-map-wrap.locked .kind-seg, .fence-map-wrap.locked [data-act="deck"], .fence-map-wrap.locked [data-act="house"], .fence-map-wrap.locked [data-act="nohouse"] { display: none; }
.fence-map-wrap.no-tools .kind-seg, .fence-map-wrap.no-tools [data-act="deck"], .fence-map-wrap.no-tools [data-act="house"] { display: none; }
.vtx.deck { border-color: #6b3f1d; }
.seg-label.deck-label { background: rgba(107,63,29,.92); font-size: 13px; }
.seg-label.house-label { background: #1d2320; letter-spacing: .04em; text-transform: uppercase; font-size: 11px; }
.deck-framing { font-size: .85rem; line-height: 1.45; background: var(--soft); border-radius: 8px; padding: 8px 10px; }
.deck-framing b { font-weight: 600; }
.deck-row.sel { outline: 2px solid #a1683a; outline-offset: 6px; border-radius: 6px; }
/* AI renderings on quote deck rows */
.render-thumb { position: relative; display: block; width: 132px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); flex-shrink: 0; }
.render-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.render-thumb > span:last-child { position: absolute; left: 4px; bottom: 4px; background: rgba(20,24,22,.82); color: #fff; font: 700 11px var(--body); padding: 2px 6px; border-radius: 4px; }
.render-thumb.new { border: 2px solid var(--accent); }
.render-thumb.wait { display: grid; place-items: center; text-align: center; }
.render-thumb.wait > span:last-child { position: static; background: none; color: var(--muted); font-weight: 600; }
.render-thumb .spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rspin 0.9s linear infinite; }
@keyframes rspin { to { transform: rotate(360deg); } }
.render-hero { position: relative; border-radius: 10px; overflow: hidden; }
.render-hero img { width: 100%; display: block; }
.render-hero .tag { position: absolute; left: 8px; top: 8px; background: rgba(20,24,22,.85); color: #fff; font: 700 12px var(--body); padding: 3px 8px; border-radius: 999px; }
.render-before { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.render-before img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.render-note { margin-top: 8px; padding: 8px 10px; background: #fff8e6; border: 1px solid #f1dfae; border-radius: 8px; font-size: .8rem; color: #5a4a1a; line-height: 1.4; }
@media (prefers-color-scheme: dark) { .render-note { background: #3a321c; border-color: #5a4c26; color: #f1e3b8; } }
/* Missouri 811 tickets on a job */
.dig-ticket { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.dig-ticket.warn { border-left-color: #d9911c; }
.dig-ticket.bad { border-left-color: #c0392b; }
.dig-sum { font-weight: 600; margin: 2px 0 4px; }
.dig-ticket.bad .dig-sum { color: #c0392b; }
.dig-utils { margin-top: 6px; display: grid; gap: 2px; }
.dig-u { display: flex; gap: 8px; align-items: center; font-size: .85rem; padding: 3px 0; border-top: 1px solid var(--line); }
.dig-u .ic { width: 20px; text-align: center; }
.dig-u .st { font-weight: 600; white-space: nowrap; }
.dig-u.marked .st { color: #c2410c; }
.dig-u.clear .st { color: var(--accent); }
.dig-u.pending .st, .dig-u.other .st { color: #b45309; }

/* ---------- Good / Better / Best tiles (customer quote) ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tier { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tier:hover { border-color: var(--accent); }
.tier:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tier.on { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,.10); background: var(--accent-soft); }
.tier-tag { align-self: flex-start; font: 700 .72rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.tier-good .tier-tag { background: #e8f1fb; color: #24527a; }
.tier-better .tier-tag { background: #fbefe2; color: #8a4b12; }
.tier-best .tier-tag { background: #1d2320; color: #f3d27a; }
.tier.on .tier-tag { box-shadow: 0 0 0 1px currentColor inset; }
.tier-pic { display: block; margin: 6px 0 4px; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--soft); }
.tier-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tier-pic-blank { opacity: .35; }
.tier-name { font-size: 1.05rem; }
.tier-sub { font-size: .82rem; color: var(--muted); min-height: 1.1em; }
.tier-price { font-weight: 700; font-size: 1.1rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tier-diff { font-size: .8rem; color: var(--muted); }
.tier-check { position: absolute; top: 10px; right: 10px; font-size: .75rem; font-weight: 700; color: var(--accent); }
.tier-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.tier-detail:not(:has(.tier-detail-pics)) { grid-template-columns: 1fr; }
.tier-detail-pics .gal-main img { max-height: 300px; }
.tier-inc { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 5px; }
.tier-inc li { padding-left: 24px; position: relative; }
.tier-inc li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
@media (max-width: 640px) {
  .tiers { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
  .tiers::-webkit-scrollbar { display: none; }
  .tier { flex: 0 0 46%; scroll-snap-align: start; }
  .tier-detail { grid-template-columns: 1fr; }
}

/* website lead bell + lead cards */
.leadbell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; color: inherit; background: rgba(255,255,255,.14); margin-right: 8px; }
.leadbell svg { width: 22px; height: 22px; }
.leadbell:hover { background: rgba(255,255,255,.24); }
.leadcount { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font: 700 .72rem/20px var(--body); text-align: center; box-shadow: 0 0 0 2px rgba(0,0,0,.15); animation: leadpulse 2s ease-in-out infinite; }
.leadcount[hidden] { display: none; }
@keyframes leadpulse { 50% { transform: scale(1.12); } }
.lead { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.lead.new { border-left-color: var(--warn); }
.lead.contacted { border-left-color: var(--info); }
.lead.scheduled { border-left-color: var(--accent); }
.lead.dismissed { opacity: .65; }
.lead .title { font-weight: 700; font-size: 1.05rem; }
.lead .sub { color: var(--muted); font-size: .9rem; }
.lead-msg { margin: 0; padding: 10px 12px; background: var(--soft); border-radius: 8px; white-space: pre-wrap; }
.lead-meta { display: grid; gap: 4px; font-size: .9rem; }
.lead-meta span:first-child { display: inline-block; min-width: 140px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 600px) { .lead-meta span:first-child { display: block; min-width: 0; } }
