/* Wanaku Prospect — styled on the suite tokens in wanaku-tokens.css.
 * App-specific tokens only below; never restate a suite token. */

:root {
  /* Prospect's tool accent (lime — the unclaimed hue family in the §4 catalog).
   * Chrome-only: 4px card rail + 10% wash chip. */
  --prospect: #84cc16;
  --prospect-wash: #84cc161a;

  /* Stage funnel ramp: gray lead -> brand blues -> copper/amber mid-funnel -> green won */
  --stage-lead: var(--muted-2);
  --stage-reached-out: color-mix(in srgb, var(--brand) 45%, var(--muted-2));
  --stage-gatekeeper-contacted: color-mix(in srgb, var(--brand) 70%, var(--muted-2));
  --stage-buyer-contacted: var(--brand);
  --stage-appointment-set: var(--accent);
  --stage-meeting-held: var(--warning);
  --stage-engaged: color-mix(in srgb, var(--success) 70%, var(--background));
  --stage-active: var(--success);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 2px 6px rgba(0, 0, 0, .08);

  /* Multi-day trip palette. Day 1 = brand blue; 2-7 are hue-spaced siblings of
   * the suite tool-accent catalog, tuned for pin-numeral contrast. Day 8 cycles. */
  --day-1: #2c6ad4;
  --day-2: #b5840f;
  --day-3: #178f5f;
  --day-4: #7a4fd6;
  --day-5: #c73a6a;
  --day-6: #0e8796;
  --day-7: #a13a9e;
  --day-pin-fg: #ffffff;
}

.dark {
  --day-1: #6fa6ff;
  --day-2: #e8b338;
  --day-3: #34c58a;
  --day-4: #b493f5;
  --day-5: #f581a4;
  --day-6: #45c7d8;
  --day-7: #e07bd4;
  --day-pin-fg: #0b1622;
}

html { color-scheme: light; }
html.dark { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--foreground);
  background: var(--background);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--brand-subtle); }
button { font-family: var(--font-sans); cursor: pointer; }
button:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-subtle); }

/* ---- App header ---------------------------------------------- */
.app-header {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: var(--space-sm); }
/* Wordmark lockup — mirrors wanaku-portal/components/brand/Wordmark.tsx (size 28) */
.lockup { display: flex; align-items: center; gap: 8px; }
.lockup .mark { display: block; flex-shrink: 0; }
.lockup-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--foreground);
}
.lockup-suffix { font-weight: 400; color: var(--muted); }

/* Waffle trigger matches the canonical SuiteSwitcher: borderless icon button */
.waffle-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: var(--radius-card);
  transition: background .15s ease, color .15s ease;
}
.waffle-btn:hover { background: var(--surface-2); color: var(--foreground); }

/* Suite switcher (waffle) — mirrors the canonical SuiteSwitcher component */
.suite-switcher { position: relative; }
.waffle-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 100;
  width: 288px;
  padding: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow);
}
.waffle-menu.hidden { display: none; }
.waffle-portal {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
}
.waffle-portal:hover { background: var(--surface-2); }
.waffle-sep { margin: var(--space-sm) 0; border-top: 1px solid var(--border); }
.waffle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.waffle-grid a, .waffle-grid span {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--tool-accent, var(--border));
  border-radius: var(--radius-card);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.waffle-grid a:hover { background: var(--surface-2); color: var(--foreground); }
.waffle-grid span[aria-current] {
  background: var(--brand-subtle);
  color: var(--brand);
  font-weight: 500;
  cursor: default;
}
.header-actions { display: flex; gap: var(--space-sm); }
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  font-size: 15px;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--foreground); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn .icon-sun { display: none; }
.dark .icon-btn .icon-sun { display: block; }
.dark .icon-btn .icon-moon { display: none; }

/* ---- Banner --------------------------------------------------- */
.banner {
  background: var(--danger-subtle);
  color: var(--danger);
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  padding: 10px var(--space-lg);
  font-size: 13px;
  font-weight: 500;
}
.banner.hidden { display: none; }
.hidden { display: none; }

