:root {
  --bg: #f4f5f7; --card: #fff; --text: #16181d; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-ink: #fff; --brand-soft: #ccfbf1;
  --free: #22c55e; --free-soft: #86efac; --past: #e5e7eb; --booked: #3b82f6; --repair: #ef4444;
  --warn-bg: #fff7ed; --warn-line: #fdba74; --ok-bg: #f0fdf4; --ok-line: #86efac;
  --due: #dc2626; --paid: #15803d; --wa: #25d366;
  --radius: 14px; --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #1a1d23; --text: #eef0f3; --muted: #9aa1ad; --line: #2b2f37;
    --brand: #14b8a6; --brand-ink: #04211e; --brand-soft: #123c38;
    --free-soft: #86efac; --past: #2e333b; --booked: #60a5fa;
    --warn-bg: #2a1f12; --warn-line: #9a5b13; --ok-bg: #11251a; --ok-line: #1f6b3a;
    --due: #f87171; --paid: #4ade80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 96px);
}
a { color: var(--brand); }
h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; margin: 4px 0 10px; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--brand); color: var(--brand-ink);
}
.topbar h1 { font-size: 19px; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 30px; line-height: 1; padding: 0 10px 4px 0; cursor: pointer; }
main { padding: 12px 12px 0; max-width: 640px; margin: 0 auto; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.bottom-nav a span { font-size: 22px; filter: grayscale(1); opacity: .7; }
.bottom-nav a.on { color: var(--brand); font-weight: 600; }
.bottom-nav a.on span { filter: none; opacity: 1; }
body.logged-out .bottom-nav, body.logged-out .fab { display: none; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 11;
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink);
  font-size: 32px; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer;
}
.fab[hidden] { display: none; }
.fab { transition: transform .2s, opacity .2s; }
.fab.away { transform: translateY(40px) scale(.6); opacity: 0; pointer-events: none; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.list { padding: 4px 14px; }
.section-title { margin: 18px 4px 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.section-title::first-letter { text-transform: uppercase; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; min-height: 46px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.big { width: 100%; min-height: 54px; font-size: 17px; margin-top: 10px; }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 14px; }
.btn.link { border: 0; background: none; color: var(--muted); width: 100%; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { color: var(--due); border-color: var(--due); width: 100%; margin: 6px 0 20px; }
.btn:disabled, .btn.loading { opacity: .55; pointer-events: none; }
.actions { display: flex; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.actions .btn.primary { flex: 1; min-height: 52px; }
.card .actions { margin: 12px 0 0; }

/* forms */
.form label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.form h3 { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.form h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.money { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding-left: 12px; }
.money span { color: var(--muted); font-weight: 600; }
.money input { border: 0; margin: 0; background: transparent; font-weight: 600; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 10px; cursor: pointer; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.stepper { display: flex; gap: 8px; }
.stepper button { width: 56px; min-height: 52px; font-size: 26px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.stepper input { text-align: center; font-size: 22px; font-weight: 700; margin: 0; }
.quick { display: flex; gap: 8px; margin-bottom: 8px; }
.quick button { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand-soft); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.total-line { display: flex; justify-content: space-between; margin: 12px 0 4px; padding: 10px 12px; background: var(--brand-soft); border-radius: 10px; }
.photo-btn { display: flex !important; align-items: center; justify-content: center; min-height: 90px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--muted); font-weight: 600; }
.photo-btn img { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; }
button.photo-btn { width: 100%; background: transparent; font: inherit; padding: 12px; }
.photo-btn > span { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cond-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cond-tile { aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 12px; background: transparent; color: var(--muted); font: inherit; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; position: relative; }
.cond-tile .ico { font-size: 26px; }
.cond-tile small { font-size: 12px; font-weight: 600; }
.cond-tile.done { border-style: solid; border-color: var(--free); padding: 0; }
.cond-tile.done img { width: 100%; height: 100%; object-fit: cover; }
.cond-tile.done small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; padding: 3px; }
.cond-tile.add { border-color: var(--brand); color: var(--brand); }
.cond-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.cond-gallery a { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.cond-gallery img { width: 100%; height: 100%; object-fit: cover; }
.cond-gallery small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 4px; }
details.compare summary { font-weight: 700; cursor: pointer; }
h3.sub { margin-top: 14px; font-size: 15px; }
.cam-title { color: #fff; background: #000; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; font-weight: 700; text-align: center; }
/* In-app live camera */
.camera { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; }
.camera video, .camera > img { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.camera video.mirror { transform: scaleX(-1); }
.cam-bar { display: flex; align-items: center; justify-content: space-around; gap: 12px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: #000; }
.cam-bar[hidden] { display: none; }
.cam-bar .btn { flex: 1; }
.cam-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; }
.shutter:active { transform: scale(.94); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.country { position: relative; }
.country-list { position: absolute; left: 0; right: 0; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; box-shadow: 0 8px 20px rgba(0,0,0,.15); overflow: hidden; }
.country-list button { display: block; width: 100%; text-align: left; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; cursor: pointer; }

.steps { display: flex; justify-content: center; gap: 10px; margin: 4px 0 12px; }
.steps b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: 14px; }
.steps b.on { background: var(--brand); color: var(--brand-ink); }
.steps b.done { background: var(--brand-soft); color: var(--brand); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { font-size: 18px; text-transform: capitalize; }
.cal-head .icon-btn { color: var(--brand); padding: 0 12px 4px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.grid.wd span { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.day { aspect-ratio: 1 / 1.05; border: 1px solid transparent; border-radius: 10px; background: var(--bg); color: var(--text); padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; cursor: pointer; font: inherit; }
.day b { font-size: 14px; font-weight: 600; }
.day.other { opacity: .4; }
.day.past b { color: var(--muted); font-weight: 500; }
.day.past .bars i { background: var(--past); }
.day.today b { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.day.sel { border-color: var(--brand); background: var(--brand-soft); }
.bars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; width: 70%; }
.bars i, .legend i { display: block; height: 6px; border-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend.keys i { width: 16px; }
i.free { background: var(--free-soft); } i.booked { background: var(--booked); } i.repair { background: var(--repair); }
.num { font-style: normal; font-size: 11px; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--line); color: var(--text); margin-right: 4px; }
.scooter-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.scooter-row:last-child { border-bottom: 0; }
.sname { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); vertical-align: middle; margin-right: 4px; }
.swatch.big { width: 26px; height: 26px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatch { border-color: #6b7280; } }
.scooter-row:has(.booking) { flex-direction: column; align-items: stretch; }
.booking { display: flex; flex-direction: column; gap: 8px; text-align: left; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 6px; }
.booking + .booking { margin-top: 8px; }
.booking .badge { align-self: flex-start; }
.booking .ret-btn { text-align: center; padding: 12px; font-size: 16px; }
.booking > a { text-decoration: none; color: var(--text); display: block; }
.booking .km { display: block; font-variant-numeric: tabular-nums; }
.ret-btn { background: var(--booked); color: #fff; border: 0; font-weight: 700; }
.ret-btn.late { background: var(--due); }
.km-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.km-pair input { width: 100%; }
.km-box { padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.booking span { font-weight: 600; display: block; }
.booking small { color: var(--muted); }
.free-btn { color: var(--paid); border-color: var(--ok-line); background: var(--ok-bg); }

/* scooter picker */
.scooter-pick { display: grid; gap: 10px; }
.scooter-btn { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; min-height: 72px; }
.scooter-btn b { display: block; font-size: 17px; }
.scooter-btn small { color: var(--muted); }
.scooter-btn:not(.blocked):active { border-color: var(--brand); }
.scooter-btn.blocked { opacity: .45; cursor: not-allowed; }
.scooter-btn .grow { flex: 1; min-width: 0; }
.scooter-btn .check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #6b7280; background: #fff; }
/* Light grey cards in both themes so the black scooter photo stays visible. */
.scooter-btn { background: #e9ebee; border-color: #d1d5db; color: #16181d; }
.scooter-btn small { color: #4b5563; }
.scooter-btn .avail { color: #15803d; font-weight: 600; }
.scooter-btn:not(.blocked):active .check { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 4px #fff; }
.scooter-ico { flex: none; width: 92px; height: 72px; object-fit: contain; margin: -8px -4px -8px 0; }

/* rentals */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.rental-card { display: block; text-decoration: none; color: var(--text); border-left: 5px solid var(--line); }
.rental-card .row + .row { margin-top: 6px; }
.rental-card.s-out { border-left-color: var(--free); }
.rental-card.s-overdue { border-left-color: var(--due); }
.rental-card.s-upcoming { border-left-color: #3b82f6; }
.rental-card .time { margin-top: 6px; font-weight: 600; }
.time.overdue { color: var(--due); }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: var(--line); }
.b-out { background: #dcfce7; color: #166534; } .b-overdue { background: #fee2e2; color: #991b1b; }
.b-upcoming { background: #dbeafe; color: #1e40af; } .b-returned { background: var(--line); color: var(--muted); }
.b-cancelled { background: var(--line); color: var(--muted); text-decoration: line-through; } .b-unsigned { background: #ffedd5; color: #9a3412; }
.due { color: var(--due); font-weight: 700; } .paid { color: var(--paid); font-weight: 600; }

.head-card .when { font-size: 17px; font-weight: 600; margin: 10px 0 4px; }
.warn-card { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.ok-card { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.warn-card .btn.small { margin-top: 8px; }
.sig { display: block; max-width: 220px; margin-top: 8px; background: #fff; border-radius: 8px; }
dl { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 8px 14px; margin: 0 0 10px; }
dt { color: var(--muted); font-size: 14px; } dd { margin: 0; font-weight: 600; word-break: break-word; }
.id-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.id-photos:has(a:only-child) { grid-template-columns: 1fr; }
.passport { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--bg); }
.mrow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow span:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.mrow.small span:last-child { white-space: normal; }
.mrow.total { font-weight: 700; font-size: 17px; }
.mrow.big { font-size: 17px; font-weight: 700; }
.mrow.due span:last-child { color: var(--due); } .mrow.paid span:last-child, .mrow.ok span:last-child { color: var(--paid); }
.mrow.link { text-decoration: none; color: var(--text); }
details summary { cursor: pointer; padding: 8px 0; color: var(--brand); font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li small { color: var(--muted); display: block; }
.ev-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; margin: 6px 6px 0 0; }

.summary div { margin-top: 4px; }
.done-card { text-align: center; padding: 24px 16px; }
.done-card .big-icon { font-size: 54px; }
.done-card h2 { margin: 8px 0; }
.stat-card .stat { font-size: 28px; font-weight: 800; margin: 4px 0; }
.stat-row { display: flex; gap: 8px; margin-top: 8px; }
.stat-row span { flex: 1; background: var(--bg); border-radius: 10px; padding: 8px; font-size: 12px; color: var(--muted); }
.stat-row b { display: block; color: var(--text); font-size: 14px; }

.login { margin-top: 40px; }
.login .logo { font-size: 64px; text-align: center; }
.loading-block { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--line), var(--card)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 90px); z-index: 50; padding: 14px 16px; border-radius: 12px; color: #fff; font-weight: 600; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: #b91c1c; } .toast.ok { background: #15803d; }
.toast[hidden] { display: none; }
