/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --ink: #142033;
  --ink-soft: #627188;
  --line: #d9e4ef;
  --accent: #0e7490; /* cool harbor blue */
  --accent-ink: #0a5268;
  --accent-soft: #e5f5fa;
  --md: #f5b400; /* MotherDuck duck-amber — warehouse pane tint */
  --user-bg: #e7f0ff;
  --tool-bg: #f8fbfe;
  --tool-line: #d2e0ec;
  --geotab: #0a7d3c;
  --web: #2563eb;
  --gmail: #c5221f;
  --gcal: #1a73e8;
  --assistant-tool: #0e7490;
  --salesforce: #00a1e0;
  --write: #0a7d3c;
  --notice: #685b00;
  --notice-bg: #fff8d8;
  --notice-line: #dfce74;
  --radius: 16px;
  --maxw: 820px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  /* Grow with the conversation rather than locking to the viewport. A fixed
     height: 100% let flexbox shrink the sticky tray (flex-shrink defaults to 1)
     into a tiny overflow:auto strip on long transcripts, hiding the choice
     chips. min-height keeps short conversations full-bleed while letting long
     ones scroll the page normally. */
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(14, 116, 144, 0.09), transparent 34rem),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 42%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------ header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: url("assets/geotab-mark.png?v=d4e1997") center/cover no-repeat;
  box-shadow: 0 6px 18px rgba(10, 82, 104, 0.18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; }

.conn-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.conn-off { color: var(--ink-soft); background: var(--panel); }
.conn-on { color: var(--geotab); border-color: color-mix(in srgb, var(--geotab) 35%, var(--line)); background: color-mix(in srgb, var(--geotab) 8%, white); }

.ghost-btn {
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.ghost-btn:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.settings-trigger { font-weight: 650; }

.ui-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* -------------------------------------------------------------------- chat */
.chat {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.empty-state {
  border: 1px dashed var(--tool-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 72%, var(--accent-soft));
  padding: 28px 30px;
  color: var(--ink-soft);
}
.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.empty-state p { margin: 0; }
.empty-kicker {
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.row { display: flex; gap: 12px; align-items: flex-start; animation: rise 0.25s ease both; }
.row.user { flex-direction: row-reverse; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  margin-top: 2px;
}
.avatar.assistant { background: url("assets/geotab-mark.png?v=d4e1997") center/cover no-repeat; }
.avatar.user { background: #4b5563; border-radius: 999px; }
.avatar.system { background: #91a0b2; border-radius: 999px; }

.bubble {
  max-width: 100%;
  border-radius: var(--radius);
  padding: 2px 0;
}
.row.user .bubble {
  background: var(--user-bg);
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: 80%;
}

/* prose */
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose p { margin: 0.5em 0; }
.prose h1, .prose h2, .prose h3 { margin: 0.8em 0 0.35em; line-height: 1.25; }
.prose h1 { font-size: 1.3em; }
.prose h2 { font-size: 1.15em; }
.prose h3 { font-size: 1.02em; }
.prose ul, .prose ol { margin: 0.4em 0; padding-left: 1.4em; }
.prose li { margin: 0.18em 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #edf4fb;
  padding: 0.1em 0.35em;
  border-radius: 5px;
}
.prose blockquote {
  margin: 0.6em 0;
  padding: 0.2em 0 0.2em 0.9em;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
.prose a { color: var(--accent-ink); }
.prose strong { font-weight: 650; }

/* system line */
.system-line {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  animation: rise 0.25s ease both;
}
.system-line .prose strong { color: var(--ink); }

/* ------------------------------------------------------------- tool cards */
.tool-card {
  border: 1px solid var(--tool-line);
  background: var(--tool-bg);
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
  animation: rise 0.25s ease both;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 9px 12px;
  color: var(--ink);
}
.tool-head:hover { background: color-mix(in srgb, var(--tool-bg) 70%, var(--bg)); }
.tool-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--geotab);
}
.tool-server {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tool-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
}
.tool-summary {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}
.tool-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--write);
}
.tool-caret { color: var(--ink-soft); font-size: 11px; transition: transform 0.15s; }
.tool-card.open .tool-caret { transform: rotate(90deg); }

.tool-body {
  display: none;
  border-top: 1px dashed var(--tool-line);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink);
}
.tool-card.open .tool-body { display: block; }
.tool-body .lbl {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin: 0 0 4px;
}
.tool-body pre {
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid var(--tool-line);
  border-radius: 7px;
  padding: 8px 10px;
}
.tool-body pre:last-child { margin-bottom: 0; }

/* per-server dot colors (shared by tool cards and the pending-call line) */
[data-server="geotab"] .tool-dot { background: var(--geotab); }
[data-server="web"] .tool-dot { background: var(--web); }
[data-server="gmail"] .tool-dot { background: var(--gmail); }
[data-server="google-calendar"] .tool-dot { background: var(--gcal); }
[data-server="assistant"] .tool-dot { background: var(--assistant-tool); }
[data-server="salesforce"] .tool-dot { background: var(--salesforce); }

/* a tool call in flight, before its result card lands */
.tool-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 6px 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
  animation: rise 0.2s ease both;
}
.tool-dot.pending { animation: pending-pulse 0.9s ease-in-out infinite; }
@keyframes pending-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* db badge under an answer's tools */
.db-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 2px;
}