/* ---- Layout ---------------------------------------------------- */
.layout { display: flex; flex: 1; min-height: 0; position: relative; --sidebar-w: 340px; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--background);
  border-right: 1px solid var(--border);
  min-height: 0;
  transition: margin-left .2s ease;
}
.layout.collapsed .sidebar {
  margin-left: calc(-1 * var(--sidebar-w));
  visibility: hidden;
  transition: margin-left .2s ease, visibility 0s .2s;
}
.sidebar-toggle {
  position: absolute;
  top: var(--space-md);
  left: calc(var(--sidebar-w) + var(--space-md));
  z-index: 10;
  box-shadow: var(--shadow);
  transition: left .2s ease;
}
.layout.collapsed .sidebar-toggle { left: var(--space-md); }

/* ---- Resize handles ------------------------------------------- */
.sidebar-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-w) - 3px);
  width: 7px;
  cursor: col-resize;
  z-index: 20;
}
.sidebar-resizer:hover, .sidebar-resizer.active {
  background: color-mix(in srgb, var(--brand) 35%, transparent);
}
.layout.collapsed .sidebar-resizer { display: none; }

.split-resizer {
  flex-shrink: 0;
  height: 8px;
  margin: -7px 0;
  z-index: 5;
  cursor: row-resize;
  border-radius: 4px;
}
.split-resizer:hover, .split-resizer.active {
  background: color-mix(in srgb, var(--brand) 35%, transparent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.section-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ---- Setup card (ClickUp connection) ---------------------------- */
.setup-card { padding: var(--space-md) var(--space-lg) var(--space-lg); }
.setup-card.hidden { display: none; }
.setup-step.hidden { display: none; }
.setup-note { font-size: 13px; color: var(--muted); margin: var(--space-sm) 0; }
.setup-note strong { color: var(--foreground); }
.setup-step .input { margin-bottom: var(--space-sm); }
.setup-list {
  list-style: none;
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.setup-list li {
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.setup-list li:last-child { border-bottom: none; }
.setup-list li:hover { background: var(--brand-subtle); }
.setup-list .list-path { display: block; font-size: 11px; color: var(--muted-2); }
.setup-msg { font-size: 12px; margin-top: var(--space-sm); color: var(--muted); }
.setup-msg.error { color: var(--danger); }
.setup-manage { display: flex; gap: var(--space-sm); margin-top: var(--space-md); }
.setup-manage .danger { color: var(--danger); border-color: var(--danger); }
.setup-manage .danger:hover { background: var(--danger-subtle); }

/* ---- Prospects card -------------------------------------------- */
.prospects-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: var(--space-md);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 var(--space-lg) var(--space-sm);
}
.panel-head .section-header, .panel-head .count-line { padding: 0; }
.filters { padding: 0 var(--space-lg) var(--space-sm); }
.filters input[type="search"] { margin-bottom: 6px; }
.filter-row { display: flex; gap: var(--space-sm); }
.filter-row select { flex: 1; width: auto; }
.count-line {
  font-size: 12px;
  color: var(--muted-2);
}

/* ---- Inputs ----------------------------------------------------- */
.input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--foreground);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 6px 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--muted-2); }
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-subtle);
}

