:root {
  --pine: #173B2B; --leaf: #2F7D4F; --leaf-ink: #fff; --spark: #FFC93C; --spark-soft: #FFF1C7;
  --paper: #F3F6F1; --surface: #FFFFFF; --ink: #15211B; --muted: #5E6B63; --line: #D7DED8;
  --busy: #C9D2CC; --danger: #B4232A; --focus: #1D6FD8;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --tabs-h: 64px; --top-h: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1E17; --surface: #16291F; --ink: #E7EFE9; --muted: #9DB0A4; --line: #2A3E33;
    --busy: #34493D; --leaf: #46A56C; --spark-soft: #3B3214; --pine: #0B1712;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--leaf); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Shell */
.top { position: sticky; top: 0; z-index: 1000; height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); font: 800 1.2rem var(--display); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: none; padding: 6px 12px; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--pine); color: #fff; }
main { padding: 16px 16px calc(var(--tabs-h) + 32px); max-width: 720px; margin: 0 auto; outline: none; }
main.full { padding: 0; max-width: none; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 700; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--leaf); }
.tabs a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--leaf); border-radius: 0 0 3px 3px; }
.tabs .dot { position: absolute; top: 10px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--spark); box-shadow: 0 0 0 2px var(--surface); }

/* Find: map + sheet */
.find { display: grid; grid-template-rows: minmax(260px, 46vh) auto; }
#map { width: 100%; height: 46vh; min-height: 260px; background: #dfe8e2; }
.sheet { position: relative; margin-top: -20px; background: var(--paper); border-radius: 20px 20px 0 0; padding: 20px 16px calc(var(--tabs-h) + 24px); z-index: 500; max-width: 720px; width: 100%; justify-self: center; }
.sheet .sub { color: var(--muted); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 16px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: #fff; }
.map-search { position: absolute; z-index: 600; top: 12px; left: 50%; transform: translateX(-50%); }
.map-search .chip { box-shadow: 0 2px 8px rgba(0,0,0,.18); }

.pin { background: var(--surface); color: var(--ink); border: 2px solid var(--pine); border-radius: 10px; padding: 2px 7px; font: 700 13px var(--body);
  white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.2); position: relative; transform: translate(-50%, -100%); display: inline-block; }
.pin::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--pine); border-bottom: 0; }
.pin.now { background: var(--spark); color: #1b1b1b; }
.pin.mine { border-color: var(--leaf); }
.leaflet-div-icon { background: none; border: 0; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--focus); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(29,111,216,.2); }

/* Charger list item */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.item { display: block; text-decoration: none; color: inherit; background: var(--surface); padding: 14px 16px; }
.list .item:first-child { border-radius: 14px 14px 4px 4px; }
.list .item:last-child { border-radius: 4px 4px 14px 14px; }
.list .item:only-child { border-radius: 14px; }
.item-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-title { font: 700 1.05rem var(--display); }
.price { font: 800 1.15rem var(--display); white-space: nowrap; }
.price small { font: 400 .75rem var(--body); color: var(--muted); }
.meta { color: var(--muted); font-size: .9rem; margin: 2px 0 10px; }

/* The day ribbon: when the host's car is away */
.ribbon { position: relative; height: 22px; background: var(--busy); border-radius: 6px; overflow: hidden; }
.ribbon .free { position: absolute; top: 0; bottom: 0; background: var(--spark); }
.ribbon .taken, .taken-swatch { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, var(--busy) 2px 6px); }
.ribbon .taken { position: absolute; top: 0; bottom: 0; }
.ribbon .now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
/* Your choice: an outline on top of the yellow, so it still reads as available time */
.ribbon .sel, .sel-swatch { box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px var(--spark); background: transparent; border-radius: 6px; }
.ribbon .sel { position: absolute; top: 0; bottom: 0; }
.ribbon.big { cursor: pointer; }
.ribbon-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 3px; }
.ribbon.big { height: 40px; border-radius: 8px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }

/* Panels & forms */
.panel { background: var(--surface); border-radius: 16px; padding: 18px 16px; margin-bottom: 14px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-weight: 700; margin-bottom: 10px; }
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.spec { background: var(--paper); border-radius: 10px; padding: 10px; }
.spec b { display: block; font: 700 1.1rem var(--display); }
.spec span { font-size: .78rem; color: var(--muted); }
.note { background: var(--spark-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.day { flex: 0 0 auto; text-align: center; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 12px; cursor: pointer; min-width: 62px; }
.day b { display: block; font: 800 1.2rem var(--display); }
.day span { font-size: .78rem; color: var(--muted); }
.day[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: #fff; }
.day[aria-pressed="true"] span { color: #cfe0d6; }
label { display: block; font-weight: 700; font-size: .9rem; margin: 12px 0 4px; }
input, select, textarea { width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 16px; }
textarea { min-height: 70px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700;
  background: var(--leaf); color: var(--leaf-ink); cursor: pointer; text-decoration: none; font-size: 1rem; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn.small { padding: 8px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.costs { margin: 14px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
.costs div { display: flex; justify-content: space-between; padding: 3px 0; }
.costs .tot { font: 800 1.15rem var(--display); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 20px; color: var(--muted); }
.status { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; background: var(--paper); border: 1px solid var(--line); }
.status.pending { background: var(--spark-soft); border-color: transparent; }
.status.accepted { background: var(--spark); color: #1b1b1b; border-color: transparent; }
.status.paid, .status.completed { background: var(--leaf); color: #fff; border-color: transparent; }
.status.declined, .status.cancelled { color: var(--muted); }
.booking { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.booking .when { font: 700 1.05rem var(--display); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--paper); border-radius: 10px; padding: 12px; }
.stat b { display: block; font: 800 1.4rem var(--display); }
.stat span { font-size: .8rem; color: var(--muted); }
.slotlist { list-style: none; margin: 10px 0 0; padding: 0; }
.slotlist li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.mini-map { height: 220px; border-radius: 12px; overflow: hidden; margin-top: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.section-head h2 { margin: 0; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + 16px); z-index: 2000; max-width: 480px; margin: 0 auto;
  background: var(--pine); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 700; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
#toast.show { transform: none; opacity: 1; }
#toast.err { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
@media (min-width: 900px) {
  .find { grid-template-columns: 1fr 440px; grid-template-rows: calc(100vh - var(--top-h) - var(--tabs-h)); }
  #map { height: 100%; }
  .sheet { margin: 0; border-radius: 0; overflow-y: auto; padding-bottom: 24px; }
}

.place { display: flex; gap: 8px; margin-top: 12px; }
.place input { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
