:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-elevated: #eef3f9;
  --surface: #ffffff;
  --surface-strong: #fbfcff;
  --surface-muted: #f2f5fa;
  --text: #111827;
  --text-soft: #4b5563;
  --muted: #6b7280;
  --line: #dfe5ef;
  --line-strong: #cbd5e1;
  --primary: #1d5fd6;
  --primary-strong: #123f9f;
  --primary-soft: #e7f0ff;
  --green: #0f8f61;
  --green-soft: #e4f7ef;
  --amber: #b76a00;
  --amber-soft: #fff3d6;
  --red: #c43b3b;
  --red-soft: #ffe8e8;
  --violet: #7652d8;
  --violet-soft: #f0ebff;
  --cyan: #0088a8;
  --cyan-soft: #e3f7fb;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  --topbar-height: 92px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151e;
  --bg-elevated: #151c27;
  --surface: #171f2b;
  --surface-strong: #1c2634;
  --surface-muted: #202b3a;
  --text: #eef3f8;
  --text-soft: #c6d0dd;
  --muted: #94a3b8;
  --line: #2d394b;
  --line-strong: #405066;
  --primary: #6aa2ff;
  --primary-strong: #9cc0ff;
  --primary-soft: #19355d;
  --green: #54d39a;
  --green-soft: #123a2c;
  --amber: #f6bb57;
  --amber-soft: #442f10;
  --red: #ff7b7b;
  --red-soft: #4a2024;
  --violet: #b9a0ff;
  --violet-soft: #302452;
  --cyan: #5bd6ef;
  --cyan-soft: #173842;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, var(--bg-elevated) 0, var(--bg) 280px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(18px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.breadcrumb {
  display: none;
  align-items: center;
  gap: 5px;
  max-width: 1500px;
  margin: 0 auto 8px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb svg {
  width: 13px;
  height: 13px;
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 650;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1500px;
  margin: 0 auto;
}

.title-block {
  min-width: 0;
  flex: 1;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 20px;
  font-weight: 760;
}

h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 720;
}

h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 720;
}

.title-block p,
.section-heading p,
.mode-copy,
.switch-row span,
.empty-state p,
.metric-card span,
.timeline-meta,
.detail-muted {
  color: var(--muted);
}

.title-block p {
  display: none;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.date-chip {
  display: none;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.icon-btn,
.ghost-btn,
.primary-btn,
.danger-btn,
.soft-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.icon-btn:active,
.ghost-btn:active,
.primary-btn:active,
.danger-btn:active,
.soft-btn:active,
.mode-option:active,
.notification-card:active {
  transform: translateY(1px);
}

.icon-btn {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  place-items: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-soft);
}

.icon-btn:hover,
.ghost-btn:hover,
.soft-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.icon-btn svg,
.ghost-btn svg,
.primary-btn svg,
.danger-btn svg,
.soft-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.ghost-btn,
.primary-btn,
.danger-btn,
.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.ghost-btn {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-soft);
}

.soft-btn {
  border-color: color-mix(in srgb, var(--primary) 24%, var(--line));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 18px color-mix(in srgb, var(--primary) 24%, transparent);
}

.primary-btn:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

[data-theme="dark"] .primary-btn {
  color: #08111f;
}

