:root {
  --bg: #fefef7;
  --panel: #353858;
  --panel-soft: rgba(76, 80, 125, 0.94);
  --card: #ffffff;
  --card-soft: #fefef7;
  --text: #353858;
  --text-inverse: #ffffff;
  --muted: #6d7190;
  --accent: #f59d19;
  --accent-strong: #ffb447;
  --safe: #2a9e80;
  --safe-soft: #b8ddd3;
  --route: #f59d19;
  --brand-purple: #4c507d;
  --brand-lavender: #e2e1f0;
  --line: rgba(76, 80, 125, 0.12);
  --shadow: 0 18px 44px rgba(76, 80, 125, 0.16);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  font-family: "Nunito Sans", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 10%, rgba(184, 221, 211, 0.82) 0%, rgba(184, 221, 211, 0) 34%),
    radial-gradient(circle at 88% 6%, rgba(245, 157, 25, 0.2) 0%, rgba(245, 157, 25, 0) 28%),
    linear-gradient(135deg, #fefef7 0%, #ebf1f4 58%, #eaeaf1 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

body[data-ops-mode="admin"] .app-shell,
body[data-ops-mode="worker"] .app-shell {
  display: none;
}

body[data-ops-mode="delivery"] .ops-shell {
  display: none;
}

.ops-shell {
  min-height: 100vh;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
  align-content: start;
}

.ops-header,
.ops-card {
  background: var(--card);
  border: 1px solid rgba(76, 80, 125, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.ops-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ops-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ops-card {
  display: grid;
  gap: 12px;
}

body[data-ops-mode="admin"] #worker-home,
body[data-ops-mode="worker"] #admin-home {
  display: none;
}

.ops-list {
  display: grid;
  gap: 10px;
}

.ops-bulk-actions {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f7fbf9;
  border: 1px solid rgba(76, 80, 125, 0.08);
}

.ops-row {
  border: 0;
  border-left: 6px solid var(--safe);
  border-radius: 16px;
  padding: 13px 15px;
  text-align: left;
  background: #f7fbf9;
  color: var(--text);
  font: inherit;
  display: grid;
  gap: 5px;
}

.ops-row.is-selected {
  box-shadow: inset 0 0 0 2px rgba(245, 157, 25, 0.34);
}

.assignment-row {
  position: relative;
  padding-right: 54px;
  cursor: pointer;
}

.assignment-row:hover,
.assignment-row:focus-visible {
  background: #eff8f4;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(42, 158, 128, 0.14);
}

.assignment-row.is-selected {
  background: #eef8f5;
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(245, 157, 25, 0.28);
}

.assignment-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(76, 80, 125, 0.18);
  background: #fff;
}

.assignment-row.is-selected .assignment-toggle {
  background: var(--accent);
  border-color: var(--accent);
}

.assignment-row.is-selected .assignment-toggle::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 7px;
  height: 12px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.ops-row strong {
  font-weight: 900;
}

.ops-row span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.ops-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.admin-insights {
  display: grid;
  gap: 12px;
}

.admin-insight-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.admin-health-pill {
  border-radius: 999px;
  padding: 8px 11px;
  background: #edf8f4;
  color: var(--safe);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
}

.admin-health-pill.has-warning {
  background: #fff7e8;
  color: #b56205;
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-metric-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f7fbf9;
  border: 1px solid rgba(76, 80, 125, 0.08);
}

.admin-metric-card span,
.admin-metric-card small,
.admin-insight-row span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.3;
}

.admin-metric-card strong {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 900;
}

.admin-insight-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.admin-insight-row strong {
  font-weight: 900;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 52vh 48vh;
  background: transparent;
}

.map-panel {
  position: relative;
  min-height: 320px;
}

#map {
  height: 100%;
  width: 100%;
}