/* ----------------------------------------------------------- typing dots */
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.5;
  animation: blink 1.2s infinite both;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-2px); }
}

/* blinking cursor at the end of the user's in-progress "typed" message */
.caret {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 1px;
  background: currentColor;
  vertical-align: -0.15em;
  animation: caret-blink 0.9s step-end infinite;
}
@keyframes caret-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ------------------------------------------------------------ confirm card */
.confirm-card {
  border: 1px solid var(--write);
  background: color-mix(in srgb, var(--write) 8%, var(--panel));
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  animation: rise 0.25s ease both;
}
.cf-head { font-weight: 700; color: var(--write); }
.cf-list { margin: 6px 0 0; padding-left: 1.3em; font-size: 13.5px; }
.cf-list li { margin: 2px 0; }

/* ---------------------------------------------------------------- endcard */
/* deliberately styled to look like product chrome, not an assistant reply: a
   dashed top divider, a muted background distinct from the tool-card/bubble
   palette, and an explicit "not part of the reply" badge. */
.endcard {
  border: 1px dashed var(--line);
  border-top-width: 2px;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 10px 0 4px;
  animation: rise 0.25s ease both;
}
.endcard .ec-1 { font-weight: 700; color: var(--accent-ink); }
.endcard .ec-2 { font-size: 0.95em; color: var(--ink-soft); margin-top: 2px; }
.endcard .ec-foot { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.ec-cta {
  margin-top: 12px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent-ink);
  border-radius: 8px;
  cursor: pointer;
}
.ec-cta:hover { background: var(--accent-ink); }
.ec-cta:active { transform: translateY(1px); }

