/* Stone Surgeons CRM — Doors v3 styles (map pins, status strip, door card, territories, routes, stats).
   Loaded after app.css. Colours that come from data (status / rep colour) arrive as --c / --o / --p. */

/* subtabs scroll sideways on a phone instead of wrapping into three rows */
.door-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 0 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.door-tabs::-webkit-scrollbar { display: none; }
.door-tabs .tab.sub { white-space: nowrap; }

/* status chip: swatch + icon + label */
.st-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 45%, #fff); border-radius: 999px; padding: 1px 9px 1px 3px; vertical-align: middle; }
.st-chip i { font-style: normal; display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 800; padding: 0 3px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.prox-tag { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--c); border: 1px solid var(--c); border-radius: 999px; padding: 0 8px; }
.prox-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-left: 6px; vertical-align: middle; }

/* status buttons (sheet grid + Log tab) take their status colour */
.disp-btn, .door-btn { border-color: color-mix(in srgb, var(--c, #dde5ee) 45%, #fff); background: color-mix(in srgb, var(--c, #fff) 8%, #fff); }
.disp-btn.is-cur { box-shadow: inset 0 0 0 2px var(--c); }

/* ── map pins ── */
.pin-wrap { background: none; border: 0; }
.pin { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--o, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,.45); display: grid; place-items: center; cursor: pointer; }
.pin b { font-size: 13px; line-height: 1; color: #fff; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.pin.is-new { width: 22px; height: 22px; margin: 4px; background: #fff; border-color: #9aa3ad; border-style: dashed; }
.pin.is-cust { outline: 3px solid var(--ink); outline-offset: 1px; }
.pin-prox { position: absolute; right: -4px; bottom: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--p); border: 2px solid #fff; }
.pin em { position: absolute; top: 31px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.92); color: var(--ink); padding: 0 5px; border-radius: 6px; pointer-events: none; }
.pin-n { position: absolute; top: -8px; right: -9px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.clu { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; cursor: pointer;
  background: color-mix(in srgb, var(--c) 85%, #000); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 35%, transparent), 0 1px 4px rgba(0,0,0,.4); }
.terr-label { transform: translate(-50%, -50%); white-space: nowrap; border: 2px solid var(--c); background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.mate { width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; border: 3px solid #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; box-shadow: 0 1px 6px rgba(0,0,0,.45); }

/* ── controls inside the map ── */
.door-map .leaflet-bottom.leaflet-left { right: 0; }
.strip-wrap { margin: 0 8px 22px !important; max-width: calc(100% - 16px); }
.strip-hint { display: inline-block; font-size: 12px; font-weight: 700; color: var(--ink); background: rgba(255,255,255,.92); border-radius: 8px; padding: 2px 8px; margin: 0 0 6px; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.strip-btn { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 6px 6px 5px; border-radius: 12px;
  border: 2px solid #fff; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.3); cursor: pointer; color: var(--ink); }
.strip-btn span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; font-size: 15px; font-weight: 800; }
.strip-btn small { font-size: 11px; font-weight: 700; line-height: 1.1; max-width: 72px; text-align: center; }
.strip-btn.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, #fff); transform: translateY(-3px); }
.door-map.is-armed { outline: 3px solid var(--blue); outline-offset: -3px; cursor: crosshair; }
.door-map.is-freehand { touch-action: none; cursor: crosshair; }
.map-tools { display: flex; flex-direction: column; gap: 6px; }
.map-tool { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.3);
  font-size: 18px; color: var(--navy); cursor: pointer; display: grid; place-items: center; }
.map-tool.on { background: var(--blue); color: #fff; }
.map-tool .badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.route-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 8px 10px; box-shadow: 0 2px 10px rgba(0,0,0,.3); font-size: 14px; max-width: calc(100vw - 90px); }
.move-panel { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; width: max-content; max-width: calc(100% - 20px); }
.door-map.fs .move-panel { top: calc(10px + env(safe-area-inset-top)); }
.door-map.fs .leaflet-top { top: env(safe-area-inset-top); }
.door-map.fs .strip-wrap { margin-bottom: calc(22px + env(safe-area-inset-bottom)) !important; }

/* ── door card ── */
.card-head { margin: 0 0 10px; }
.card-when { font-size: 14px; margin: 4px 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.card-details { margin: 8px 0; border-top: 1px solid var(--line); padding-top: 8px; }
.card-details summary { cursor: pointer; font-weight: 700; color: var(--navy); margin: 0 0 8px; }
.door-addr3 { display: grid; grid-template-columns: 70px 70px 1fr; gap: 8px; margin: 0 0 8px; }
.door-hist { list-style: none; margin: 0; padding: 0; }
.door-hist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.stack-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: none; border: 0; padding: 10px 2px;
  font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.stack-row:hover { background: var(--off); }

/* ── filters, territories, routes, agenda, stats, feed, settings ── */
.f-chips { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.f-chip { color: var(--text); }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-3 .tile b { font-size: 24px; }
.pick-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.pick-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--text); width: 100%; }
.pick-row > span:first-of-type { flex: 1; }
.route-stops { margin: 10px 0 0; padding-left: 22px; }
.route-stops li { border-bottom: 1px solid var(--line); }
.agenda-btns { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
.delta { font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); }
.news-item p { margin: 6px 0 2px; white-space: pre-wrap; }
.st-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.st-row.is-arch { opacity: .55; }
.st-row1, .st-row2 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 6px; }
.st-row1 .in:last-child { flex: 1; min-width: 140px; }
.st-row2 select.in { width: auto; flex: 1 1 140px; }
.in-abbr { width: 64px; text-align: center; }
.in-color { width: 46px; height: 40px; padding: 2px; }
@media (max-width: 520px) {
  .tiles-3 .tile { padding: 10px; }
  .door-addr3 { grid-template-columns: 64px 64px 1fr; }
  .controls .in, .controls select { min-width: 0; }
}

/* ── full-screen map: pops out into its own layer (then browser full screen where allowed), like a video player ── */
.map-fs-layer { position: fixed; inset: 0; z-index: 1200; width: 100vw; height: 100vh; height: 100dvh; background: #0b2a4a;
  animation: fs-pop .18s ease-out; overscroll-behavior: contain; }
.map-fs-layer:fullscreen { width: 100%; height: 100%; }
.map-fs-layer:-webkit-full-screen { width: 100%; height: 100%; }
.map-fs-layer .door-map.fs { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; min-height: 0;
  border: 0; border-radius: 0; outline-offset: -3px; }
.map-fs-layer .toast { z-index: 1500; bottom: calc(110px + env(safe-area-inset-bottom)); }
.map-fs-layer .door-map.fs .leaflet-right { right: env(safe-area-inset-right); }
.map-fs-layer .door-map.fs .leaflet-left { left: env(safe-area-inset-left); }
@keyframes fs-pop { from { opacity: 0; transform: scale(.97); } }

/* route bar: across the top of the map, between the zoom buttons and the tool buttons */
.route-top { position: absolute; top: 10px; left: 54px; right: 62px; z-index: 1000; max-width: none; padding: 6px 8px; gap: 6px; }
.route-top strong { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.door-map.fs .route-top { top: calc(10px + env(safe-area-inset-top)); }