.map-overlay {
  position: absolute;
  inset: 16px 16px auto 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.status-stack {
  display: grid;
  gap: 8px;
}

.status-badge,
.map-legend {
  background: var(--panel-soft);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(53, 56, 88, 0.2);
  backdrop-filter: blur(12px);
}

.session-badge {
  border: 0;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
  max-width: min(68vw, 320px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-badge.is-live {
  background: rgba(42, 158, 128, 0.94);
}

.map-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 600;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
}

.legend-swatch.route {
  background: var(--route);
}

.legend-swatch.house {
  background: var(--safe);
}

.legend-swatch.points {
  background: #f5d6bf;
  border: 1px solid var(--text);
}

.legend-swatch.drop {
  background: #f8f5ef;
  border: 2px solid var(--text);
}

.info-panel {
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
  align-content: start;
}

.current-street-card,
.info-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(76, 80, 125, 0.08);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body[data-ui-mode="walk"] .app-shell {
  grid-template-rows: 60vh 40vh;
}

@media (max-width: 900px) {
  body[data-ui-mode="walk"] .map-legend,
  body[data-ui-mode="walk"] .import-card,
  body[data-ui-mode="walk"] .drop-plan-card,
  body[data-ui-mode="walk"] .next-streets-card,
  body[data-ui-mode="walk"] .status-card {
    display: none;
  }

  body[data-ui-mode="walk"] .info-panel {
    padding-top: 12px;
  }
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-purple);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.1;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1;
}

.big-copy {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.supporting-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.95rem;
}

.number-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.compact-number-grid {
  gap: 8px;
  margin-top: 12px;
}

.compact-number-grid .number-pill {
  min-width: 52px;
  padding: 10px 12px;
  font-size: 1rem;
}

.number-pill {
  min-width: 64px;
  max-width: 96px;
  text-align: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #f0faf6;
  color: var(--safe);
  border: 2px solid rgba(42, 158, 128, 0.24);
  font-size: 1.2rem;
  font-weight: 800;
  display: grid;
  gap: 4px;
  place-items: center;
  cursor: pointer;
}

.number-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number-pill span {
  max-width: 100%;
}

.number-pill.number-pill-product-f {
  background: #f0faf6;
  color: var(--safe);
  border-color: rgba(42, 158, 128, 0.24);
}

.number-pill.number-pill-product-fk {
  background: #f2f1ff;
  color: #4c507d;
  border-color: rgba(136, 143, 227, 0.3);
}

.number-pill.number-pill-product-mixed {
  background: #fff7e8;
  color: #b56205;
  border-color: rgba(245, 157, 25, 0.34);
}

.number-pill.is-nearest {
  box-shadow: inset 0 0 0 2px rgba(245, 157, 25, 0.55), 0 8px 18px rgba(245, 157, 25, 0.18);
  transform: translateY(-1px);
}

.number-pill.is-complete {
  background: #edf0f2;
  color: #63717a;
  border-color: rgba(15, 23, 31, 0.08);
  text-decoration: line-through;
}

.next-streets {
  display: grid;
  gap: 10px;
}

.drop-plan-card {
  display: grid;
  gap: 12px;
}

.prep-card {
  display: grid;
  gap: 12px;
}

.session-card {
  display: grid;
  gap: 12px;
}

.next-street-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f7fbf9;
  border: 1px solid rgba(76, 80, 125, 0.08);
}

.next-street-row strong {
  font-size: 1.05rem;
}

.next-street-row span {
  color: var(--muted);
  font-weight: 600;
}

.next-street-row.drop-plan-row {
  align-items: flex-start;
  flex-direction: column;
  border-left: 7px solid var(--drop-color, rgba(15, 23, 31, 0.18));
}

.next-street-row.drop-plan-row > span {
  display: block;
  width: 100%;
}

.next-street-row.drop-plan-row strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drop-plan-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--drop-color, var(--text));
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 31, 0.18);
  flex: 0 0 auto;
}

.house-marker {
  width: var(--house-marker-width, 42px);
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0 4px;
  font-size: clamp(0.68rem, 2.6vw, 0.95rem);
  font-weight: 800;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
}