/* ---- Prospect list ---------------------------------------------- */
.prospect-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.prospect-list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 5px var(--space-md) 5px var(--space-lg);
  line-height: 1.3;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  cursor: pointer;
}
.prospect-list li:hover { background: var(--surface-2); }
.prospect-list li.selected {
  background: var(--brand-subtle);
  box-shadow: inset 3px 0 0 var(--brand);
}
.prospect-list .empty-note { padding: var(--space-lg); }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prospect-name {
  flex: 1;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prospect-region {
  font-size: 11px;
  color: var(--muted-2);
  flex-shrink: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Trip card --------------------------------------------------- */
.trip-card {
  flex-shrink: 0;
  max-height: 58vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-left: 4px solid var(--prospect);
}
.trip-card-header, .trip-settings, .trip-actions, .distribute-panel, .trip-footer { flex-shrink: 0; }
.trip-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.badge.hidden { display: none; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.trip-fields { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--space-sm); }
.field-row { display: flex; gap: var(--space-sm); }
.field { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.field-narrow { flex: 0 0 64px; }
.field-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted-2);
}

/* Place autocomplete dropdown */
.pac-wrap { position: relative; }
.pac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pac-list li {
  padding: 7px 10px;
  font-size: 13px;
  color: var(--foreground);
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.pac-list li:last-child { border-bottom: none; }
.pac-list li:hover, .pac-list li.active { background: var(--brand-subtle); }
.pac-list .pac-note { color: var(--muted-2); cursor: default; font-size: 12px; }
.pac-list .pac-note:hover { background: none; }

/* ---- Multi-day trip body ------------------------------------------ */
.trip-settings { margin-bottom: var(--space-sm); }
.trip-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: var(--space-sm);
}

.anchor-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.anchor-row .anchor-glyph {
  flex-shrink: 0;
  width: 18px;
  color: var(--muted-2);
  display: inline-flex;
  justify-content: center;
}
.trip-body.multi > .anchor-row { padding-left: 16px; }
.anchor-row .pac-wrap { flex: 1; }
.anchor-row .input { font-size: 12px; padding: 5px 8px; }

.day-section { border-radius: var(--radius-card); }
.day-section.active-day { background: color-mix(in srgb, var(--brand-subtle) 55%, transparent); }
.day-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  cursor: pointer;
  border-radius: var(--radius-card);
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}
.day-header:hover { background: var(--surface-2); }
.day-header .chevron { color: var(--muted-2); font-size: 10px; width: 10px; flex-shrink: 0; }
.day-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--dc, var(--brand)); }
.day-title { flex: 0 0 auto; }
.day-meta {
  flex: 1;
  text-align: right;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.day-meta .warn-badge { color: var(--warning); font-weight: 600; }
.day-title .day-date { font-weight: 500; color: var(--muted); }
.stale-note { font-size: 11px; color: var(--muted); margin: 2px 0 var(--space-sm); }
.stale-note::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  margin-right: 6px;
  vertical-align: 1px;
}
.adding-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  flex-shrink: 0;
}
.day-body { padding: 2px 0 6px 16px; }
.day-body .depart-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 4px;
  padding-left: 24px;
  font-size: 11px;
  color: var(--muted-2);
}
.day-body .depart-row input { width: 92px; font-size: 12px; padding: 3px 6px; }
.day-actions { display: flex; align-items: center; gap: var(--space-sm); margin: 4px 0; }
.day-actions .btn-mini {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-card);
  background: var(--brand);
  border: 1px solid var(--brand);
  color: var(--brand-fg);
}
.day-actions .btn-mini:hover { background: var(--brand-hover); }
.day-actions .btn-mini.stale { background: var(--warning); border-color: var(--warning); color: #fff; }
.day-actions .btn-mini:disabled { opacity: .5; cursor: default; }
.day-actions a {
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
.day-actions .day-drive { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.day-warn {
  font-size: 12px;
  color: var(--warning);
  background: var(--warning-subtle);
  border-radius: var(--radius-card);
  padding: 5px 8px;
  margin: 4px 0;
}
.day-warn button {
  display: block;
  margin-top: 3px;
  border: none;
  background: none;
  padding: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}
.kebab-btn {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--muted-2);
  font-size: 14px;
  padding: 0 4px;
  border-radius: var(--radius-card);
}
.kebab-btn:hover { color: var(--foreground); background: var(--surface-2); }

.kebab-menu {
  position: fixed;
  z-index: 300;
  min-width: 170px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow);
}
.kebab-menu.hidden { display: none; }
.kebab-menu button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--foreground);
  border-radius: var(--radius-card);
}
.kebab-menu button:hover { background: var(--surface-2); }
.kebab-menu .menu-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.kebab-menu .menu-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kebab-menu button.danger { color: var(--danger); }