.noscript-note {
  max-width: 680px;
  margin: 24px auto;
  padding: 16px 18px;
  border: 1px solid var(--tool-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}

/* visible focus ring for keyboard users (mouse clicks stay clean via :focus-visible) */
:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ chart */
.chart-card {
  border: 1px solid var(--tool-line);
  background: var(--tool-bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  animation: rise 0.25s ease both;
}
.chart-title { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px; }
.chart-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.chart-label {
  flex: 0 0 84px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: right;
  color: var(--ink);
}
.chart-track { flex: 1; background: #e8f1f8; border-radius: 6px; overflow: hidden; height: 22px; }
.chart-fill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 22px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--geotab) 70%, white), var(--geotab));
  border-radius: 6px;
  transition: width 0.5s ease;
}
.chart-val { color: #fff; font-size: 11.5px; font-weight: 700; padding-right: 7px; }

/* -------------------------------------------------------------------- map */
.map-card {
  border: 1px solid color-mix(in srgb, var(--tool-line) 86%, white);
  background: color-mix(in srgb, var(--tool-bg) 78%, white);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 6px 0;
  animation: rise 0.25s ease both;
}
.map-title { font-size: 12.5px; font-weight: 650; color: #52627a; margin-bottom: 10px; }
.map-canvas {
  position: relative;
  aspect-ratio: 1200 / 520;
  min-height: 0;
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.72), transparent 18%),
    radial-gradient(circle at 84% 74%, rgba(34, 112, 72, 0.08), transparent 28%),
    linear-gradient(135deg, #edf3ee 0%, #e8eff1 44%, #eef4ea 100%);
  border: 1px solid #ccd8df;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.64),
    inset 0 -26px 50px rgba(35, 62, 76, 0.045),
    0 8px 24px rgba(20, 32, 51, 0.04);
  overflow: hidden;
}
.map-canvas::before,
.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-canvas::before {
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.16) 0 7%, transparent 7% 19%, rgba(255, 255, 255, 0.12) 19% 23%, transparent 23% 100%),
    radial-gradient(circle at 26% 82%, rgba(14, 116, 144, 0.055), transparent 18%);
  mix-blend-mode: soft-light;
  opacity: 0.9;
}
.map-canvas::after {
  box-shadow: inset 0 0 0 999px rgba(8, 21, 32, 0.018);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 40%, rgba(19, 54, 71, 0.045));
}
.map-canvas-valencia,
.map-canvas-vegas,
.map-canvas-hotspot {
  background-size: 100% 100%;
  background-position: center;
}
.map-canvas-valencia {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(242, 248, 249, 0.12)),
    url("assets/map-valencia.webp");
}
.map-canvas-vegas {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(242, 248, 249, 0.12)),
    url("assets/map-vegas-dispatch.webp");
}
.map-canvas-hotspot {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(242, 248, 249, 0.12)),
    url("assets/map-vegas-hotspot.webp");
}
.map-canvas-valencia .map-area-svg,
.map-canvas-valencia .map-road-svg,
.map-canvas-valencia .map-intersection-svg,
.map-canvas-vegas .map-area-svg,
.map-canvas-vegas .map-road-svg,
.map-canvas-vegas .map-intersection-svg,
.map-canvas-hotspot .map-area-svg,
.map-canvas-hotspot .map-road-svg,
.map-canvas-hotspot .map-intersection-svg {
  display: none;
}
.map-area-svg,
.map-zone-svg,
.map-road-svg,
.map-intersection-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.map-area-svg { z-index: 1; }
.map-zone-svg { z-index: 3; }
.map-road-svg { z-index: 4; }
.map-intersection-svg { z-index: 5; }
.map-area { vector-effect: non-scaling-stroke; }
.map-area-block { fill: rgba(255, 255, 255, 0.43); stroke: rgba(124, 139, 151, 0.13); stroke-width: 0.7; }
.map-area-lot { fill: rgba(255, 255, 255, 0.26); stroke: rgba(124, 139, 151, 0.11); stroke-width: 0.55; }
.map-area-park { fill: rgba(158, 205, 158, 0.38); stroke: rgba(84, 141, 95, 0.16); stroke-width: 0.7; }
.map-area-water { fill: rgba(114, 185, 207, 0.28); stroke: rgba(49, 116, 147, 0.14); stroke-width: 0.7; }
.map-area-industrial { fill: rgba(218, 225, 229, 0.54); stroke: rgba(105, 119, 132, 0.15); stroke-width: 0.7; }
.map-zone-shape {
  fill: rgba(14, 116, 144, 0.14);
  stroke: rgba(10, 82, 104, 0.72);
  stroke-width: 1.35;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}
