:root {
  --ink: #1c1915;
  --muted: #6d655b;
  --paper: #f6f1e8;
  --card: rgba(255, 250, 244, 0.94);
  --line: rgba(28, 25, 21, 0.1);
  --forest: #1b3a32;
  --forest-2: #246454;
  --brass: #8c6232;
  --brass-2: #e7c48a;
  --bad: #8e342e;
  --good: #1d7a4d;
  --shadow: 0 24px 60px rgba(48, 32, 12, 0.18);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--forest);
}

#map { position: fixed; inset: 0; background: #d7e0d4; }
#veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(231, 196, 138, 0.28), transparent 55%),
    linear-gradient(180deg, rgba(27, 58, 50, 0.18), transparent 28%);
}
body.authed #veil { background: linear-gradient(180deg, rgba(246, 241, 232, 0.2), transparent 18%); }

#bar {
  position: fixed;
  z-index: 500;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand b { font-family: var(--serif); font-size: 22px; font-weight: 400; }
.brand span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
#bar button.ghost {
  border: 0;
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

#sheet {
  position: fixed;
  z-index: 450;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78dvh, 760px);
  overflow: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
body.gate #sheet {
  top: 0;
  max-height: none;
  height: 100%;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(246, 241, 232, 0.92), rgba(246, 241, 232, 0.96)),
    var(--paper);
}
body.gate #map { filter: saturate(0.7) brightness(0.85); }

@media (min-width: 980px) {
  #sheet {
    left: auto;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(440px, calc(100vw - 36px));
    max-height: none;
    border-radius: 28px;
  }
  body.gate #sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(920px, calc(100vw - 48px));
    height: auto;
    max-height: calc(100dvh - 48px);
    border-radius: 32px;
  }
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brass);
  font-weight: 600;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; }
h1 { font-size: clamp(42px, 6vw, 68px); line-height: 0.95; margin: 0 0 12px; }
h1 em { font-style: italic; color: var(--forest); }
h2 { font-size: 34px; margin: 0 0 6px; line-height: 1; }
h3 { font-size: 26px; margin: 0; }
.lede { font-size: 18px; line-height: 1.45; max-width: 38ch; color: var(--ink); margin: 0 0 22px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; line-height: 1.45; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.roles { display: grid; gap: 12px; }
@media (min-width: 800px) { .roles { grid-template-columns: repeat(3, 1fr); } }
.role {
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 22px;
  padding: 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.role:hover { border-color: var(--brass-2); transform: translateY(-1px); }
.role small { display: block; color: var(--muted); margin-top: 6px; }
.role strong { display: block; font-size: 18px; }
.role .who { margin-top: 14px; font-size: 13px; color: var(--forest); }

.btn, button.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 14px 16px;
  background: var(--forest);
  color: #f6f1e8;
}
.btn.full { width: 100%; }
.btn.secondary { background: #efe7da; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(142, 52, 46, 0.3); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mod, .chip, .pay {
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 10px;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.mod.active, .chip.active, .pay.active { border-color: var(--forest); background: #e7f2ed; }
.mod b, .pay b { display: block; font-size: 14px; }
.mod span, .pay span { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.field, input[type="text"], input[type="search"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
}
textarea { min-height: 74px; resize: vertical; }
label.lbl { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

.place { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.dot { width: 12px; height: 12px; border-radius: 99px; margin-top: 4px; flex: none; }
.dot.origin { background: var(--forest); }
.dot.dest { background: var(--brass); }
.dot.car { background: var(--brass-2); box-shadow: 0 0 0 4px rgba(231, 196, 138, 0.45); }

.price { font-family: var(--serif); font-size: 56px; line-height: 0.9; margin: 8px 0; }
.lines { display: grid; gap: 6px; margin: 8px 0 14px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: var(--brass-2);
  font-family: var(--serif);
  font-size: 22px;
  flex: none;
}
.stars { color: var(--brass); letter-spacing: 2px; }
.star-btn { background: transparent; border: 0; font-size: 28px; cursor: pointer; color: #d9d0c3; }
.star-btn.on { color: var(--brass); }
.timeline { display: flex; gap: 6px; margin: 12px 0; }
.timeline i { height: 4px; flex: 1; border-radius: 99px; background: #e5dccf; }
.timeline i.on { background: var(--forest); }
.kpi { background: var(--forest); color: #f6f1e8; border-radius: 18px; padding: 12px; }
.kpi b { display: block; font-family: var(--serif); font-size: 28px; font-weight: 400; }
.kpi span { font-size: 12px; opacity: 0.8; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #efe7da; font-size: 12px; }
.tag.ok { background: #e5f5ec; color: var(--good); }
.tag.warn { background: #f8ead2; color: var(--brass); }
.tag.bad { background: #f8e4e1; color: var(--bad); }
.chat { display: grid; gap: 8px; max-height: 180px; overflow: auto; }
.bubble { background: #f3eee6; border-radius: 14px; padding: 8px 10px; font-size: 14px; }
.bubble.me { background: #e7f2ed; }
.bubble b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.nav button { background: transparent; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 8px; }
.nav button.on { color: var(--forest); font-weight: 700; }
#toast {
  position: fixed;
  z-index: 800;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  max-width: min(520px, calc(100% - 24px));
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pulse { width: 14px; height: 14px; border-radius: 99px; background: var(--brass); box-shadow: 0 0 0 0 rgba(140, 98, 50, 0.6); animation: pulse 1.4s infinite; }
@keyframes pulse {
  70% { box-shadow: 0 0 0 12px rgba(140, 98, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(140, 98, 50, 0); }
}
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 18px; background: white; border: 1px solid var(--line); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.car-plate { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; font-weight: 700; }
.search-hit { width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; font: inherit; cursor: pointer; }
.leaflet-control-attribution { font-size: 10px !important; }