.house-marker.house-marker-wide {
  border-radius: 999px;
  font-size: 0.84rem;
  letter-spacing: -0.02em;
}

.house-marker.house-marker-compact {
  font-size: 0.78rem;
}

.house-marker.house-marker-drop-assigned {
  border-color: var(--drop-color, rgba(255, 255, 255, 0.96));
}

.house-marker-label {
  position: relative;
  z-index: 1;
}

.house-marker.house-marker-product-f {
  background: var(--safe);
  box-shadow: 0 6px 16px rgba(42, 158, 128, 0.34);
}

.house-marker.house-marker-product-fk {
  background: #888fe3;
  box-shadow: 0 6px 16px rgba(76, 80, 125, 0.32);
}

.house-marker.house-marker-product-mixed {
  background: var(--brand-purple);
  box-shadow: 0 6px 16px rgba(76, 80, 125, 0.34);
}

.house-marker.house-marker-nearest {
  box-shadow: 0 0 0 4px rgba(245, 157, 25, 0.42), 0 8px 18px rgba(53, 56, 88, 0.2);
  transform: scale(1.06);
}

.house-marker.house-marker-complete {
  background: #9aa5ad;
  color: #eef2f4;
  box-shadow: 0 6px 16px rgba(99, 113, 122, 0.22);
  opacity: 0.65;
}

.flat-marker {
  width: 58px;
  height: 48px;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  color: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 31, 0.26);
}

.flat-marker span {
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flat-marker strong {
  font-size: 0.98rem;
  line-height: 1;
}

.flat-marker.flat-marker-product-f {
  background: var(--safe);
}

.flat-marker.flat-marker-product-fk {
  background: #888fe3;
}

.flat-marker.flat-marker-product-mixed {
  background: var(--brand-purple);
}

.flat-marker.flat-marker-drop-assigned {
  border-color: var(--drop-color, rgba(255, 255, 255, 0.96));
}

.flat-marker.flat-marker-nearest {
  box-shadow: 0 0 0 4px rgba(245, 157, 25, 0.42), 0 8px 20px rgba(53, 56, 88, 0.24);
  transform: scale(1.04);
}

.flat-marker.flat-marker-complete {
  background: #9aa5ad;
  color: #eef2f4;
  opacity: 0.72;
}

.flat-focus-panel {
  position: absolute;
  z-index: 700;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-height: min(72vh, 560px);
  padding: 14px;
  border-radius: 20px;
  background: rgba(254, 254, 247, 0.98);
  border: 1px solid rgba(76, 80, 125, 0.14);
  box-shadow: 0 20px 52px rgba(15, 23, 31, 0.24);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  pointer-events: auto;
}

.flat-focus-panel[hidden] {
  display: none;
}

body.is-flat-focus-open .street-strip {
  display: none;
}

.flat-focus-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.flat-focus-header h2 {
  font-size: 1.12rem;
}

.flat-focus-header .supporting-text {
  margin-top: 4px;
}

.flat-focus-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.flat-focus-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 2px 4px 0;
  -webkit-overflow-scrolling: touch;
}

.flat-focus-address {
  min-height: 58px;
  border: 2px solid rgba(42, 158, 128, 0.24);
  border-radius: 14px;
  background: #f0faf6;
  color: var(--safe);
  display: grid;
  gap: 2px;
  place-items: center;
  padding: 9px 6px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.flat-focus-address span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flat-focus-address small {
  font-size: 0.68rem;
  font-weight: 800;
}

.flat-focus-address.flat-focus-address-product-fk {
  background: #f2f1ff;
  color: #4c507d;
  border-color: rgba(136, 143, 227, 0.3);
}

.flat-focus-address.flat-focus-address-product-mixed {
  background: #fff7e8;
  color: #b56205;
  border-color: rgba(245, 157, 25, 0.34);
}

.flat-focus-address.is-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 157, 25, 0.22);
}

