/* iservU GO — matatu green, sunshine yellow, one neon accent (urgency/SOS only). */
:root {
  --green: #0b5a39; --green-deep: #073d27; --green-soft: #e3efe8;
  --yellow: #ffc81e; --yellow-soft: #fff4cc;
  --neon: #e0186c;
  --ink: #0f1f17; --ink-2: #44554c; --line: #cfdad3; --paper: #f4f7f4; --white: #fff;
  --ok: #137a43; --warn: #9a6700;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px;
  --font: 'Bricolage Grotesque', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --step--1: 0.84rem; --step-0: 1rem; --step-1: 1.2rem; --step-2: 1.5rem; --step-3: 2.1rem; --step-4: 3rem;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: var(--step-0); line-height: 1.45; color: var(--ink); background: var(--paper); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: var(--step--1); }
.hidden { display: none !important; }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .4em; letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); } h3 { font-size: var(--step-1); }

/* App shell: map on top, one sheet below */
.app { display: grid; grid-template-rows: auto minmax(34vh, 1fr) auto; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; background: var(--green); color: var(--white); padding-top: max(.6rem, env(safe-area-inset-top)); }
.brand { font-weight: 800; font-size: var(--step-1); letter-spacing: -0.02em; text-decoration: none; color: inherit; }
.brand b { color: var(--yellow); }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: var(--step--1); opacity: .85; }
#map { min-height: 34vh; background: #dde7e0; z-index: 0; }
.sheet { background: var(--white); border-radius: var(--r-lg) var(--r-lg) 0 0; margin-top: -18px; position: relative; z-index: 2;
  padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(7, 61, 39, .14); max-height: 66dvh; overflow-y: auto; }
.sheet > * + * { margin-top: .85rem; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 0; border-radius: var(--r-md); padding: .9rem 1.1rem; font-weight: 700; cursor: pointer; min-height: 52px; text-decoration: none; }
.btn.block { width: 100%; }
.btn.primary { background: var(--green); color: var(--white); }
.btn.primary:active { background: var(--green-deep); }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--green); border: 2px solid var(--line); }
.btn.quiet { background: var(--green-soft); color: var(--green-deep); }
.btn.danger { background: transparent; color: var(--neon); border: 2px solid currentColor; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: .6rem; align-items: center; }
.row > .grow { flex: 1; }
.stack > * + * { margin-top: .6rem; }
.field { display: block; }
.field span { display: block; font-size: var(--step--1); color: var(--ink-2); margin-bottom: .25rem; }
.field input, .field select { width: 100%; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--white); min-height: 50px; }
.field input:focus { border-color: var(--green); outline: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--green-soft); border-radius: var(--r-md); padding: 4px; }
.seg button { border: 0; background: transparent; padding: .6rem; border-radius: 10px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--green-deep); }