.stop-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.stop-badge.late { color: var(--danger); background: var(--danger-subtle); }
.stop-badge.wait { color: var(--warning); background: var(--warning-subtle); }
.itinerary .wait-note { color: var(--warning); }

.trip-footer {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--muted);
}
.trip-footer .totals-line { font-weight: 600; color: var(--foreground); margin-bottom: 4px; }
.trip-footer .links { display: flex; flex-wrap: wrap; gap: 6px; }
.trip-footer .links a, .trip-footer .links button {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand);
  text-decoration: none;
  cursor: pointer;
}
.trip-footer .links a:hover, .trip-footer .links button:hover { background: var(--surface-2); }
.trip-footer.hidden { display: none; }

.distribute-panel {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
}
.distribute-panel.hidden { display: none; }
.distribute-panel input { width: 52px; text-align: center; }
.distribute-panel .btn-mini {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-card);
  background: var(--brand);
  border: 1px solid var(--brand);
  color: var(--brand-fg);
}

/* ---- Day legend (map overlay) -------------------------------------- */
.day-legend {
  position: absolute;
  bottom: 22px;
  left: calc(var(--sidebar-w) + (100% - var(--sidebar-w)) / 2);
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 4px;
  max-width: min(80vw, 640px);
  overflow-x: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: left .2s ease;
  scrollbar-width: none;
}
.day-legend::-webkit-scrollbar { display: none; }
.layout.collapsed .day-legend { left: 50%; }
.day-legend.hidden { display: none; }
.day-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.day-chip:hover { background: var(--surface-2); color: var(--foreground); }
.day-chip[aria-selected="true"] {
  background: color-mix(in srgb, var(--chip-day, var(--brand)) 16%, transparent);
  color: var(--foreground);
}
.day-chip .chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip-day, var(--muted-2));
  flex-shrink: 0;
}
.day-chip .chip-dot.hollow { background: transparent; border: 2px solid var(--brand); }
.day-chip .chip-count { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); }
.day-chip.empty { opacity: .5; }

/* ---- Timeline (anchors · legs · stops) ------------------------------
 * One transit line per day: an 18px node column with its axis at x=9
 * (rail: left 8px + 2px border), text at x=24. The rail is continuous —
 * it runs behind stop and anchor rows, masked by opaque node discs. */
.day-section { --tl-bg: var(--surface); }
.day-section.active-day { --tl-bg: color-mix(in srgb, var(--brand-subtle) 55%, var(--surface)); }
.timeline {
  margin: 2px 0 4px;
  --tl-rail-c: color-mix(in srgb, var(--dc, var(--brand)) 35%, var(--border-strong));
}
.tl-anchor {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
  min-height: 24px;
  padding: 0;
}
.tl-anchor::before {
  content: "";
  position: absolute;
  left: 8px;
  border-left: 2px dotted var(--tl-rail-c);
}
.tl-anchor:first-child::before { top: 50%; bottom: 0; }
.tl-anchor:last-child::before { top: 0; bottom: 50%; }
.tl-anchor .anchor-glyph {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  border-radius: 999px;
  background: var(--tl-bg, var(--surface));
}
.tl-anchor-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-anchor .tl-time { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted-2); flex-shrink: 0; }

.tl-leg { display: flex; align-items: center; min-height: 20px; }
.tl-rail {
  width: 18px;
  align-self: stretch;
  flex-shrink: 0;
  position: relative;
}
.tl-rail::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  border-left: 2px dotted var(--tl-rail-c);
}
.tl-leg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 2px 6px;
  border-radius: var(--radius-card);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  cursor: pointer;
}
.tl-leg-btn:hover { background: var(--surface-2); color: var(--foreground); }
.tl-leg-btn::after {
  content: "▾";
  font-size: 9px;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s ease;
}
.tl-leg-btn:hover::after, .tl-leg-btn:focus-visible::after { opacity: .7; }
.tl-mode { display: inline-flex; color: var(--muted-2); }
.tl-leg-btn:hover .tl-mode { color: var(--brand); }
.tl-leg-btn.nondefault .tl-mode { color: var(--brand); }
.tl-leg-btn.pending .tl-mode { color: var(--muted-2); }
.tl-leg-btn.pending .tl-leg-text { animation: tl-pulse 1.2s ease-in-out infinite; }
@keyframes tl-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .tl-leg-btn.pending .tl-leg-text { animation: none; opacity: .6; } }