.flat-focus-address.is-complete {
  background: #edf0f2;
  color: #63717a;
  border-color: rgba(15, 23, 31, 0.08);
  text-decoration: line-through;
}

.drop-marker {
  width: 34px;
  height: 34px;
  transform: rotate(45deg);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 4px solid var(--drop-color, var(--text));
  color: var(--drop-color, var(--text));
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.82rem;
  box-shadow: 0 6px 16px rgba(15, 23, 31, 0.22);
}

.drop-marker span {
  transform: rotate(-45deg);
  line-height: 1;
}

.flat-popup-content {
  display: grid;
  gap: 8px;
}

.flat-popup-content strong {
  font-size: 1rem;
}

.flat-popup-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.flat-popup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.flat-popup-address {
  border: 2px solid rgba(42, 158, 128, 0.24);
  border-radius: 14px;
  background: #f0faf6;
  color: var(--safe);
  display: grid;
  gap: 1px;
  padding: 8px 6px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.flat-popup-address small {
  font-size: 0.68rem;
  font-weight: 800;
}

.flat-popup-address.flat-popup-address-product-fk {
  background: #f2f1ff;
  color: #4c507d;
  border-color: rgba(136, 143, 227, 0.3);
}

.flat-popup-address.flat-popup-address-product-mixed {
  background: #fff7e8;
  color: #b56205;
  border-color: rgba(245, 157, 25, 0.34);
}

.flat-popup-address.is-complete {
  background: #edf0f2;
  color: #63717a;
  border-color: rgba(15, 23, 31, 0.08);
  text-decoration: line-through;
}

.import-card {
  display: grid;
  gap: 12px;
}

.import-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.secondary-button {
  border: 0;
  background: #eaeaf1;
  color: var(--brand-purple);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
  font: inherit;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  font: inherit;
  box-shadow: 0 10px 22px rgba(245, 157, 25, 0.28);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
}

.field-label {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--brand-purple);
}

.text-input {
  width: 100%;
  border: 1px solid rgba(76, 80, 125, 0.16);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  background: #fefef7;
  color: var(--text);
}

.toggle-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(76, 80, 125, 0.12);
  border-radius: 16px;
  background: rgba(254, 254, 247, 0.9);
  cursor: pointer;
}

.toggle-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--safe);
}

.toggle-row span {
  display: grid;
  gap: 2px;
}

.toggle-row strong {
  font-size: 0.95rem;
}

.toggle-row small {
  color: var(--muted);
  font-size: 0.82rem;
}

.file-input-shell {
  display: grid;
  gap: 4px;
  border: 2px dashed rgba(76, 80, 125, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: #f7fbf9;
}

.file-input-shell span {
  font-weight: 800;
}

.file-input-shell small,
.pill-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-note {
  display: block;
}

.product-note {
  font-weight: 800;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.progress-row {
  display: grid;
  gap: 8px;
}

progress {
  width: 100%;
  height: 12px;
  appearance: none;
}

progress::-webkit-progress-bar {
  background: #e2e1f0;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--safe), var(--accent));
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--safe), var(--accent));
  border-radius: 999px;
}

.empty-state {
  color: var(--muted);
  font-weight: 700;
}

.target-card {
  display: grid;
  gap: 10px;
}

.start-card {
  display: grid;
  gap: 12px;
}

.manual-route-card {
  display: grid;
  gap: 12px;
}

.target-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.target-copy {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.1;
}

.start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-route-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.secondary-button.is-active {
  background: #b8ddd3;
  color: #1f6f5d;
}

.start-marker {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #2563eb;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.34);
}

.manual-route-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(245, 157, 25, 0.34);
  font-size: 0.8rem;
  font-weight: 900;
}

.leaflet-tooltip.drop-tooltip {
  background: rgba(53, 56, 88, 0.94);
  border: 0;
  color: #fff;
  box-shadow: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
}

.leaflet-tooltip.drop-tooltip::before {
  display: none;
}