.danger-btn {
  border-color: color-mix(in srgb, var(--red) 34%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.compact strong {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-areas:
    "setup"
    "map"
    "list"
    "right";
  gap: 12px;
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 12px 12px 24px;
}

.workspace > * {
  min-width: 0;
}

.setup-panel {
  grid-area: setup;
}

.map-panel {
  grid-area: map;
  min-width: 0;
}

.list-panel {
  grid-area: list;
}

.right-panel {
  grid-area: right;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.panel,
.selection-card,
.route-card,
.map-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel,
.selection-card,
.route-card {
  padding: 14px;
}

.section-heading,
.list-heading,
.map-toolbar,
.sheet-header,
.detail-header,
.route-header,
.selection-header,
.metric-row,
.sort-row,
.timeline-top,
.card-top,
.card-bottom,
.address-state,
.mini-metrics,
.sheet-actions,
.drawer-actions {
  display: flex;
  align-items: center;
}

.section-heading,
.list-heading,
.map-toolbar,
.sheet-header,
.detail-header,
.route-header,
.selection-header,
.sort-row,
.timeline-top,
.card-top,
.sheet-actions,
.drawer-actions {
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.soft-badge,
.status-pill,
.priority-pill,
.route-chip,
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.soft-badge {
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text-soft);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-top: 12px;
}

.field-grid .field {
  margin-top: 0;
}

.field span,
.field-label,
.sort-row label span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

.field input,
.field select,
.search-field input,
.sort-row select {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
}

.field input,
.field select {
  padding: 0 11px;
}

.field input:focus,
.field select:focus,
.search-field:focus-within,
.sort-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.mode-block {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

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

.mode-option {
  display: grid;
  min-height: 70px;
  place-items: center;
  gap: 7px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 760;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.mode-option svg {
  width: 22px;
  height: 22px;
}

.mode-option.is-active {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.mode-copy {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-size: 13px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.switch-row div {
  display: grid;
  gap: 2px;
}

.switch-row strong {
  color: var(--text);
  font-size: 13px;
}

.switch-row span {
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  transition: background 0.16s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  transition: transform 0.16s ease;
}

.switch input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--amber) 36%, var(--line));
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--text);
}

.offline-banner svg {
  width: 22px;
  height: 22px;
  color: var(--amber);
  flex: 0 0 auto;
}

.offline-banner div {
  display: grid;
  gap: 2px;
}

.offline-banner span {
  color: var(--text-soft);
  font-size: 13px;
}

.map-card {
  overflow: hidden;
}

.map-toolbar {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.map-actions {
  display: flex;
  gap: 7px;
}

.simulated-map {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--surface-muted) 70%, #d7eff8) 0 55%, color-mix(in srgb, var(--surface-muted) 70%, #edf6dd) 55%),
    var(--surface-muted);
  isolation: isolate;
}

.google-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.simulated-map.has-google-map .map-grid,
.simulated-map.has-google-map .water-strip,
.simulated-map.has-google-map .park-shape,
.simulated-map.has-google-map .map-road,
.simulated-map.has-google-map .route-svg,
.simulated-map.has-google-map .pin-layer,
.simulated-map.has-google-map .map-popup {
  display: none;
}

[data-theme="dark"] .simulated-map {
  background:
    linear-gradient(120deg, #172332 0 55%, #172a26 55%),
    var(--surface-muted);
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.54;
}

.water-strip {
  position: absolute;
  right: -60px;
  top: -40px;
  width: 28%;
  height: 112%;
  border-left: 1px solid color-mix(in srgb, var(--cyan) 42%, transparent);
  background: color-mix(in srgb, var(--cyan-soft) 72%, transparent);
  transform: rotate(8deg);
}

.park-shape {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--green-soft) 72%, transparent);
}

.park-one {
  left: 7%;
  top: 13%;
  width: 24%;
  height: 18%;
  transform: rotate(-8deg);
}

.park-two {
  right: 22%;
  bottom: 16%;
  width: 20%;
  height: 16%;
  transform: rotate(7deg);
}

.map-road {
  position: absolute;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, #ffffff 55%, transparent) inset;
}

[data-theme="dark"] .map-road {
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  box-shadow: none;
}

.map-road span {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.road-a {
  left: -6%;
  top: 40%;
  width: 82%;
  transform: rotate(-22deg);
}

.road-b {
  left: 12%;
  top: 60%;
  width: 84%;
  transform: rotate(-9deg);
}

.road-c {
  right: 1%;
  top: 31%;
  width: 76%;
  transform: rotate(14deg);
}

.road-d {
  left: 2%;
  top: 22%;
  width: 58%;
  transform: rotate(17deg);
}

.route-svg {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.route-line-shadow,
.route-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-line-shadow {
  stroke: color-mix(in srgb, var(--text) 28%, transparent);
  stroke-width: 12;
  opacity: 0.16;
}

.route-line {
  stroke: var(--primary);
  stroke-width: 5;
  stroke-dasharray: 11 10;
  animation: routeFlow 1.9s linear infinite;
}

.route-line.manual {
  stroke: var(--violet);
}

@keyframes routeFlow {
  to {
    stroke-dashoffset: -42;
  }
}

.pin-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.map-pin {
  --pin-bg: var(--primary);
  position: absolute;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--pin-bg);
  color: #ffffff;
  box-shadow: 0 9px 18px rgba(15, 23, 42, 0.2);
  font-size: 12px;
  font-weight: 850;
  transform: translate(-50%, -50%);
  transition:
    width 0.16s ease,
    height 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.map-pin svg {
  width: 16px;
  height: 16px;
}

.map-pin.is-faint {
  opacity: 0.58;
}

.map-pin.is-active {
  width: 42px;
  height: 42px;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--pin-bg) 34%, transparent);
  transform: translate(-50%, -50%) scale(1.02);
}

.map-pin.start {
  --pin-bg: #0f766e;
}

.map-pin.end {
  --pin-bg: #334155;
}

.map-pin.urgent {
  --pin-bg: var(--red);
}

.map-pin.review {
  --pin-bg: var(--amber);
}

.map-pin.corrected {
  --pin-bg: var(--violet);
}

.map-pin.done {
  --pin-bg: var(--green);
}

.map-pin.excluded {
  --pin-bg: #64748b;
  opacity: 0.72;
}

.map-popup {
  position: absolute;
  z-index: 16;
  width: min(240px, calc(100% - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 18px));
}

.map-popup strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.map-popup span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.map-popup::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transform: translateX(-50%) rotate(45deg);
}

.map-skeleton {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
}

.map-skeleton span {
  display: block;
  width: min(78%, 560px);
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--surface), var(--line));
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.map-skeleton span:nth-child(2) {
  width: min(58%, 430px);
}

