/* Stone Surgeons CRM — Doors: the new map app (Nov 16 2026). Shell + top bar, floating map buttons, the Lead Menu strip,
   the pin card, the long-press wheel, a pin's full screen (Info / Files / Forms / Activity), the Street / Leads / Customers
   tabs. Loaded after doors.css. Surfaces use --dg-panel / --dg-soft / --dg-ink so dark mode is one override (glass-dark.css).
   Colours that come from data (a status, a rep) are drawn into the pin images by doors-pin.js, not here. */

/* ── the frame ── */
#main.dg-main { width: 100%; min-width: 0; max-width: none; box-sizing: border-box; padding: 8px 12px 0; }   /* main is centred with auto margins inside a column flex box, which shrinks it to its content */
.dg-shell { --dg-panel: #fff; --dg-soft: #f1f4f8; --dg-ink: var(--ink); --dg-accent: var(--blue); --dg-b: 0px;
  position: relative; display: flex; flex-direction: column; min-height: 340px; overflow: hidden; background: var(--dg-panel); color: var(--dg-ink);
  border: 1px solid var(--line); border-radius: 14px; }
.dg-shell.is-fs { position: fixed; inset: 0; z-index: 1200; width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; background: var(--dg-panel);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); display: flex; }
.dg-shell .offline-bar { margin: 0; border-radius: 0; }
@media (max-width: 760px) {
  #main.dg-main { padding: 0; }
  .dg-shell { border: 0; border-radius: 0; }
}
@media (max-width: 430px) {
  .dg-top { gap: 2px; padding: 6px 4px; }
  .dg-top-btn { width: 36px; }
  .dg-top .dg-seg-b { flex: 1 1 auto; font-size: 12.5px; padding: 8px 5px; letter-spacing: -.01em; }
  .dg-menu-head .dg-hint { font-size: 11px; line-height: 1.2; }
}
.dg-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* top bar: Filters · Map / Street / Leads / Customers · + · More */
.dg-top { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 7px 6px; background: var(--dg-panel); border-bottom: 1px solid var(--line); }
.dg-top-btn { position: relative; flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px;
  background: none; color: var(--dg-accent); cursor: pointer; }