.tl-stop { position: relative; padding: 0; }
.tl-stop::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  border-left: 2px dotted var(--tl-rail-c);
}
/* unoptimized timelines are bare stop lists — trim to first/last dot center */
.tl-stop:first-child::before { top: 11px; }
.tl-stop:last-child::before { top: 0; bottom: auto; height: 11px; }
.tl-stop:first-child:last-child::before { display: none; }
.tl-stop-main { display: flex; align-items: center; gap: 6px; font-size: 13px; min-height: 22px; }
.tl-stop-main .stop-dot {
  position: relative;
  width: 12px;
  height: 12px;
  margin: 0 3px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dc, var(--brand));
  border: 2px solid color-mix(in srgb, var(--dc, var(--brand)) 35%, var(--tl-bg, var(--surface)));
}
.meal-glyph {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--tl-bg, var(--surface));
}
.tl-stop.meal .stop-name { color: var(--muted); }
.tl-times {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: 18px;
  padding: 1px 6px 3px;
  width: fit-content;
  line-height: 1.4;
  border-radius: var(--radius-card);
  cursor: pointer;
}
.tl-times:hover, .tl-times:focus-visible { background: var(--surface-2); color: var(--foreground); }
.tl-times .tl-set {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
  vertical-align: 1px;
}
.tl-times .wait-note { color: var(--warning); }
.tl-times .late-note { color: var(--danger); font-weight: 600; }
.tl-times-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0 3px 24px;
  font-size: 11px;
  color: var(--muted-2);
}
.tl-times-editor.hidden { display: none; }
.tl-times-editor label { display: inline-flex; align-items: center; gap: 4px; }
.tl-times-editor input { width: 88px; font-size: 11px; padding: 2px 5px; font-family: var(--font-mono); }
.tl-times-editor .tl-con-clear {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-card);
  cursor: pointer;
}
.tl-times-editor .tl-con-clear:hover { color: var(--danger); background: var(--danger-subtle); }

.add-place { margin: 2px 0 4px 18px; }
.add-place-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px dashed var(--border-strong);
  background: none;
  color: var(--muted-2);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.add-place-btn:hover { color: var(--foreground); border-color: var(--muted-2); }
.add-place-btn.hidden, .add-place .pac-wrap.hidden { display: none; }

/* ---- Stop row controls --------------------------------------------- */
.tl-stop-main .remove-btn {
  border: none;
  background: none;
  color: var(--muted-2);
  font-size: 14px;
  flex-shrink: 0;
}
.tl-stop-main .remove-btn:hover { color: var(--danger); }
.tl-stop-main .stop-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-stop-main .kebab-btn { flex-shrink: 0; }
/* hover-reveal: quiet rows, real hit targets */
.tl-stop-main .kebab-btn, .tl-stop-main .remove-btn {
  width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .12s ease;
}
.tl-stop:hover .kebab-btn, .tl-stop:hover .remove-btn,
.tl-stop:focus-within .kebab-btn, .tl-stop:focus-within .remove-btn { opacity: 1; }

.empty-note {
  font-size: 12px;
  color: var(--muted-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  padding: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-sm);
}

/* ---- Buttons ------------------------------------------------------- */
.trip-actions { display: flex; gap: var(--space-sm); margin-bottom: 0; }
.btn-primary, .btn-secondary {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-card);
  transition: background .15s ease, border-color .15s ease;
}
.btn-primary {
  flex: 1;
  background: var(--brand);
  border: 1px solid var(--brand);
  color: var(--brand-fg);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { opacity: .5; cursor: default; background: var(--brand); border-color: var(--brand); }
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--foreground);
}
.btn-secondary:hover { background: var(--surface-2); }