.leaflet-control-attribution {
  font-size: 0.7rem;
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 440px);
    grid-template-rows: 100vh;
  }

  .info-panel {
    padding: 20px 20px 24px 0;
    max-height: 100vh;
    overflow: auto;
  }

  .map-panel {
    padding: 20px;
  }

  #map {
    border-radius: 28px;
    overflow: hidden;
  }
}

body {
  overflow: hidden;
}

body[data-ops-mode="admin"],
body[data-ops-mode="worker"] {
  overflow: auto;
}

.app-shell {
  min-height: 100vh;
  display: block;
  position: relative;
}

.map-panel {
  min-height: 100vh;
  height: 100vh;
}

.map-legend {
  display: none;
}

.map-overlay {
  inset: 12px 12px auto 12px;
  align-items: flex-start;
  z-index: 500;
}

.map-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.street-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 520;
  height: var(--street-strip-height, 148px);
  padding: 8px 14px 12px;
  border-radius: 22px;
  background: rgba(254, 254, 247, 0.96);
  border: 1px solid rgba(76, 80, 125, 0.1);
  box-shadow: 0 18px 40px rgba(76, 80, 125, 0.2);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.street-strip-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.street-strip-handle {
  border: 0;
  background: transparent;
  padding: 0 0 8px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: ns-resize;
}

.street-strip-grip {
  width: 52px;
  height: 6px;
  border-radius: 999px;
  background: rgba(76, 80, 125, 0.34);
}

.street-strip .number-grid {
  margin-top: 12px;
  overflow: auto;
  align-content: start;
}

.street-strip .number-pill {
  min-width: 54px;
  padding: 10px 12px;
  font-size: 1rem;
}

.overlay-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(76, 80, 125, 0.94);
  color: #fff;
  font: inherit;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

#return-to-location:not(.is-visible) {
  display: none;
}

.overlay-button.is-active {
  background: var(--accent);
}

#return-to-location.is-visible {
  display: inline-flex;
  align-items: center;
}

.info-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 700;
  display: none;
  gap: 14px;
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 16px;
  border-radius: 24px;
  background: rgba(254, 254, 247, 0.97);
  border: 1px solid rgba(76, 80, 125, 0.1);
  box-shadow: 0 18px 40px rgba(76, 80, 125, 0.22);
}

.info-panel.is-open {
  display: grid;
}

.info-panel.is-open + .street-strip,
body[data-panel-mode="settings"] .street-strip,
body[data-panel-mode="addresses"] .street-strip {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.current-street-card,
.target-card,
.start-card,
.manual-route-card,
.info-grid,
.drop-summary-card,
.drop-plan-card,
.next-streets-card {
  display: none !important;
}

.address-list-card {
  display: none;
  gap: 12px;
}

body[data-panel-mode="settings"] .prep-card,
body[data-panel-mode="settings"] .import-card,
body[data-panel-mode="settings"] .session-card {
  display: grid;
}

body[data-panel-mode="settings"] .address-list-card {
  display: none;
}

body[data-panel-mode="addresses"] .prep-card,
body[data-panel-mode="addresses"] .import-card,
body[data-panel-mode="addresses"] .session-card {
  display: none;
}

body[data-panel-mode="addresses"] .address-list-card {
  display: grid;
}

body[data-shell="worker"] .prep-card,
body[data-shell="worker"] .import-card {
  display: none !important;
}

body[data-shell="worker"][data-panel-mode="settings"] .session-card,
body[data-shell="worker"][data-panel-mode="settings"] .start-card,
body[data-shell="worker"][data-panel-mode="settings"] .manual-route-card,
body[data-shell="worker"][data-panel-mode="settings"] .drop-summary-card,
body[data-shell="worker"][data-panel-mode="settings"] .drop-plan-card,
body[data-shell="worker"][data-panel-mode="settings"] .next-streets-card {
  display: grid !important;
}

body[data-shell="worker"][data-panel-mode="settings"] .info-grid {
  display: grid !important;
}

.address-list {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 420px);
  overflow: auto;
}