.map-skeleton span:nth-child(3) {
  width: min(42%, 320px);
}

.map-skeleton.is-hidden {
  display: none;
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.map-legend {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  scrollbar-width: none;
}

.map-legend::-webkit-scrollbar {
  display: none;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
}

.legend-dot.urgent {
  background: var(--red);
}

.legend-dot.review {
  background: var(--amber);
}

.legend-dot.done {
  background: var(--green);
}

.legend-dot.excluded {
  background: #64748b;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin-top: 14px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.search-field svg {
  width: 19px;
  height: 19px;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-field input {
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}

.quick-filter-row,
.active-chip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.quick-filter-row::-webkit-scrollbar,
.active-chip-row::-webkit-scrollbar {
  display: none;
}

.quick-filter-row {
  margin-top: 12px;
}

.active-chip-row {
  margin-top: 8px;
}

.filter-chip,
.active-chip {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-soft);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.filter-chip.is-active {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.active-chip {
  padding: 0 8px 0 10px;
  background: var(--surface-muted);
}

.active-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
}

.active-chip svg {
  width: 14px;
  height: 14px;
}

.sort-row {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.sort-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sort-row select {
  width: 168px;
  height: 34px;
  padding: 0 8px;
  font-size: 13px;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.notification-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.notification-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.notification-card.is-selected {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary-soft) 38%, var(--surface));
}

.notification-card.is-disabled {
  opacity: 0.68;
}

.notification-card.is-active {
  outline: 3px solid color-mix(in srgb, var(--primary) 18%, transparent);
}

.select-check {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: transparent;
  flex: 0 0 auto;
}

.select-check input {
  position: absolute;
  opacity: 0;
}

.select-check svg {
  width: 17px;
  height: 17px;
}

.select-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.card-title {
  min-width: 0;
  flex: 1;
}

.card-title strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 790;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
}

.address-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.address-line svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--primary);
}

.address-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-bottom {
  flex-wrap: wrap;
  gap: 7px;
}

.status-pill,
.priority-pill,
.route-chip {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
}

.status-pill svg,
.priority-pill svg,
.route-chip svg {
  width: 14px;
  height: 14px;
}