/* ---- Itinerary ------------------------------------------------------ */
.itinerary {
  font-size: 13px;
  color: var(--muted);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: var(--space-sm);
}
.itinerary.hidden { display: none; }
.itinerary .totals {
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
}
.itinerary .leg {
  padding: 3px 0 3px 10px;
  line-height: 1.3;
  border-left: 2px solid var(--brand-subtle);
  margin-left: 8px;
}
.itinerary .leg strong {
  color: var(--foreground);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.itinerary .drive {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
}
.itinerary .times {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
}
.itinerary .links {
  margin-top: var(--space-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.itinerary .links a, .itinerary .links button {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand);
  text-decoration: none;
  transition: background .15s ease;
}
.itinerary .links a:hover, .itinerary .links button:hover { background: var(--surface-2); }
.itinerary .error {
  color: var(--danger);
  background: var(--danger-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-sm) var(--space-md);
}

/* ---- Map -------------------------------------------------------------- */
#map { flex: 1; background: var(--surface-2); }

/* ---- Info window ------------------------------------------------------- */
.iw { font-family: var(--font-sans); font-size: 13px; max-width: 260px; color: var(--muted); }
.iw h3 { font-size: 14px; font-weight: 700; color: var(--foreground); margin-bottom: 4px; padding-right: 22px; }
.iw p { margin: 2px 0; }
.iw .iw-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--chip, var(--muted));
  background: color-mix(in srgb, var(--chip, var(--muted)) 14%, transparent);
}
.stage-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.iw .iw-actions { margin-top: 8px; display: flex; align-items: center; gap: var(--space-sm); }
.iw .iw-actions button {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-card);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-fg);
}
.iw .iw-actions button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.iw .iw-actions button.in-trip {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}
.iw .iw-actions button.in-trip:hover { background: var(--danger-subtle); }
.iw a { color: var(--brand); font-weight: 500; }

/* Google info-window chrome (Google-rendered DOM; !important beats Google's
   own white backgrounds, which load after this sheet) */
.gm-style .gm-style-iw-c {
  background: var(--surface) !important;
  color: var(--foreground);
  border-radius: var(--radius-tile) !important;
}
.gm-style .gm-style-iw-d {
  background: transparent !important;
  overflow: auto !important;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.gm-style .gm-style-iw-d::-webkit-scrollbar { width: 8px; }
.gm-style .gm-style-iw-d::-webkit-scrollbar-track { background: transparent; }
.gm-style .gm-style-iw-d::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
/* Collapse Google's header row (it only holds the close button) so content
   starts at the top; float the close button into the corner instead. */
.gm-style .gm-style-iw-ch, .gm-style .gm-style-iw-chr { background: transparent !important; height: 0 !important; overflow: visible; }
.gm-style .gm-style-iw-chr button.gm-ui-hover-effect {
  position: absolute !important;
  top: 4px !important;
  right: 4px !important;
  width: 28px !important;
  height: 28px !important;
  z-index: 1;
}
.gm-style .gm-style-iw-c { padding: 14px 16px 12px !important; }
.gm-style .gm-style-iw-tc::after { background: var(--surface) !important; }
.dark .gm-style .gm-style-iw-c { box-shadow: 0 2px 7px 1px rgba(0, 0, 0, 0.6); }
.dark .gm-style button.gm-ui-hover-effect > span { background-color: var(--muted) !important; }
.dark .gm-style button.gm-ui-hover-effect img { filter: invert(0.8); }

/* ---- Scrollbars ---------------------------------------------------------- */
.prospect-list, .itinerary, .trip-body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.prospect-list::-webkit-scrollbar, .itinerary::-webkit-scrollbar, .trip-body::-webkit-scrollbar { width: 8px; }
.prospect-list::-webkit-scrollbar-track, .itinerary::-webkit-scrollbar-track, .trip-body::-webkit-scrollbar-track { background: transparent; }
.prospect-list::-webkit-scrollbar-thumb, .itinerary::-webkit-scrollbar-thumb, .trip-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