.address-row {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  background: #f7fbf9;
  color: var(--text);
  font: inherit;
  display: grid;
  gap: 4px;
}

.address-row.address-row-product-f {
  background: #f7fbf9;
  border-left: 6px solid var(--safe);
}

.address-row.address-row-product-fk {
  background: #f2f1ff;
  border-left: 6px solid #888fe3;
}

.address-row.address-row-product-mixed {
  background: #fff7e8;
  border-left: 6px solid var(--accent);
}

.address-row.is-target {
  box-shadow: inset 0 0 0 2px rgba(245, 157, 25, 0.34);
}

.address-row.is-unresolved {
  background: #fff3dc;
  border-left: 6px solid #f59e0b;
}

.address-row.is-complete {
  background: #edf0f2;
  color: #63717a;
}

.address-main {
  font-weight: 800;
}

.address-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.address-row.is-complete .address-main {
  text-decoration: line-through;
}

.participant-row strong::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
  background: var(--accent);
}

.participant-tooltip {
  background: rgba(15, 23, 31, 0.92);
  color: var(--text-inverse);
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  font-weight: 700;
  padding: 4px 10px;
}

.participant-tooltip::before {
  display: none;
}

@media (min-width: 900px) {
  .flat-focus-panel {
    left: auto;
    right: 18px;
    bottom: 18px;
    width: min(420px, calc(100% - 36px));
    max-height: min(72vh, 620px);
  }
}

@media (min-width: 900px) {
  .info-panel {
    left: auto;
    right: 16px;
    width: min(420px, calc(100vw - 32px));
  }

  .street-strip {
    right: auto;
    width: min(520px, calc(100vw - 32px));
  }
}

@media (min-width: 900px) {
  body[data-ui-mode="plan"] .app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 440px);
    grid-template-rows: 100vh;
  }

  body[data-ui-mode="plan"] .map-panel {
    min-height: 100vh;
    height: 100vh;
    padding: 20px;
  }

  body[data-ui-mode="plan"] #map {
    border-radius: 28px;
    overflow: hidden;
  }

  body[data-ui-mode="plan"] .info-panel {
    position: static;
    display: grid;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-height: 100vh;
    overflow: auto;
    padding: 20px 20px 24px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-ui-mode="plan"] .panel-header {
    display: none;
  }

  body[data-ui-mode="plan"] .street-strip {
    display: none;
  }

  body[data-ui-mode="plan"] #open-settings-panel,
  body[data-ui-mode="plan"] #open-address-list {
    display: none;
  }

  body[data-ui-mode="plan"] .current-street-card {
    display: block !important;
  }

  body[data-ui-mode="plan"] .target-card,
  body[data-ui-mode="plan"] .start-card,
  body[data-ui-mode="plan"] .manual-route-card,
  body[data-ui-mode="plan"] .drop-summary-card,
  body[data-ui-mode="plan"] .drop-plan-card,
  body[data-ui-mode="plan"] .next-streets-card,
  body[data-ui-mode="plan"] .prep-card,
  body[data-ui-mode="plan"] .import-card,
  body[data-ui-mode="plan"] .session-card,
  body[data-ui-mode="plan"] .address-list-card {
    display: grid !important;
  }

  body[data-ui-mode="plan"] .info-grid {
    display: grid !important;
  }

  body[data-shell="worker"][data-ui-mode="plan"] .prep-card,
  body[data-shell="worker"][data-ui-mode="plan"] .import-card {
    display: none !important;
  }
}

@media (max-width: 640px) {
  body[data-ui-mode="walk"] .app-shell {
    grid-template-rows: 64vh 36vh;
  }

  .map-overlay {
    inset: 12px 12px auto 12px;
    flex-direction: column;
  }

  .map-legend {
    gap: 10px;
    font-size: 0.82rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .number-pill {
    min-width: 58px;
    padding: 12px 14px;
  }

  .start-actions {
    grid-template-columns: 1fr;
  }
}