.status-pill.validated {
  border-color: color-mix(in srgb, var(--green) 26%, var(--line));
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.review {
  border-color: color-mix(in srgb, var(--amber) 28%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.missing {
  border-color: color-mix(in srgb, var(--red) 28%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.corrected {
  border-color: color-mix(in srgb, var(--violet) 28%, var(--line));
  background: var(--violet-soft);
  color: var(--violet);
}

.priority-pill.critica,
.priority-pill.alta {
  border-color: color-mix(in srgb, var(--red) 24%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.priority-pill.media {
  border-color: color-mix(in srgb, var(--amber) 24%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.priority-pill.baja {
  border-color: color-mix(in srgb, var(--green) 22%, var(--line));
  background: var(--green-soft);
  color: var(--green);
}

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

.meta-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.meta-item strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confidence {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.confidence svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.empty-state,
.optimizing-state,
.no-results {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 26px 12px;
  text-align: center;
}

.empty-state h3,
.no-results h3 {
  font-size: 16px;
}

.empty-state p,
.no-results p {
  max-width: 310px;
  font-size: 13px;
}

.route-illustration {
  position: relative;
  width: 164px;
  height: 96px;
}

.route-illustration::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 48px;
  height: 4px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, var(--primary), var(--primary) 12px, transparent 12px, transparent 20px);
  opacity: 0.7;
}

.route-node {
  position: absolute;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.route-node:nth-child(1) {
  left: 8px;
  top: 32px;
  background: var(--green);
}

.route-node:nth-child(2) {
  left: 65px;
  top: 16px;
  background: var(--amber);
}

.route-node:nth-child(3) {
  right: 10px;
  top: 44px;
  background: var(--violet);
}

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

.selection-card.is-empty {
  display: none;
}

.selection-header strong,
.route-header strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 790;
}

.selection-header span,
.route-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.metric-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.metric-card strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 820;
}

.metric-card span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.selection-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.warning-box,
.info-box,
.manual-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  border-radius: var(--radius);
}

.warning-box {
  border: 1px solid color-mix(in srgb, var(--amber) 28%, var(--line));
  background: var(--amber-soft);
}

.info-box {
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  background: var(--primary-soft);
}

.manual-box {
  border: 1px solid color-mix(in srgb, var(--violet) 28%, var(--line));
  background: var(--violet-soft);
}

.warning-box svg,
.info-box svg,
.manual-box svg {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.warning-box svg {
  color: var(--amber);
}

.info-box svg {
  color: var(--primary);
}

.manual-box svg {
  color: var(--violet);
}

.warning-box strong,
.info-box strong,
.manual-box strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.warning-box span,
.info-box span,
.manual-box span {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.inline-actions .ghost-btn,
.inline-actions .soft-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.route-card {
  overflow: hidden;
}

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

.route-summary {
  display: grid;
  gap: 11px;
}

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

.route-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.route-chip {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text-soft);
}

.progress-card {
  display: grid;
  gap: 14px;
  width: 100%;
}

.progress-visual {
  position: relative;
  height: 128px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.progress-visual svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.progress-visual path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 16 12;
  animation: routeFlow 1.3s linear infinite;
}

.progress-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--surface);
  border-radius: 999px;
  background: var(--primary);
  box-shadow: var(--shadow-soft);
}

.progress-dot:nth-child(2) {
  left: 17%;
  top: 54%;
}

.progress-dot:nth-child(3) {
  left: 44%;
  top: 30%;
  background: var(--amber);
}

.progress-dot:nth-child(4) {
  left: 72%;
  top: 58%;
  background: var(--green);
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.28s ease;
}

.progress-message {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

.timeline {
  position: relative;
  display: grid;
  gap: 10px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.timeline-item.is-active {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
  background: color-mix(in srgb, var(--primary-soft) 34%, var(--surface));
}

.timeline-item.is-excluded {
  opacity: 0.68;
}

.timeline-item.is-dragging {
  opacity: 0.45;
  transform: scale(0.99);
}

.timeline-marker {
  position: relative;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}

.timeline-marker.review {
  background: var(--amber);
}

.timeline-marker.urgent {
  background: var(--red);
}

.timeline-marker.done {
  background: var(--green);
}

.timeline-marker.excluded {
  background: #64748b;
}

.timeline-body {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.timeline-title {
  min-width: 0;
}

.timeline-title strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 790;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-title span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drag-handle {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: grab;
}

.drag-handle svg {
  width: 17px;
  height: 17px;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 12px;
}

.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.timeline-actions button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.move-buttons {
  display: inline-flex;
  gap: 5px;
}

.move-buttons .icon-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.detail-drawer,
.filter-sheet {
  position: fixed;
  z-index: 80;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(110%);
  transition: transform 0.22s ease;
}

.detail-drawer.is-open,
.filter-sheet.is-open {
  transform: translateY(0);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.34);
}

.sheet-handle {
  width: 44px;
  height: 4px;
  margin: 10px auto 6px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-header,
.detail-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.filter-content,
.detail-content {
  display: grid;
  gap: 13px;
  padding: 14px;
}

fieldset {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

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

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 720;
}

.choice input {
  accent-color: var(--primary);
}

.check-list {
  display: grid;
  gap: 9px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  color: var(--text-soft);
  font-weight: 650;
}

.check-list input {
  accent-color: var(--primary);
}

.sheet-actions,
.drawer-actions {
  position: sticky;
  bottom: 0;
  flex-wrap: wrap;
  padding: 12px 14px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.sheet-actions > *,
.drawer-actions > * {
  flex: 1;
  min-width: min(100%, 142px);
}

.detail-content {
  padding-bottom: 16px;
}

.detail-identity {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.detail-identity strong {
  color: var(--text);
  font-size: 17px;
}

.detail-grid {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.detail-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-row strong,
.detail-row p {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 670;
}

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

.attachment-tile {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 72%, var(--surface)), var(--surface-strong));
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  width: min(92vw, 420px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-weight: 700;
}

.mobile-action-bar {
  position: fixed;
  z-index: 50;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.mobile-action-bar:empty {
  display: none;
}

.mobile-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-bar-top strong {
  color: var(--text);
  font-size: 14px;
}

.mobile-bar-top span {
  color: var(--muted);
  font-size: 12px;
}

.skeleton-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.skeleton-line {
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--surface), var(--line));
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-line.short {
  width: 45%;
}

.skeleton-line.medium {
  width: 68%;
}

.skeleton-line.long {
  width: 92%;
}

@media (max-width: 420px) {
  .topbar-actions .ghost-btn span,
  .topbar-actions .ghost-btn strong {
    display: none;
  }

  .topbar-actions .ghost-btn {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .sort-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .sort-row label,
  .sort-row select {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 620px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

@media (min-width: 900px) {
  .title-block p,
  .date-chip,
  .breadcrumb {
    display: flex;
  }

  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  h1 {
    font-size: 22px;
  }

  .workspace {
    padding: 16px 18px 24px;
  }

  .detail-drawer,
  .filter-sheet {
    top: calc(var(--topbar-height) + 18px);
    right: 18px;
    bottom: 18px;
    left: auto;
    width: min(420px, calc(100vw - 36px));
    max-height: none;
    border-radius: var(--radius);
    transform: translateX(calc(100% + 30px));
  }

  .detail-drawer.is-open,
  .filter-sheet.is-open {
    transform: translateX(0);
  }

  .sheet-handle {
    display: none;
  }

  .mobile-action-bar {
    display: none;
  }
}

@media (min-width: 1120px) {
  .workspace {
    grid-template-areas:
      "setup map right"
      "list map right";
    grid-template-columns: minmax(318px, 360px) minmax(0, 1fr) minmax(330px, 386px);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    height: calc(100vh - var(--topbar-height));
    min-height: 620px;
  }

  .setup-panel,
  .list-panel,
  .right-panel,
  .map-panel {
    min-height: 0;
  }

  .setup-panel {
    max-height: 390px;
    overflow: auto;
  }

  .list-panel,
  .right-panel {
    overflow: auto;
  }

  .map-card {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .simulated-map {
    min-height: 0;
    height: 100%;
  }

  .right-panel {
    align-content: start;
  }

  .selection-card.is-empty {
    display: none;
  }
}

@media (min-width: 1360px) {
  .workspace {
    grid-template-columns: minmax(340px, 390px) minmax(0, 1fr) minmax(360px, 420px);
  }
}