.dg-top-btn:hover, .dg-icon-btn:hover { background: var(--dg-soft); }
.dg-top-btn .badge { position: absolute; top: 1px; right: -1px; }
.dg-seg { flex: 1 1 auto; min-width: 0; display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--dg-soft); }
.dg-seg-b { flex: 1 1 0; min-width: 0; padding: 7px 3px; border: 0; border-radius: 7px; background: none; color: var(--dg-ink); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.dg-seg-b.on { background: var(--dg-panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.sheet .dg-seg { margin: 0 0 12px; }

/* ── the map ── */
.dg-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dg-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
.dg-map { position: absolute; inset: 0; background: #e8e6df; }
.dg-map.is-armed .maplibregl-canvas { cursor: crosshair; }
.dg-map .maplibregl-ctrl-bottom-left { bottom: var(--dg-b); transition: bottom .15s; }
.dg-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; margin: 0; background: var(--dg-soft); color: var(--muted); }
.dg-ctl { position: absolute; top: 10px; z-index: 4; display: flex; flex-direction: column; gap: 8px; }
.dg-left { left: 10px; }
.dg-right { right: 10px; }
.dg-tool { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: var(--dg-panel); color: var(--dg-accent);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .32); cursor: pointer; }
.dg-tool.on { background: var(--dg-accent); color: #fff; }
.dg-tool.is-busy { opacity: .55; }
.dg-compass { border-radius: 50%; }
.dg-needle { position: relative; width: 30px; height: 30px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--dg-ink); }
.dg-needle i { position: absolute; top: -3px; left: 50%; margin-left: -4px; border: 4px solid transparent; border-top: 0; border-bottom: 7px solid #d7261e; }
.plan-form .controls { margin: 8px 0; } .plan-proof { margin-top: 12px; } .plan-teams { margin: 6px 0 10px; padding-left: 18px; } .plan-teams li { margin: 3px 0; font-size: 14px; }
.plan-tbl td, .plan-tbl th { font-size: 13px; white-space: nowrap; } .plan-tbl tr.is-pick td { font-weight: 700; }
.dg-map.is-freehand { touch-action: none; } .dg-map.is-freehand .maplibregl-canvas { cursor: crosshair; }
.dg-panel { z-index: 6; top: 10px; } .dg-shell.is-fs .dg-panel { top: calc(10px + env(safe-area-inset-top)); }
.dg-banner { position: absolute; top: 10px; left: 62px; right: 62px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 8px 10px; border-radius: 10px; background: var(--dg-panel); box-shadow: 0 1px 6px rgba(0, 0, 0, .3); font-size: 14px; }
.dg-ghost { opacity: .6; pointer-events: none; }
.dg-move-pin { cursor: grab; }
.dg-terr-label { pointer-events: none; }

/* ── bottom: the Lead Menu, or a card ── */
.dg-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.dg-bottom > * { pointer-events: auto; width: 100%; max-width: 640px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--dg-panel); color: var(--dg-ink);
  border-radius: 16px 16px 0 0; box-shadow: 0 -4px 18px rgba(0, 0, 0, .22); }
.dg-menu-head { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.dg-menu-head b { font-size: 17px; white-space: nowrap; }
.dg-hint { flex: 1; min-width: 0; margin: 0; font-size: 12px; color: var(--muted); }
.dg-names { flex: 0 0 auto; border: 0; background: none; color: var(--dg-accent); font-size: 13px; font-weight: 700; padding: 6px 4px; cursor: pointer; }
.dg-x { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1.5px solid currentColor; border-radius: 50%; background: none; color: var(--dg-ink); cursor: pointer; }
.dg-x .dg-ico { width: 14px; height: 14px; stroke-width: 2.6; }
.dg-strip { display: flex; gap: 4px; overflow-x: auto; padding: 5px 4px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.dg-strip::-webkit-scrollbar { display: none; }
.dg-st { flex: 0 0 auto; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 3px 0 0; border: 0; background: none; color: var(--dg-ink); cursor: pointer; }
.dg-st img { display: block; width: 44px; height: 44px; border-radius: 50%; }
.dg-st small { font-size: 12px; line-height: 1.1; white-space: nowrap; }
.dg-st.is-cur img { box-shadow: 0 0 0 2px var(--dg-panel), 0 0 0 4px var(--dg-ink); }
.dg-st.is-armed img { box-shadow: 0 0 0 3px var(--dg-panel), 0 0 0 6px #f39a0b; }
.dg-strip.is-full { flex-direction: column; gap: 2px; max-height: 44vh; overflow: hidden auto; }
.dg-strip.is-full .dg-st { width: auto; flex-direction: row; gap: 12px; padding: 5px 4px; text-align: left; border-radius: 10px; }
.dg-strip.is-full .dg-st.is-armed { background: var(--dg-soft); }
.dg-st-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.dg-st-txt b { font-size: 15px; }
.dg-st-txt small { font-size: 12px; color: var(--muted); white-space: normal; }

.dg-grab { display: block; width: 100%; height: 16px; margin: -8px 0 2px; padding: 0; border: 0; background: none; cursor: pointer; }
.dg-grab i { display: block; width: 38px; height: 4px; margin: 5px auto 0; border-radius: 2px; background: #b9c1cc; }
.dg-card-head { display: flex; align-items: center; gap: 10px; }
.dg-badge { flex: 0 0 auto; display: block; border-radius: 50%; }
.dg-card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dg-card-who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-card-who span { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-link { flex: 0 0 auto; padding: 6px 2px; border: 0; background: none; color: var(--dg-accent); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.dg-card-addr { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dg-card-addr > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.3; }
.dg-card-addr > div > span:first-child { font-size: 19px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }   /* the street: read out at the door */
/* the address panel on logging sheets and on the pin's Info tab (doors-card.js D.addrPanel) */
.da { margin: 0 0 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(127, 140, 160, .12); }
.dg-sec .da { margin: 4px 0 0; }
.da-read { display: flex; align-items: center; gap: 10px; }
.da-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.da-1 { font-size: 23px; font-weight: 800; overflow-wrap: anywhere; }
.da-1.is-none { font-size: 17px; font-weight: 700; opacity: .75; }
.da-2 { margin-top: 2px; font-size: 14px; opacity: .8; }
.da-fix { flex: 0 0 auto; min-height: 42px; padding: 8px 12px; border: 1.5px solid currentColor; border-radius: 10px; background: none; color: var(--dg-accent, var(--blue));
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.da-edit { display: grid; gap: 8px; margin-top: 10px; }
.da-edit[hidden] { display: none; }
.da-st { display: grid; grid-template-columns: 76px 1fr 78px; gap: 8px; }
.da-city { display: grid; grid-template-columns: 1fr 64px 116px; gap: 8px; }
.da-edit .btn { justify-self: start; }
.da-note { margin: 8px 0 0; font-size: 13px; }
.dg-icon-btn { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--dg-ink);
  text-decoration: none; cursor: pointer; }
.dg-danger { color: var(--err); }
.dg-card-more { max-height: 38vh; overflow-y: auto; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dg-row { display: flex; gap: 10px; margin: 0 0 6px; font-size: 14px; }
.dg-row b { flex: 0 0 36%; font-weight: 600; }
.dg-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dg-act { min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: none; color: var(--dg-ink); text-decoration: none; cursor: pointer; }
.dg-act small { font-size: 11px; font-weight: 600; }
.dg-lead-dot { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 6px solid #1f6fd0; background: #fff; }
.dg-lead-dot.is-won { border-color: #d7261e; }

/* long-press wheel */
.dg-radial { position: absolute; inset: 0; z-index: 8; background: rgba(7, 26, 46, .3); }
.dg-radial-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, .4); }
.dg-radial-b { position: absolute; width: 54px; margin: -27px 0 0 -27px; display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; cursor: pointer;
  animation: dg-pop .16s ease-out both; animation-delay: calc(var(--i) * 10ms); }
.dg-radial-b img { display: block; border-radius: 50%; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.dg-radial-b small { font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
@keyframes dg-pop { from { transform: scale(.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dg-radial-b { animation: none; } .dg-map .maplibregl-ctrl-bottom-left { transition: none; } }

/* ── a pin's full screen ── */
.dg-edit { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--dg-soft); color: var(--dg-ink); }
.dg-shell.is-fs .dg-edit { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.dg-edit-top { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; padding: 7px 6px; background: var(--dg-panel); border-bottom: 1px solid var(--line); }
.dg-edit-top .dg-icon-btn { color: var(--dg-accent); }
.dg-edit-top .dg-danger { color: var(--err); }
.dg-saved { position: absolute; top: 62px; right: 12px; z-index: 2; padding: 2px 10px; border-radius: 999px; background: var(--dg-panel); color: var(--ok); font-size: 12px; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.dg-saved:empty { display: none; }
.dg-edit-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.dg-sec { padding: 0 14px 12px; background: var(--dg-panel); }
.dg-sec > h3 { margin: 0 -14px 8px; padding: 14px 14px 6px; background: var(--dg-soft); color: var(--muted); font: 600 12px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; }
.dg-sec .in { width: 100%; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.dg-sec .in:focus { border-bottom-color: var(--dg-accent); outline: 0; box-shadow: 0 1px 0 var(--dg-accent); }
.dg-sec textarea.in, .dg-sec select.in { padding: 10px; border: 0; border-radius: 8px; background: var(--dg-soft); }
.dg-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dg-addr { display: flex; align-items: center; gap: 8px; }
.dg-addr .in:nth-of-type(1) { flex: 0 0 68px; }
.dg-addr .in:nth-of-type(2) { flex: 1 1 auto; min-width: 0; }
.dg-addr .in:nth-of-type(3) { flex: 0 0 88px; }
.dg-city { display: grid; grid-template-columns: 1.4fr .6fr .8fr 1fr; gap: 8px; }
.dg-rounds { display: flex; justify-content: space-between; padding: 6px 10px 10px; }
.dg-round { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--dg-accent); color: #fff; }
.dg-round.is-off { background: #c5ccd6; }
.dg-line { display: flex; align-items: center; gap: 10px; margin: 0; padding: 4px 0; font-size: 15px; }
.dg-line > span:first-child { flex: 0 0 auto; color: var(--muted); }
.dg-line select.in { flex: 1; }
.dg-cur { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-weight: 600; }
.dg-when { display: flex; align-items: center; gap: 6px; }
.dg-when .in { color: var(--dg-accent); font-weight: 700; }
.dg-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.dg-meta dt { color: var(--muted); }
.dg-meta dd { margin: 0; overflow-wrap: anywhere; }
.dg-linked { margin: 10px 0 0; font-size: 14px; }
.dg-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.dg-file { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--dg-panel); }
.dg-file img { display: block; width: 100%; height: 110px; object-fit: cover; }
.dg-file-doc { display: grid; place-items: center; height: 110px; background: var(--dg-soft); font-weight: 700; text-decoration: none; }
.dg-file figcaption { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 12px; overflow-wrap: anywhere; }
.dg-act-list { list-style: none; margin: 0; padding: 0; }
.dg-act-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dg-act-list li p { margin: 4px 0 0; font-size: 14px; }
.dg-act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dg-act-list small { display: flex; align-items: center; gap: 10px; margin-top: 3px; color: var(--muted); }

/* ── Leads / Customers lists ── */
.dg-lists { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); }
.dg-list-top { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dg-count { margin: 8px 2px; }
.dg-list { list-style: none; margin: 0; padding: 0; }
.dg-list > li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.dg-list > li.empty { display: block; padding: 18px 4px; }
.dg-list-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 2px; border: 0; background: none; color: var(--dg-ink); text-align: left; text-decoration: none; cursor: pointer; }
.dg-list-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dg-list-main b, .dg-list-main span, .dg-list-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-list-main span { font-size: 14px; }
.dg-list-main small { font-size: 12px; color: var(--muted); }
.dg-list-h { margin: 18px 2px 6px; font-size: 15px; }

/* ── Street ── */
.dg-street { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dg-street-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.dg-street-at { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-street-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #d5dae1; }
.dg-street-note { margin: 0; padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted); text-align: center; }
.dg-street-msg { display: grid; gap: 10px; max-width: 420px; margin: auto; padding: 24px 18px; text-align: center; }
.dg-street-msg h3, .dg-street-msg p { margin: 0; }

/* ── sheets ── */
.dg-fchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.dg-fchip { width: 54px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border: 2px solid transparent; border-radius: 10px; background: none; color: var(--dg-ink, var(--ink)); cursor: pointer; }
.dg-fchip.on { border-color: var(--blue); background: rgba(31, 111, 208, .1); }
.dg-fchip small { font-size: 11px; font-weight: 700; }
.dg-results { display: grid; gap: 4px; margin: 8px 0; }
.dg-result { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; }
.dg-result span { font-size: 12px; color: var(--muted); }
.dg-chk { display: flex; margin: 12px 0; }
.dg-more { display: grid; gap: 8px; }
.steps { margin: 8px 0 14px; padding-left: 20px; display: grid; gap: 6px; }

/* phones held sideways: the drawer takes less of the short screen */
@media (orientation: landscape) and (max-height: 480px) {
  .dg-bottom > * { max-width: 520px; padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .dg-st img { width: 38px; height: 38px; }
  .dg-card-more { max-height: 30vh; }
  .dg-ctl { gap: 5px; top: 6px; }
  .dg-tool { width: 38px; height: 38px; }
}
