:root {
  --bg: #ffffff;
  --fg: #1d2330;
  --muted: #6b7280;
  --line: #e5e7eb;
  --hover: #f3f4f6;
  --accent: #2563eb;
  --shadow: 0 4px 20px rgba(0, 0, 0, .15);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1f27;
    --fg: #e8eaed;
    --muted: #9aa0a6;
    --line: #2f3542;
    --hover: #262b35;
    --accent: #7aa7ff;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
#map { position: absolute; inset: 0; }

#panel {
  position: absolute; z-index: 1000;
  top: 12px; left: 12px; bottom: 12px;
  width: 360px;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
#panel.collapsed { bottom: auto; }
#panel.collapsed #panel-body, #panel.collapsed #panel-foot { display: none; }

.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--line);
}
.panel-head h1 { flex: 1; margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  border: 0; background: none; color: var(--fg);
  font-size: 18px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: var(--hover); }

#panel-body { flex: 1; overflow-y: auto; padding: 8px 12px 12px; }
#panel-foot { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; }
#panel-foot a { color: inherit; }

.muted { color: var(--muted); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; }

input[type=search], input[type=date] {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; gap: 8px; align-items: center;
  padding: 7px 6px; border-radius: 8px; cursor: pointer;
}
.list li:hover, .list li.active { background: var(--hover); }
.list .grow { flex: 1; min-width: 0; }
.list .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .time { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; }
.list li.past { opacity: .45; }
.list li.static { cursor: default; }

.badge {
  display: inline-block; min-width: 34px; padding: 2px 6px;
  border-radius: 5px; font-size: 12px; font-weight: 700; text-align: center;
  white-space: nowrap;
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }

.btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font: inherit;
}
.btn:hover { background: var(--hover); }
.notice { background: var(--hover); padding: 8px 10px; border-radius: 8px; margin: 8px 0; }

.leaflet-tooltip.stop-tip { font-weight: 600; }

@media (max-width: 700px) {
  #panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 55vh;
    border-radius: 12px 12px 0 0;
  }
  #panel.collapsed { bottom: 0; }
}

/* Itinéraire */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.wide { width: 100%; margin: 4px 0 10px; padding: 9px; }
.picker { position: relative; margin: 8px 0; }
.picker label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.suggestions {
  position: absolute; z-index: 10; left: 0; right: 0; top: 100%;
  background: var(--bg); border-radius: 8px; box-shadow: var(--shadow);
}
.suggestions:empty { display: none; }
input[type=time] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.row input[type=date] { flex: 1; }
.badge.walk { background: var(--hover); color: var(--fg); font-weight: 600; }
.journey strong { font-variant-numeric: tabular-nums; }
.badges .muted { align-self: center; }
.legs { list-style: none; margin: 8px 0; padding: 0; }
.leg { display: flex; gap: 8px; padding: 6px 0 6px 10px; border-left: 4px solid var(--line); margin-left: 2px; }
.leg.ride { border-left-color: var(--c); }
.leg.ride.end { padding-bottom: 12px; }
.leg.walk { border-left-style: dotted; }
.leg .time { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; flex: none; }
.leg .grow { flex: 1; min-width: 0; }
.leg .badges { align-items: center; }
.small { font-size: 12px; }
.dimmed .leaflet-overlay-pane { opacity: .25; }

/* Idées de sorties */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  padding: 5px 10px; border-radius: 999px; cursor: pointer; font: inherit;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.outing-emoji { font-size: 20px; width: 28px; text-align: center; }
.outing-icon {
  font-size: 18px; line-height: 26px; text-align: center;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
