/* Stop status colours from HANDOFF-status.md.
   S, F, and pending keep the canon pin. These rules never restyle
   .mrk-start or .mrk-finish. The route polyline is untouched.
   Card: fg / ink / tint / border / pill-bg.
   pending  #A8A29E / #44403C / #FFFFFF / #D6D3D1 / #F5F5F4
   success  #15803D / #166534 / #F0FDF4 / #BBF7D0 / #DCFCE7
   problem  #C2410C / #9A3412 / #FFF7ED / #FED7AA / #FFEDD5
   deferred #6D28D9 / #5B21B6 / #F5F3FF / #DDD6FE / #EDE9FE
   cancel   #78716C / #44403C / #F5F5F4 / #D6D3D1 / #E7E5E4 */

.mrk-badge.st-success {
  --pin-fill: #FFFFFF;
  --pin-stroke: #15803D;
  --pin-text: #15803D;
}
.mrk-badge.st-problem {
  --pin-fill: #C2410C;
  --pin-stroke: #9A3412;
  --pin-text: #FFFFFF;
}
.mrk-badge.st-deferred {
  --pin-fill: #6D28D9;
  --pin-stroke: #5B21B6;
  --pin-text: #FFFFFF;
}
.mrk-badge.st-cancelled {
  --pin-fill: #FAFAF9;
  --pin-stroke: #78716C;
  --pin-text: #78716C;
}
/* Chromium snaps border-width to whole pixels, so the 2.5 and 1.5
   strokes are inset shadows. The pin fill and tail tokens stay. */