/* Places */
.place { display: grid; grid-template-columns: 14px 1fr; gap: .2rem .7rem; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.dot.to { background: var(--ink); border-radius: 2px; }
.place .label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest { list-style: none; margin: .3rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 200px; overflow: auto; }
.suggest li button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .7rem .8rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest li:last-child button { border-bottom: 0; }

/* Fair Range */
.range { position: relative; padding: 1.6rem 0 .4rem; }
.range input[type=range] { width: 100%; accent-color: var(--green); height: 32px; }
.range .ends { display: flex; justify-content: space-between; font-size: var(--step--1); color: var(--ink-2); }
.range .tick { position: absolute; top: .2rem; transform: translateX(-50%); font-size: var(--step--1); color: var(--green); font-weight: 700; white-space: nowrap; }
.why { font-size: var(--step--1); color: var(--ink-2); background: var(--paper); border-radius: var(--r-sm); padding: .6rem .75rem; }

/* The fare plate — the one loud thing */
.plate { display: inline-flex; align-items: baseline; gap: .35rem; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px;
  padding: .25rem .9rem .3rem; font-weight: 800; font-size: var(--step-4); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; box-shadow: 0 4px 0 var(--ink); }
.plate small { font-size: .38em; font-weight: 700; letter-spacing: 0; }
.plate.sm { font-size: var(--step-2); border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
.handshake { text-align: center; padding: .4rem 0; }
.handshake .stamp { display: block; margin-top: .7rem; font-weight: 800; color: var(--green); font-size: var(--step-1); }
@media (prefers-reduced-motion: no-preference) {
  .handshake.go .plate { animation: stamp .42s cubic-bezier(.2,1.6,.4,1) both; }
  .handshake.go .stamp { animation: rise .5s .25s ease-out both; }
  @keyframes stamp { from { transform: scale(1.35) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Countdown */
.timer { height: 6px; background: var(--green-soft); border-radius: 3px; overflow: hidden; }
.timer > i { display: block; height: 100%; background: var(--green); transform-origin: left; }
.timer.urgent > i { background: var(--neon); }

/* Offers & requests */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { margin-top: .6rem; }
.offer { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: var(--r-md); }
.offer .who { font-weight: 700; }
.offer .car { font-size: var(--step--1); color: var(--ink-2); }
.offer .amt { font-weight: 800; font-size: var(--step-1); text-align: right; }
.offer .amt .counter { display: block; font-size: var(--step--1); color: var(--warn); font-weight: 600; }
.offer .btn { grid-column: 1 / -1; min-height: 46px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; background: var(--green-soft); color: var(--green-deep); vertical-align: 2px; }
.badge.founder { background: var(--yellow-soft); color: #6b4e00; }
.req { border: 2px solid var(--green); border-radius: var(--r-md); padding: .85rem; }
.req .head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.req .route { font-size: var(--step--1); color: var(--ink-2); margin: .3rem 0 .6rem; }
.req .actions { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
.req .actions .decline { grid-column: 1 / -1; min-height: 40px; }
.keep { display: block; font-size: .78rem; font-weight: 600; opacity: .85; }

/* Nudge */
.nudge { background: var(--yellow-soft); border-left: 5px solid var(--yellow); padding: .8rem .9rem; border-radius: var(--r-sm); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.stat { background: var(--paper); border-radius: var(--r-md); padding: .7rem .8rem; }
.stat b { display: block; font-size: var(--step-1); font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--step--1); color: var(--ink-2); }

/* Online switch */
.online { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-radius: var(--r-md); background: var(--ink); color: var(--white); }
.online.on { background: var(--green); }
.switch { position: relative; width: 64px; height: 36px; border-radius: 99px; border: 0; background: #56645c; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--white); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--yellow); }
.switch[aria-checked="true"]::after { transform: translateX(28px); }

/* SOS */
.sos { position: fixed; right: 14px; top: calc(64px + env(safe-area-inset-top)); z-index: 1000; width: 62px; height: 62px; border-radius: 50%; border: 3px solid var(--white);
  background: var(--neon); color: var(--white); font-weight: 800; letter-spacing: .02em; box-shadow: 0 6px 18px rgba(224, 24, 108, .45); cursor: pointer; }
.sos[hidden] { display: none; }

/* Stars */
.stars { display: flex; gap: .3rem; justify-content: center; }
.stars button { font-size: 2rem; background: none; border: 0; cursor: pointer; color: var(--line); line-height: 1; padding: .1rem; }
.stars button.on { color: var(--yellow); text-shadow: 0 1px 0 var(--ink); }

/* In-app sheet */
.modal { position: fixed; inset: 0; z-index: 3000; background: rgba(7, 30, 20, .5); display: grid; place-items: end center; }
.modal-card { background: var(--white); width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
.modal-card > * + * { margin-top: .8rem; }
@media (min-width: 900px) { .modal { place-items: center; } .modal-card { border-radius: var(--r-lg); } }
.field textarea { width: 100%; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--white); min-height: 130px; font: inherit; resize: vertical; }
.field textarea:focus { border-color: var(--green); outline: none; }
.topbtn { background: rgba(255,255,255,.14); color: var(--white); border: 0; border-radius: 99px; padding: .35rem .8rem; font-weight: 700; cursor: pointer; min-height: 36px; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: .1rem .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.check .mark { font-weight: 800; font-size: 1.1rem; }
.check.ok .mark { color: var(--ok); } .check.no .mark { color: var(--neon); }
.check .fix { grid-column: 2; font-size: var(--step--1); color: var(--ink-2); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000; max-width: min(92vw, 460px);
  background: var(--ink); color: var(--white); padding: .75rem 1rem; border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: #8a1238; }

/* Landing */
.landing { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; background: var(--green); color: var(--white); }
.landing .hero { padding: 12vh 1.4rem 2rem; max-width: 40rem; }
.landing h1 { font-size: clamp(2.6rem, 11vw, 5rem); font-weight: 800; letter-spacing: -0.04em; }
.landing h1 .plate { font-size: .62em; vertical-align: .12em; margin-left: .1em; }
.landing p { font-size: var(--step-1); max-width: 30ch; opacity: .92; }
.landing .choices { display: grid; gap: .7rem; padding: 1.4rem; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); max-width: 40rem; }

/* Admin */
.admin { max-width: 1080px; margin: 0 auto; padding: 1rem; }
.admin section { background: var(--white); border-radius: var(--r-md); padding: 1rem; margin-top: 1rem; }
.admin table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.admin th, .admin td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.scroll-x { overflow-x: auto; }

@media (min-width: 900px) {
  .app { grid-template-columns: 1fr 440px; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  #map { grid-row: 2; }
  .sheet { grid-row: 2; margin-top: 0; border-radius: 0; max-height: none; box-shadow: -6px 0 24px rgba(7,61,39,.1); }
  /* Desktop: SOS lives in the map's bottom-left corner, clear of the fare plate */
  .sos { top: auto; right: auto; left: 18px; bottom: 34px; }
}