.map-road,
.map-road-casing {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.map-road-casing-local { stroke-width: 4.2; stroke: rgba(119, 132, 145, 0.28); }
.map-road-casing-arterial { stroke-width: 7.5; stroke: rgba(91, 105, 119, 0.34); }
.map-road-casing-highway { stroke-width: 11.5; stroke: rgba(79, 96, 112, 0.30); }
.map-road-local { stroke-width: 2.5; stroke: #fbfcfb; }
.map-road-arterial { stroke-width: 5.2; stroke: #fffef9; }
.map-road-highway { stroke-width: 8.4; stroke: #dbeef2; }
.map-road-label {
  fill: rgba(80, 94, 110, 0.72);
  font-size: 2.85px;
  font-weight: 700;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.74);
  stroke-width: 1.35px;
  vector-effect: non-scaling-stroke;
}
.map-intersection {
  fill: rgba(255, 255, 255, 0.96);
  stroke: rgba(107, 122, 137, 0.34);
  stroke-width: 0.55;
  vector-effect: non-scaling-stroke;
}
.map-intersection-minor { opacity: 0.78; }
.map-zone-label {
  position: absolute;
  z-index: 7;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: #143244;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(116, 133, 148, 0.25);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(20, 32, 51, 0.12);
  backdrop-filter: blur(6px);
}
.map-pin {
  position: absolute;
  z-index: 8;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.map-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(20, 32, 51, 0.30), 0 0 0 1px rgba(20, 32, 51, 0.12);
  flex: 0 0 auto;
}
.map-pin-free .map-dot { background: #16815d; }
.map-pin-busy .map-dot { background: #0a5268; }
.map-pin-target .map-dot { background: #162238; width: 15px; height: 15px; border-radius: 4px; transform: rotate(45deg); }
.map-pin-compact .map-dot {
  width: 7px;
  height: 7px;
  border-width: 1.5px;
  opacity: 0.74;
}
.map-pin-busy:not(.map-pin-compact)::before,
.map-pin-target:not(.map-pin-compact)::before {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  left: -9px;
  top: -9px;
  border-radius: 50%;
  background: rgba(10, 82, 104, 0.14);
  border: 1px solid rgba(10, 82, 104, 0.17);
  z-index: -1;
}
.map-tag {
  font-size: 11px;
  font-weight: 700;
  color: #172337;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(122, 139, 154, 0.24);
  border-radius: 7px;
  padding: 3px 7px;
  box-shadow: 0 2px 9px rgba(20, 32, 51, 0.12);
  backdrop-filter: blur(6px);
}
.map-tag-val { font-weight: 500; color: #617086; }
.map-chrome {
  position: absolute;
  z-index: 10;
  top: 9px;
  left: 9px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(20, 32, 51, 0.66);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(122, 139, 154, 0.22);
  border-radius: 8px;
  padding: 3px 6px;
  box-shadow: 0 1px 5px rgba(20, 32, 51, 0.08);
  backdrop-filter: blur(6px);
}
.map-zoom { color: rgba(20, 32, 51, 0.48); letter-spacing: 0.08em; }
.map-scale {
  position: absolute;
  z-index: 10;
  left: 10px;
  bottom: 9px;
  min-width: 44px;
  padding-top: 4px;
  border-top: 2px solid rgba(20, 32, 51, 0.48);
  color: rgba(20, 32, 51, 0.58);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}
.map-summary {
  display: inline-block;
  margin-top: 9px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--tool-line));
  background: color-mix(in srgb, var(--accent-soft) 52%, var(--panel));
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 650;
}
.map-disclosure { font-size: 11px; color: var(--ink-soft); margin-top: 7px; }

/* ------------------------------------------------------------------- media */
.media-card {
  border: 1px solid var(--tool-line);
  background: var(--tool-bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  animation: rise 0.25s ease both;
}
.media-disclosure {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--notice);
  background: var(--notice-bg);
  border: 1px dashed var(--notice-line);
  border-radius: 7px;
  padding: 5px 9px;
  margin-bottom: 9px;
}
.media-video {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 8px;
  background: #000;
}
.media-video.hidden { display: none; }
.media-fallback {
  display: none;
  width: 100%;
  max-width: 480px;
  padding: 30px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  background: #e8f1f8;
  border: 1px dashed var(--tool-line);
  border-radius: 8px;
}
.media-fallback.show { display: block; }
.media-caption { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

/* ------------------------------------------------------------------- tray */
.tray {
  position: sticky;
  bottom: 0;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  /* Never let the column flex squeeze the chip zone — it keeps its full height
     and the chat above it scrolls instead. */
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, var(--bg) 28%);
  /* When a node offers many choices (e.g. the hub), the chip list can exceed the
     viewport. Without a cap, sticky pins the tray bottom and clips the top chips
     with no way to reach them — so cap the height and scroll within the tray. */
  max-height: min(58vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.tray:empty { display: none; }
.chip {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.chip:hover { background: #fff; border-color: var(--accent); color: var(--accent-ink); }
.chip:active { transform: translateY(1px); }
.chip.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.primary:hover { background: var(--accent-ink); color: #fff; }
.chip.subtle { color: var(--ink-soft); }
.tray-hint { width: 100%; font-size: 12px; color: var(--ink-soft); margin: 0 2px 2px; }
.tool-hint { font-size: 12px; line-height: 1.45; color: var(--ink-soft); margin: 2px 2px 6px; }

/* ------------------------------------------------------- fleet progress game */
.progress-strip {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  margin: 0 2px 6px;
}
.progress-strip strong { color: var(--accent-ink); }
.progress-track {
  flex: 1 1 110px;
  min-width: 70px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.progress-full { width: 100%; font-weight: 600; color: var(--accent-ink); }
.chip.done { border-style: dashed; }
.chip-check { color: var(--geotab); font-weight: 700; }
.settings-flag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--notice);
  background: var(--notice-bg);
  border: 1px solid var(--notice-line);
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: 2px;
}
.tray-group {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 6px 2px 0;
}
.tray-group:first-of-type { margin-top: 0; }
.chip-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 2px 7px;
  margin-right: 7px;
  vertical-align: 1px;
}

/* ---------------------------------------------------------------- footer */
.app-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.app-footer p {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* --------------------------------------------------------------- overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(9, 29, 46, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}
.overlay.hidden { display: none; }
.overlay-panel {
  background: linear-gradient(180deg, var(--panel), var(--bg));
  border: 1px solid var(--line);
  border-radius: 20px;
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 18px 24px 20px;
  box-shadow: 0 24px 70px rgba(20, 32, 51, 0.28);
}
.overlay-head { display: flex; align-items: center; justify-content: space-between; }
.overlay-head h2 { margin: 0; font-size: 18px; }
.overlay-note { font-size: 13px; color: var(--ink-soft); margin: 6px 0 14px; }
.settings-panel { max-width: 620px; }
.settings-stack {
  display: grid;
  gap: 12px;
}
.settings-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 72%, var(--bg));
  padding: 14px;
}
.settings-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}
.settings-section h3 {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.settings-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.settings-value {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}
.settings-value strong { color: var(--accent-ink); }
.settings-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.settings-option {
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 12px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.settings-option:hover,
.settings-option.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--panel));
}
.settings-option.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}
.settings-option-title {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--accent-ink);
  margin-bottom: 4px;
}
.settings-option-copy {
  display: block;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------- hero */
.landing-panel { width: min(680px, 100%); }
.hero-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-ink);
  margin: 0 0 6px;
}
.hero-title { font-size: clamp(24px, 3.2vw, 30px); line-height: 1.12; letter-spacing: -0.035em; margin: 0 0 10px; }
.hero-sub { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 12px; }
.hero-bullets { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hero-bullets li {
  font-size: 13.5px;
  line-height: 1.42;
  background: var(--tool-bg);
  border: 1px solid var(--tool-line);
  border-radius: 14px;
  padding: 8px 12px;
}
.bullet-glyph {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.cta-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.cta-btn:active { transform: scale(0.98); }
.cta-primary { background: var(--accent); border-color: var(--accent-ink); color: #fff; }
.cta-primary:hover { background: var(--accent-ink); }
.cta-primary .ui-glyph { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.cta-secondary { background: var(--panel); color: var(--ink); }
.cta-secondary:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.hero-foot { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; }

/* -------------------------------------------------------------- try-real */
.steps-list { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 14px; }
.steps-list li { font-size: 14px; line-height: 1.55; }
.pii-box {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--notice);
  background: var(--notice-bg);
  border: 1px dashed var(--notice-line);
  border-radius: 10px;
  padding: 12px 14px;
}
.pii-box p { margin: 0 0 8px; }
.pii-box ul { margin: 0 0 8px; padding-left: 18px; }
.pii-box .pii-foot { font-style: italic; font-size: 12px; color: color-mix(in srgb, var(--notice) 80%, var(--ink-soft)); margin-bottom: 0; }

.setup-box {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.setup-docs { margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.setup-heading { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
.setup-steps { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.setup-shot {
  display: block;
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.setup-foot { font-size: 12px; color: var(--ink-soft); margin: 0; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  body { min-height: 100dvh; }
  .app-header {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  .header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .header-actions::-webkit-scrollbar { display: none; }
  .header-actions > * { flex: 0 0 auto; }
  .brand-sub { display: none; }
  .tool-summary { max-width: 38%; }
  .header-actions .ghost-btn { padding: 6px 8px; font-size: 12px; }
  .settings-row-head { flex-direction: column; align-items: stretch; }
  .settings-value { width: fit-content; }
  .settings-options { grid-template-columns: 1fr; }
  .settings-panel { max-height: calc(100dvh - 40px); overflow-y: auto; }
  .chat {
    padding: 18px 12px calc(190px + env(safe-area-inset-bottom));
    gap: 14px;
  }
  .row { gap: 9px; }
  .avatar { width: 28px; height: 28px; border-radius: 9px; }
  .row.user .bubble { max-width: 88%; }
  .tray {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    max-width: none;
    max-height: min(42vh, 260px);
    margin: 0;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(243, 247, 251, 0.94), var(--bg) 34%);
    border-top: 1px solid var(--line);
    box-shadow: 0 -14px 34px rgba(20, 32, 51, 0.16);
  }
  .chip {
    width: 100%;
    text-align: left;
    border-radius: 14px;
    padding: 11px 13px;
  }
  .tray-hint { font-size: 11.5px; margin-bottom: 1px; }
  .tray-group { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* ---------------------------------------------------------- MotherDuck state strip */
.motherduck-pane {
  position: sticky;
  top: 59px;
  z-index: 4;
  width: 100%;
  border-top: 2px solid color-mix(in srgb, var(--md) 55%, var(--line));
  border-bottom: 1px solid color-mix(in srgb, var(--md) 30%, var(--line));
  background: color-mix(in srgb, var(--md) 7%, var(--panel));
  backdrop-filter: blur(12px);
}
.motherduck-pane.hidden { display: none; }
.motherduck-pane-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: min(100%, var(--maxw));
  margin: 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 16px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.motherduck-pane-toggle:hover { background: color-mix(in srgb, var(--md) 14%, var(--panel)); }
.motherduck-pane-title { min-width: 0; display: grid; gap: 0; }
.motherduck-pane-body {
  display: block;
  width: min(100%, var(--maxw));
  max-height: 42vh;
  overflow: auto;
  margin: 0 auto;
  border-top: 1px dashed var(--line);
  padding: 10px 16px 12px;
}
.motherduck-pane.collapsed .motherduck-pane-body { display: none; }
.motherduck-pane:not(.collapsed) .warehouse-caret { transform: rotate(90deg); }
.warehouse-duck {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--md) 22%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--md) 45%, var(--line));
  font-size: 14px;
}
.warehouse-kicker {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.motherduck-pane-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  font-size: 13.5px;
}
.warehouse-subtitle {
  color: var(--ink-soft);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.warehouse-summary {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 650;
}
.warehouse-caret { color: var(--ink-soft); font-size: 11px; transition: transform 0.15s ease; }
.warehouse-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
}
.warehouse-metric {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  padding: 6px 8px;
}
.warehouse-metric-label {
  display: block;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.warehouse-metric strong { display: block; margin-top: 1px; font-size: 13px; }
.warehouse-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.warehouse-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 8px;
  min-height: 0;
}
.warehouse-stage.active { border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.warehouse-stage-title { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.warehouse-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink-soft);
}
.warehouse-stage-bronze .warehouse-stage-dot { background: #9a6b2f; }
.warehouse-stage-silver .warehouse-stage-dot { background: #64748b; }
.warehouse-stage-gold .warehouse-stage-dot { background: #9f7a24; }
.warehouse-stage-status {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.warehouse-tables { display: grid; gap: 5px; }
.warehouse-table-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tool-bg);
  padding: 5px 7px;
}
.warehouse-table-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.warehouse-row-count { color: var(--accent-ink); font-size: 11px; font-weight: 700; white-space: nowrap; }
.warehouse-table-note { grid-column: 1 / -1; color: var(--ink-soft); font-size: 10.5px; }
.warehouse-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.warehouse-sample {
  grid-column: 1 / -1;
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  padding-top: 4px;
  color: var(--ink-soft);
}
.warehouse-sample-toggle {
  cursor: pointer;
  user-select: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  list-style: none;
}
.warehouse-sample-toggle::-webkit-details-marker { display: none; }
.warehouse-sample-toggle::before {
  content: "▸";
  display: inline-block;
  margin-right: 5px;
  transition: transform 0.15s ease;
}
.warehouse-sample[open] .warehouse-sample-toggle::before { transform: rotate(90deg); }
.warehouse-sample-scroll {
  margin-top: 5px;
  overflow-x: auto;
  border-radius: 6px;
}
.warehouse-sample-grid {
  display: grid;
  grid-template-columns: repeat(var(--warehouse-sample-cols, 5), minmax(max-content, auto));
  gap: 3px 16px;
  width: max-content;
  min-width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink);
}
.warehouse-sample-cell {
  white-space: nowrap;
  padding: 1px 0;
}
.warehouse-sample-head {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  margin-bottom: 1px;
}

[data-server="motherduck"] .tool-dot { background: #6b5bd6; }

@media (max-width: 760px) {
  .motherduck-pane { top: 96px; }
  .motherduck-pane-toggle { grid-template-columns: auto minmax(0, 1fr) auto; padding-inline: 12px; }
  .warehouse-summary { display: none; }
  .warehouse-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-stages { grid-template-columns: 1fr; }
}