.mrk-badge.st-success .mrk-bubble {
  border-color: transparent;
  box-shadow: inset 0 0 0 2.5px #15803D;
}
.mrk-badge.st-problem .mrk-bubble {
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px #9A3412;
}
.mrk-badge.st-deferred .mrk-bubble {
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px #5B21B6;
}
.mrk-badge.st-cancelled .mrk-bubble {
  border-color: transparent;
  background: #FAFAF9;
  color: #78716C;
}
.mrk-badge.st-cancelled .mrk-bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 22' preserveAspectRatio='none'%3E%3Crect x='0.75' y='0.75' width='26.5' height='20.5' rx='7' fill='none' stroke='%2378716C' stroke-width='1.5' stroke-dasharray='4 3' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.mrk-strike,
.dm-strike {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 1.6px;
  margin-left: -8px;
  margin-top: -0.8px;
  background: currentColor;
  pointer-events: none;
  z-index: 2;
}
.mrk-flag,
.dm-flag {
  position: absolute;
  z-index: 3;
  top: -6px;
  right: -8px;
  left: auto;
  bottom: auto;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  box-sizing: border-box;
  border-radius: 7px;
  background: #15803D;
  color: #FFFFFF;
  border: 1px solid #FFFFFF;
  font: 700 10px/12px system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mrk-badge.st-problem .mrk-flag,
.num.st-problem .dm-flag { background: #C2410C; }
.mrk-badge.st-deferred .mrk-flag,
.num.st-deferred .dm-flag { background: #6D28D9; }
.mrk-badge.st-success .mrk-flag,
.num.st-success .dm-flag { background: #15803D; }
.mrk-flag .dm-clock,
.dm-flag .dm-clock { display: block; }

#address-list > li.stop > .num.num-pin.st-success,
ol.points li.st-success .num {
  --pin-fill: #FFFFFF;
  --pin-stroke: #15803D;
  --pin-text: #15803D;
  border-color: transparent;
  box-shadow: inset 0 0 0 2.5px #15803D;
}
#address-list > li.stop > .num.num-pin.st-problem,
ol.points li.st-problem .num {
  --pin-fill: #C2410C;
  --pin-stroke: #9A3412;
  --pin-text: #FFFFFF;
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px #9A3412;
}
#address-list > li.stop > .num.num-pin.st-deferred,
ol.points li.st-deferred .num {
  --pin-fill: #6D28D9;
  --pin-stroke: #5B21B6;
  --pin-text: #FFFFFF;
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px #5B21B6;
}
#address-list > li.stop > .num.num-pin.st-cancelled,
ol.points li.st-cancelled .num {
  --pin-fill: #FAFAF9;
  --pin-stroke: #78716C;
  --pin-text: #78716C;
  border-width: 1.5px;
  border-style: dashed;
}

/* Courier list mini-pin 28×34, same tokens as the map pin. */
ol.points .num {
  width: 28px;
  min-width: 28px;
  height: 26px;
  margin: 0 0 8px;
  border-radius: 8px;
  position: relative;
  box-sizing: border-box;
  border: 1px solid var(--pin-stroke, #0F766E);
  background: var(--pin-fill, #0D9488);
  color: var(--pin-text, #fff);
}
ol.points li[data-role="start"] .num {
  --pin-fill: #CCFBF1;
  --pin-stroke: #0D9488;
  --pin-text: #0F766E;
  background: var(--pin-fill);
  color: var(--pin-text);
  border-color: var(--pin-stroke);
}
ol.points li[data-role="finish"] .num {
  --pin-fill: #E7E5E4;
  --pin-stroke: #A8A29E;
  --pin-text: #44403C;
  background: var(--pin-fill);
  color: var(--pin-text);
  border-color: var(--pin-stroke);
}
ol.points .num::before,
ol.points .num::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
}
ol.points .num::before {
  top: calc(100% + 1px);
  margin-left: -5px;
  border-width: 7px 5px 0 5px;
  border-top-color: var(--pin-stroke, #0F766E);
}
ol.points .num::after {
  top: 100%;
  margin-left: -4px;
  border-width: 6px 4px 0 4px;
  border-top-color: var(--pin-fill, #0D9488);
  z-index: 1;
}
.dm-head-main { min-width: 0; flex: 1; }
header.top { position: relative; align-items: flex-start; }
.dm-counter {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 0;
  width: 100%;
  font: 600 14px/1.3 system-ui, sans-serif;
  color: #44403C;
}
.dm-planner-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #44403C;
}
.dm-planner-counter .dm-c-left { margin-left: 0; }
.dm-counter-stats { min-width: 0; }
.dm-c-done { color: #15803D; font-weight: 600; }
.dm-c-problem { color: #C2410C; font-weight: 600; }
.dm-c-cancelled { color: #78716C; font-weight: 600; }
.dm-c-left { margin-left: auto; color: #44403C; font-weight: 600; white-space: nowrap; }
/* Dark: the light-card inks are 1.8 and 3.7:1 on #141414 (WCAG AA, task 3a). */
:root[data-theme="dark"] .dm-c-done { color: var(--dm-success-ink, #6EE7B7); }
:root[data-theme="dark"] .dm-c-left { color: var(--dm-muted); }
.dm-bar { display: flex; gap: 3px; height: 6px; margin-top: 6px; }
.dm-bar i {
  flex: 1;
  display: block;
  height: 6px;
  border-radius: 99px;
  background: #E7E5E4;
}
.dm-bar i.st-success { background: #15803D; }
.dm-bar i.st-problem { background: #C2410C; }
.dm-bar i.st-deferred { background: #6D28D9; }
.dm-bar i.st-cancelled { background: #A8A29E; }
.dm-bar i.st-pending { background: #E7E5E4; }
header.top .count {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

ol.points li.st-success { background: #FFFFFF; border-color: #E7E5E4; }
ol.points li.st-problem { background: #FFFBF7; border-color: #FED7AA; }
ol.points li.st-deferred { background: #FAF8FF; border-color: #DDD6FE; }
ol.points li.st-cancelled { background: #FAFAF9; border-color: #D6D3D1; }
ol.points li.st-cancelled .addr { color: #78716C; text-decoration: line-through; }
ol.points li.is-next {
  border-color: #99F6E4;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .10);
}

.dm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 2px;
  margin-top: 2px;
}
.dm-dot { color: #A8A29E; }
.dm-hit {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: #0F766E;
  font: 500 14px/1.2 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.dm-status-btn {
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #D6D3D1;
  border-radius: 999px;
  background: #FFFFFF;
  color: #44403C;
}
.dm-status-btn .dm-status-ico { display: inline-flex; color: #A8A29E; }
.dm-status-btn .dm-chevron { display: inline-flex; color: #A8A29E; }
.dm-status-btn.st-success {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #166534;
}
.dm-status-btn.st-problem {
  background: #FFF7ED;
  border-color: #FED7AA;
  color: #9A3412;
}
.dm-status-btn.st-deferred {
  background: #F5F3FF;
  border-color: #DDD6FE;
  color: #5B21B6;
}
.dm-status-btn.st-cancelled {
  background: #F5F5F4;
  border-color: #D6D3D1;
  color: #44403C;
}
.dm-status-btn.st-success .dm-status-label,
.dm-status-btn.st-problem .dm-status-label,
.dm-status-btn.st-deferred .dm-status-label,
.dm-status-btn.st-cancelled .dm-status-label { font-weight: 600; }
.dm-status-btn.st-success .dm-status-ico,
.dm-status-btn.st-success .dm-chevron,
.dm-status-btn.st-problem .dm-status-ico,
.dm-status-btn.st-problem .dm-chevron,
.dm-status-btn.st-deferred .dm-status-ico,
.dm-status-btn.st-deferred .dm-chevron,
.dm-status-btn.st-cancelled .dm-status-ico,
.dm-status-btn.st-cancelled .dm-chevron { color: inherit; }
.dm-dash-ico {
  display: block;
  width: 10px;
  height: 1.6px;
  background: currentColor;
}
.dm-hit::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 44px;
  transform: translateY(-50%);
}
.dm-note { margin-top: 4px; }
.dm-note-text, .dm-shared-note {
  margin: 0;
  font: 400 14px/1.35 system-ui, sans-serif;
  color: #1C1917;
  white-space: pre-wrap;
  word-break: break-word;
}
.dm-note-by, .dm-shared-by {
  margin: 2px 0 0;
  font: 400 12px/1.3 system-ui, sans-serif;
  color: #78716C;
}

.dm-sheet-root[hidden] { display: none !important; }
.dm-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.dm-sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 25, 23, 0.45); }
.dm-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92dvh;
  overflow: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}
.dm-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: #D6D3D1;
  margin: 4px auto 10px;
}
.dm-sheet h2 { margin: 0 0 8px; font: 600 18px/1.3 system-ui, sans-serif; }
.dm-sheet-remote {
  margin: 0 0 8px;
  font: 500 13px/1.3 system-ui, sans-serif;
  color: #0F766E;
}
.dm-group { margin: 0 0 10px; }
.dm-group h3 {
  margin: 0 0 6px;
  font: 600 11px/1.2 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #78716C;
}
.dm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dm-tile {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid #E7E5E4;
  background: #fff;
  font: 600 14px/1.2 system-ui, sans-serif;
  color: #1C1917;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}
.dm-tile[aria-checked="true"] { border-color: #0D9488; box-shadow: inset 0 0 0 1px #0D9488; }
.dm-tile.dm-tile-wide { grid-column: 1 / -1; }
.dm-tile-hint {
  display: block;
  margin-top: 2px;
  font: 400 12px/1.3 system-ui, sans-serif;
  color: #78716C;
}
.dm-tile.st-success[aria-checked="true"] { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.dm-tile.st-problem[aria-checked="true"] { background: #FFF7ED; border-color: #FED7AA; color: #9A3412; }
.dm-tile.st-deferred[aria-checked="true"] { background: #F5F3FF; border-color: #DDD6FE; color: #5B21B6; }
.dm-tile.st-cancelled[aria-checked="true"] { background: #F5F5F4; border-color: #D6D3D1; color: #44403C; }
.dm-reset {
  display: block;
  margin: 4px 0 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #57534E;
  min-height: 44px;
  font: 500 14px/1 system-ui, sans-serif;
  cursor: pointer;
}
.dm-note-label { display: block; font: 600 13px/1.3 system-ui, sans-serif; color: #44403C; }
.dm-note-input, .dm-pop textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid #E7E5E4;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.35;
  font-family: system-ui, sans-serif;
  resize: vertical;
}
.dm-save, .dm-pop-save {
  display: block;
  width: 100%;
  margin-top: 12px;
  height: 50px;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: #0D9488;
  color: #fff;
  font: 600 16px/1 system-ui, sans-serif;
  cursor: pointer;
}
.dm-save:disabled, .dm-pop-save:disabled { background: #E7E5E4; color: #A8A29E; cursor: default; }

.dm-toast[hidden] { display: none !important; }
@keyframes dm-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.dm-toast {
  animation: dm-toast-in 180ms ease-out;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 12px;
  background: #1C1917;
  color: #fff;
  font: 500 14px/1.3 system-ui, sans-serif;
}
@media (prefers-reduced-motion: reduce) {
  .dm-toast { animation: none; }
}
.dm-toast button {
  position: relative;
  border: 0;
  background: none;
  color: #99F6E4;
  font: 600 14px/1 system-ui, sans-serif;
  min-height: 36px;
  cursor: pointer;
}
.dm-toast button::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: 50%;
  height: 44px;
  transform: translateY(-50%);
}

.dm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #E7E5E4;
  background: #F5F5F4;
  color: #44403C;
  font: 600 12px/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.dm-pill.st-pending { background: #F5F5F4; border-color: #D6D3D1; color: #44403C; }
.dm-pill.st-success { background: #DCFCE7; border-color: #BBF7D0; color: #166534; }
.dm-pill.st-problem { background: #FFEDD5; border-color: #FED7AA; color: #9A3412; }
.dm-pill.st-deferred { background: #EDE9FE; border-color: #DDD6FE; color: #5B21B6; }
.dm-pill.st-cancelled { background: #E7E5E4; border-color: #D6D3D1; color: #44403C; }
.dm-planner-counter {
  margin-left: 8px;
  font: 600 12px/1.2 system-ui, sans-serif;
}
.dm-pop {
  position: fixed;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #fff;
  border: 1px solid #E7E5E4;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  padding: 12px;
}
.dm-pop[hidden] { display: none !important; }
#address-list > li.stop.st-success { background: #FFFFFF; }
#address-list > li.stop.st-problem { background: #FFFBF7; border-color: #FED7AA; }
#address-list > li.stop.st-deferred { background: #FAF8FF; border-color: #DDD6FE; }
#address-list > li.stop.st-cancelled { background: #FAFAF9; border-color: #D6D3D1; }
#address-list > li.stop.st-cancelled .t,
#address-list > li.stop.st-cancelled .addr-title {
  color: #78716C;
  text-decoration: line-through;
}

.dm-route-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--ant-color-border, #D6D3D1);
  border-radius: 8px;
  background: var(--ant-color-fill-quaternary, #F5F5F4);
  color: var(--ant-color-text, #44403C);
  font-size: 13px;
  line-height: 1.35;
}
.dm-route-banner[hidden] { display: none !important; }
.dm-route-banner p { margin: 0; }
.dm-route-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}
.dm-route-banner a,
.dm-route-banner button {
  font: inherit;
  font-weight: 600;
  color: #15803D;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
html.dm-route-locked .leaflet-control-pick,
.daymilo-shell.dm-route-viewonly .leaflet-control-pick {
  pointer-events: none;
}

/* Tokenless reopen: the planner root carries dm-route-viewonly.
   Edit, remove, drag, notes, paste, add, and optimize stay out of the way. */
.daymilo-shell.dm-route-viewonly .stop-edit,
.daymilo-shell.dm-route-viewonly .addr-delete,
.daymilo-shell.dm-route-viewonly .stop > .x,
.daymilo-shell.dm-route-viewonly .stop > .stop-corner > .x,
.daymilo-shell.dm-route-viewonly .addr-drag-handle,
.daymilo-shell.dm-route-viewonly .comment-input,
.daymilo-shell.dm-route-viewonly .daymilo-stop-comment,
.daymilo-shell.dm-route-viewonly #bulk-import-btn,
.daymilo-shell.dm-route-viewonly #daymilo-add-stop-btn,
.daymilo-shell.dm-route-viewonly #route-optimize-btn,
.daymilo-shell.dm-route-viewonly .daymilo-act,
.daymilo-shell.dm-route-viewonly .address-list-buttons-wrapper {
  display: none !important;
}
