/* MeetingPanda — compact planner layout: trip panel, results with timeline and map. */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #5b6474;
  --line: #e2e7ee;
  --line-strong: #cbd3de;
  --accent: #1b5fd1;
  --accent-soft: #e8f0fd;
  --accent-text: #ffffff;
  --ok: #0f8a5f;
  --ok-soft: #e4f5ee;
  --warn: #a35a00;
  --warn-soft: #fff4e2;
  --error: #b42318;
  --error-soft: #fdecea;
  --info-soft: #eef4fd;
  /* travel modes: timeline, day bars and map share these */
  --m-stop: #0f8a5f;
  --m-flight: #2563eb;
  --m-train: #7c3aed;
  --m-car: #d97706;
  --m-ride: #64748b;
  --m-night: #4338ca;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b23;
    --surface-2: #1b212b;
    --text: #e6edf5;
    --muted: #97a3b4;
    --line: #262e3a;
    --line-strong: #344052;
    --accent: #5b9cf5;
    --accent-soft: #19283f;
    --accent-text: #0b1220;
    --ok: #3ccf98;
    --ok-soft: #12291f;
    --warn: #f1b45a;
    --warn-soft: #2e2413;
    --error: #ff8a80;
    --error-soft: #331b1a;
    --info-soft: #172235;
    --m-stop: #3ccf98;
    --m-flight: #6ea8ff;
    --m-train: #b18cff;
    --m-car: #f3a64a;
    --m-ride: #94a3b8;
    --m-night: #8b8cf8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- controls ---- */
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 5px 8px; min-height: 32px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; min-height: 30px; }
.btn.wide { width: 100%; padding: 10px 14px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-text { background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.compact-select { width: auto; min-height: 30px; padding: 3px 6px; font-size: 13px; }
.chip {
  font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 2px 10px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.linkish { background: none; border: none; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.alert { border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 10px; }
.alert.error { background: var(--error-soft); color: var(--error); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--text); }
.alert ul { margin: 0; padding-left: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- app bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 1000; height: 48px; padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--m-train)); flex: none; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-right { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
/* what the planner is doing: in the bar, so nothing below moves */
.activity { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 8px; border-radius: 8px; background: var(--info-soft); font-size: 12.5px; }
.activity[hidden] { display: none; }
.activity.ok { background: var(--ok-soft); }
.activity.warn { background: var(--warn-soft); color: var(--warn); }
.activity-icon { flex: none; display: inline-grid; place-items: center; color: var(--accent); }
.activity.ok .activity-icon { color: var(--ok); }
.activity.warn .activity-icon { color: var(--warn); }
.activity-icon svg.i { width: 15px; height: 15px; }
.activity.busy .activity-icon svg { animation: spin .9s linear infinite; }
.activity-text { flex: 1; min-width: 0; background: none; border: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-close { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border: none; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.activity-close:hover { color: var(--text); background: var(--line); }
.activity-close svg.i { width: 12px; height: 12px; }
.activity.busy .activity-close { display: none; }
/* a long message opens over the page, not into it */
.activity.long .activity-text { cursor: pointer; }
.activity.expanded .activity-text { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1200; padding: 8px 10px; white-space: normal; overflow: visible; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); }
@media (max-width: 1100px) { .appbar:has(.activity:not([hidden])) .brand-sub { display: none; } }
@media (max-width: 600px) { .appbar:has(.activity:not([hidden])) .brand-name { display: none; } }
.activity-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.activity-bar[hidden] { display: none; }
.activity-bar div { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.user-name { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }

/* ---- login ---- */
.login-wrap { display: grid; place-items: center; padding: 48px 16px; }
.login-card { width: min(380px, 100%); padding: 22px; display: grid; gap: 10px; }
.login-card form { display: grid; gap: 10px; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); min-height: calc(100vh - 48px); }
/* The panel is taken out altogether, so the schedule has the only column. */
.layout.collapsed { grid-template-columns: minmax(0, 1fr); }
.layout.collapsed .panel { display: none; }
.icon-btn[hidden] { display: none; }
.panel {
  position: sticky; top: 48px; height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.panel-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.panel-tools .btn.small { padding: 4px 8px; white-space: nowrap; }
.trip-id { min-width: 0; display: grid; }
.trip-id h2 { margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-state { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-state.dirty { color: var(--warn); }
.trip-state.clean { color: var(--ok); }

/* a schedule reopened from My trips */
.saved-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; background: var(--info-soft); }
.saved-note[hidden] { display: none; }

/* saving a trip */
.save-dialog { width: min(440px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.save-dialog::backdrop, .trips-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.save-dialog form { display: grid; gap: 10px; }
.save-dialog h2 { margin: 0; font-size: 16px; }
.save-preview { display: grid; gap: 3px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; background: var(--surface-2); }
.save-preview .sp-route { font-weight: 600; }
.save-preview .sp-yes { color: var(--ok); }
.save-preview .sp-no { color: var(--warn); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* My trips */
.trips-dialog { width: min(860px, calc(100vw - 32px)); height: min(680px, calc(100vh - 32px)); max-width: none; max-height: none; padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.trips-dialog[open] { display: flex; flex-direction: column; }
.trips-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 8px; }
.trips-head h2 { margin: 0; font-size: 17px; }
.trips-head p { margin: 2px 0 0; font-size: 12px; }
.trips-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
.trips-tools input[type="search"] { flex: 1 1 180px; min-width: 0; }
.trips-dialog > .alert { margin: 10px 16px 0; }
.trips-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 10px 16px 16px; display: grid; align-content: start; gap: 8px; }
.trip-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.trip-card:hover { border-color: var(--line-strong); }
.trip-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tc-main { min-width: 0; display: grid; gap: 2px; }
.tc-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.tc-tag { padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line-strong); white-space: nowrap; }
.tc-tag.on { color: var(--accent); border-color: var(--accent); }
.tc-tag.ok { color: var(--ok); border-color: var(--ok); }
.tc-tag.warn { color: var(--warn); border-color: var(--warn); }
.tc-route { font-size: 13px; overflow-wrap: anywhere; }
.tc-facts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); }
.tc-actions { display: flex; align-items: flex-start; gap: 4px; }
.tc-rename { display: flex; gap: 6px; align-items: center; }
.tc-rename input { flex: 1; min-width: 0; }
.tc-confirm { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; }
.tc-confirm span { flex: 1 1 200px; color: var(--warn); }
.btn.danger { background: var(--error); border-color: var(--error); color: var(--accent-text); }
.trips-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.trips-empty strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 15px; }
.trips-empty .btn { margin-top: 10px; }
@media (max-width: 640px) {
  .trips-dialog { width: 100vw; height: 100dvh; border: none; border-radius: 0; }
  .trip-card { grid-template-columns: minmax(0, 1fr); }
  .tc-actions { justify-content: flex-end; }
}
.panel-body { flex: 1; overflow-y: auto; padding: 4px 14px 14px; }
.panel-foot { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.depart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stops-head { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 8px; }
.examples { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.add-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.main { min-width: 0; padding: 14px 16px 32px; }

/* ---- stop cards ---- */
.stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: stop; }
.stop {
  counter-increment: stop; position: relative; border: 1px solid var(--line); border-left: 3px solid var(--m-stop);
  border-radius: 9px; background: var(--surface-2); padding: 8px 8px 8px 10px; display: grid; gap: 6px;
}
.stop.flexible { border-left-color: var(--accent); }
.stop.invalid { border-color: var(--error); border-left-color: var(--error); }
.stop-top { display: flex; align-items: center; gap: 6px; }
.stop-num {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--m-stop);
}
.stop.flexible .stop-num { background: var(--accent); }
.stop-num::before { content: counter(stop); }
.stop-title { flex: 1; font-weight: 600; border-color: transparent; background: transparent; padding-left: 4px; }
.stop-title:hover, .stop-title:focus { border-color: var(--line-strong); background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; flex: none; }
.seg button { font: inherit; font-size: 11px; border: none; background: transparent; color: var(--muted); padding: 3px 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.opt-toggle { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; flex: none; }
.opt-toggle input { width: 14px; height: 14px; min-height: 0; margin: 0; }
.stop-remove { width: 26px; height: 26px; }
.stop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stop.flexible .stop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stop-grid .field > span { font-size: 10px; }

/* address with suggestions */
.addr { position: relative; }
.addr-row { display: flex; align-items: center; gap: 6px; }
.addr-row input { flex: 1; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700; flex: none; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted);
}
.badge.matched, .badge.picked { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge.approximate { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge.estimate { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.notFound { color: var(--error); border-color: var(--error); background: var(--error-soft); }
.badge.checking svg { animation: spin 0.9s linear infinite; }
.addr-resolved { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.addr-resolved.warn { color: var(--warn); }
.addr-resolved.error { color: var(--error); }
.suggest {
  position: absolute; z-index: 1100; left: 0; right: 68px; top: calc(100% + 2px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto;
}
.suggest li { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: grid; gap: 1px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); }
.suggest .s-name { font-weight: 600; }
.suggest .s-addr { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.suggest .s-off { opacity: .55; cursor: default; }
.suggest .s-note { font-size: 11px; color: var(--muted); padding: 4px 8px; cursor: default; }
.addr-map { width: 30px; height: 30px; flex: none; }
.badge.pinned { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* map picker */
.picker {
  width: min(1100px, calc(100vw - 32px)); height: min(720px, calc(100vh - 32px)); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden;
}
.picker[open] { display: flex; flex-direction: column; }
.picker::backdrop { background: rgba(15, 23, 42, .45); }
.picker-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.picker-head h2 { margin: 0; font-size: 16px; }
.picker-head p { margin: 2px 0 0; font-size: 12px; }
.picker-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.picker-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); padding: 10px; gap: 8px; }
.picker-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: grid; align-content: start; gap: 2px; }
.picker-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; padding: 7px 8px; border-radius: 8px; cursor: pointer; outline: none; }
.picker-list li:hover, .picker-list li:focus, .picker-list li[aria-selected="true"] { background: var(--accent-soft); }
.picker-list li.off { opacity: .55; }
.picker-list li.pl-empty { display: block; color: var(--muted); font-size: 13px; cursor: default; background: none; }
.pl-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--m-flight); color: #fff; font-size: 11px; font-weight: 700; margin-top: 1px; }
.pl-text { display: grid; gap: 1px; min-width: 0; }
.pl-name { font-weight: 600; font-size: 13px; }
.pl-addr { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.picker-map-wrap { position: relative; min-height: 0; }
.picker-map { position: absolute; inset: 0; cursor: crosshair; }
.picker-fit { position: absolute; z-index: 800; top: 10px; right: 10px; background: var(--surface); box-shadow: var(--shadow); }
.picker-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.picker-sel { min-width: 0; display: grid; gap: 2px; }
.sel-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sel-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; padding-left: 34px; }
.sel-meta { font-size: 11px; color: var(--muted); padding-left: 34px; }
.picker-actions { display: flex; gap: 8px; flex: none; }
.mk.sug { width: 22px; height: 22px; background: var(--m-flight); cursor: pointer; }
.mk.sug.off { background: var(--m-ride); }
.mk.pick-pin { width: 30px; height: 30px; background: var(--error); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); cursor: grab; }
.mk.pick-pin svg.i { transform: rotate(45deg); width: 16px; height: 16px; }
@media (max-width: 760px) {
  .picker { width: 100vw; height: 100dvh; border-radius: 0; border: none; }
  .picker-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .picker-side { border-right: none; border-bottom: 1px solid var(--line); max-height: 38dvh; }
  .picker-foot { flex-direction: column; align-items: stretch; }
  .picker-actions .btn { flex: 1; }
}

/* ---- empty and progress ---- */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 16px; }
.empty-art {
  width: 140px; height: 90px; border-radius: 16px; background:
    radial-gradient(circle at 20% 70%, var(--m-stop) 0 7px, transparent 8px),
    radial-gradient(circle at 80% 30%, var(--m-flight) 0 7px, transparent 8px),
    linear-gradient(150deg, transparent 44%, var(--line-strong) 45% 47%, transparent 48%), var(--surface);
  border: 1px solid var(--line);
}
.progress-card {
  max-width: 560px; margin: 24px auto; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); display: grid; gap: 10px;
}
.progress-art { width: 100%; height: 90px; }
.route-path { fill: none; stroke: var(--line-strong); stroke-width: 3; stroke-dasharray: 8 7; animation: dash 1.2s linear infinite; }
.route-end { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.route-traveller circle { fill: var(--accent); }
.route-traveller { offset-path: path("M20 70 C 90 10, 230 10, 300 60"); animation: travel 2.4s ease-in-out infinite; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--m-train)); border-radius: inherit; transition: width .3s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.steps li .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--text); }
.steps li.done .dot { border-color: var(--ok); background: var(--ok); }
.steps li.done .dot::after { content: ""; width: 7px; height: 4px; border: 2px solid #fff; border-top: none; border-right: none; transform: rotate(-45deg) translate(1px, -1px); }
.steps li.failed .dot { border-color: var(--error); background: var(--error); }
.steps .count { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); font-weight: 400; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dash { to { stroke-dashoffset: -30; } }
@keyframes travel { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .route-path, .route-traveller, .steps li.active .dot, .badge.checking svg { animation: none; }
}

/* ---- results ---- */
.results-top { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.kpi .kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.kpi.warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi.ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi dl { margin: 0; min-width: 0; }
.kpi dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi dd { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warn-box { background: var(--warn-soft); color: var(--warn); border-radius: 9px; padding: 8px 12px; margin-bottom: 8px; font-size: 13px; }
.warn-box ul { margin: 0; padding-left: 18px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }

/* day bars (Gantt) */
.strips { display: grid; gap: 4px; margin-bottom: 10px; }
.strip { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; align-items: center; }
.strip-label { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-track { position: relative; height: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.strip-hour { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.strip-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; cursor: pointer; min-width: 3px; opacity: .9; }
.strip-seg:hover, .strip-seg.selected { opacity: 1; outline: 2px solid var(--text); outline-offset: 0; z-index: 2; }
.strip-scale { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; font-size: 10px; color: var(--muted); }
.strip-scale div { position: relative; height: 12px; }
.strip-scale div span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* split: timeline and map */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.map-wrap { position: sticky; top: 60px; display: grid; gap: 6px; }
.map { height: calc(100vh - 140px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 18px; height: 0; border-top: 3px solid; display: inline-block; }

.timeline { display: grid; gap: 10px; }
.day-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 2px; }
.day-items { display: grid; gap: 4px; position: relative; }
.row {
  display: grid; grid-template-columns: 52px 30px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; cursor: pointer;
}
.row:hover { border-color: var(--line-strong); }
.row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.row .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; padding-top: 4px; }
.row .t small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.row .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.row .ic svg.i { width: 15px; height: 15px; }
.row .body { min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 1px; }
.row .flags { display: flex; gap: 4px; align-items: center; padding-top: 4px; }
.row .chev { color: var(--muted); transition: transform .15s; }
.row.open .chev { transform: rotate(90deg); }
.row.stop { background: var(--ok-soft); border-color: transparent; }
.row.night { background: var(--surface-2); border-style: dashed; cursor: default; }
.pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 1px 6px; border: 1px solid currentColor; }
.pill.live { color: var(--ok); }
.pill.estimate { color: var(--muted); }
.pill.assumed { color: var(--muted); border-style: dashed; }
.pill.chosen { color: var(--accent); }
.pill.warn { color: var(--warn); }
.details { grid-column: 3 / 5; display: grid; gap: 6px; font-size: 13px; color: var(--muted); padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 6px; cursor: auto; }
.details p { margin: 0; }
.details .checkpoint { color: var(--text); font-weight: 600; }
.details .w { color: var(--warn); font-weight: 600; }
.details a { color: var(--accent); font-weight: 600; text-decoration: none; }
.details .actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* flight and train lists inside a leg */
.flight-results ul.flights { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.flight-results li { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; color: var(--text); }
.flight-results li.nofit { opacity: .55; }
.flight-results li.best { border-color: var(--ok); background: var(--ok-soft); }
.flight-results .use { font-size: 12px; }
.flight-check .btn[hidden] { display: none; }
/* the ways of making a city journey, on the row itself */
.ride-mini { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; margin-top: 3px; }
.row.open .ride-mini { display: none; }
.rm-chip { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; font: inherit; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.rm-chip svg.i { width: 13px; height: 13px; }
.rm-chip:hover { color: var(--text); border-color: var(--accent); }
.rm-chip.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; cursor: default; }
.rm-chip.fast:not(.on) { color: var(--ok); border-color: var(--ok); font-weight: 700; }
.rm-chip.wait { width: 58px; cursor: default; background: var(--surface-2); border-color: transparent; animation: rm-pulse 1.2s ease-in-out infinite; }
@keyframes rm-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .rm-chip.wait { animation: none; } }
/* the train or flight on the schedule, with its times */
.row .sub .svc { color: var(--text); font-variant-numeric: tabular-nums; }
.row .sub .svc strong { color: var(--accent); font-weight: 700; margin-right: 2px; }
/* the flights and trains around the one in the plan */
.sugg-head { margin: 6px 0 2px; font-size: 12px; font-weight: 600; color: var(--text); }
.flight-results li.risk-tight, .flight-results li.risk-high { opacity: 1; }
.flight-results li.risk-tight { border-color: var(--warn); }
.flight-results li.risk-high { border-color: var(--error); }
.flight-results li.risk-late { opacity: .6; }
.flight-results li.in-plan { border-color: var(--accent); background: var(--accent-soft); opacity: 1; }
.plan-tag { display: inline-block; margin-right: 6px; font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.flight-results li.train-row .plan-tag { justify-self: start; margin: 0; }
.risk-tag { display: flex; align-items: flex-start; gap: 4px; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--warn); }
.risk-tag svg.i { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.risk-high .risk-tag, .risk-late .risk-tag { color: var(--error); }
/* inside a city: DiDi or taxi, metro, walking */
.ride-choice { margin-top: 6px; }
.ride-head { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text); }
.ride-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.ride-cards p { margin: 0; }
.ride-card { display: grid; gap: 2px; align-content: start; text-align: left; padding: 7px 9px; font: inherit; font-size: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.ride-card:hover { border-color: var(--accent); }
.ride-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); cursor: default; }
.rc-top { display: flex; align-items: center; gap: 5px; font-weight: 700; }
.rc-top svg.i { width: 15px; height: 15px; flex: none; }
.rc-fast { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--ok); }
.rc-facts { color: var(--text); font-variant-numeric: tabular-nums; }
.rc-lines { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.src-tag { display: inline-block; margin: 0 4px; padding: 0 6px; border-radius: 999px; font-size: 10px; color: var(--muted); border: 1px solid var(--line); }
.flight-results li.train-row { display: grid; gap: 4px; }
.tr-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tr-trip { font-weight: 700; color: var(--m-train); }
.tr-top .use { margin-left: auto; }
.seat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.seat { display: inline-flex; gap: 5px; align-items: baseline; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 11px; background: var(--surface); }
.seat-cls { color: var(--muted); }
.seat-price { font-weight: 700; }
.seat.ok .seat-left { color: var(--ok); }
.seat.few { border-color: var(--warn); }
.seat.few .seat-left { color: var(--warn); font-weight: 700; }
.seat.out { opacity: .6; }
.seat.out .seat-left { color: var(--error); }
.trains-head p { margin: 4px 0; }
.buy-link { font-size: 12px; }
p.small { font-size: 11px; margin: 6px 0 2px; }
.best-tag { font-size: 10px; color: var(--ok); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.paste-flight { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.paste-flight .paste-label { flex: 0 0 100%; font-size: 12px; font-weight: 600; color: var(--muted); }
.paste-flight input[type="text"] { flex: 1 1 200px; }
.paste-times { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.paste-times input { width: auto; }
.paste-times p { flex: 0 0 100%; margin: 0; }

/* map markers */
.mk { display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: 11px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.mk.stop { width: 24px; height: 24px; background: var(--m-stop); }
.mk.term { width: 20px; height: 20px; }
.mk.term svg.i { width: 12px; height: 12px; }
.mk.selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-popup-content { margin: 8px 10px; font-size: 13px; }

/* ---- extras ---- */
.about { margin-top: 12px; font-size: 13px; }
.about summary, .extra summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.extras { margin-top: 18px; display: grid; gap: 8px; }
.extra { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.extra[open] summary { margin-bottom: 8px; }
.extra h3 { margin: 12px 0 6px; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; width: auto; }
.bookmarklet { cursor: grab; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; }
.run-detail { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 320px; overflow: auto; font-size: 11px; }
.next-stage { font-size: 12px; }

/* ---- narrower screens ---- */
@media (max-width: 1280px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { position: static; order: -1; }
  .map { height: 340px; min-height: 0; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout.collapsed { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .panel-body { overflow: visible; }
  .brand-sub { display: none; }
  .main { padding: 12px 12px 28px; }
  .strip { grid-template-columns: 64px minmax(0, 1fr); }
  .strip-scale { grid-template-columns: 64px minmax(0, 1fr); }
  .map { height: 280px; }
}
@media (max-width: 480px) {
  .depart-grid { grid-template-columns: minmax(0, 1fr); }
  .stop-grid, .stop.flexible .stop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 44px 26px minmax(0, 1fr) auto; gap: 6px; }
  .row .ic { width: 26px; height: 26px; }
  .details { grid-column: 1 / 5; }
}

/* OpenStreetMap tiles, darkened to sit in the dark theme */
@media (prefers-color-scheme: dark) {
  .osm-tiles { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
}

/* phone: a lighter header and tighter summary */
@media (max-width: 480px) {
  .appbar { padding: 0 10px; gap: 6px; }
  .user-name { display: none; }
  .btn-text { white-space: nowrap; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .kpi { padding: 6px 8px; gap: 6px; }
  .kpi .kpi-icon { width: 24px; height: 24px; }
  .kpi dd { font-size: 13px; }
}
