/* Red Bucket Clients: the street map underneath, ink bars on top, a suds-white sheet for the details,
   and bucket red for anything booked. Anton for names, numbers and labels; Wix Madefor Text for the rest. */
@font-face { font-family: "Anton"; src: url("fonts/Anton.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Wix Madefor Text"; src: url("fonts/WixMadeforText.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --red: oklch(55% 0.2 29); --red-deep: oklch(46% 0.18 29); --on-red: oklch(99% 0.003 90);
  --ink-bar: oklch(19% 0.006 60); --on-bar: oklch(97.5% 0.004 90); --bar-soft: oklch(78% 0.008 80);
  --amber: oklch(80% 0.14 78); --on-amber: oklch(22% 0.03 70);
  --bg: oklch(97.5% 0.004 90);
  --card: oklch(100% 0 0);
  --fg: oklch(19% 0.006 60);
  --muted: oklch(44% 0.008 60);
  --line: oklch(89% 0.007 80);
  --concrete: oklch(85% 0.008 80);
  --good: oklch(45% 0.12 150);
  --warn-bg: oklch(95% 0.045 85);
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --body: "Wix Madefor Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
  --tabs-h: 64px;
  --act: var(--ink-bar);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(20% 0.006 60); --card: oklch(25% 0.006 60); --fg: oklch(96% 0.004 90); --muted: oklch(75% 0.008 80);
    --line: oklch(33% 0.006 60); --concrete: oklch(30% 0.006 60); --warn-bg: oklch(31% 0.05 80); --red: oklch(60% 0.2 29);
    --act: oklch(36% 0.006 60);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--concrete); color: var(--fg);
  font: 400 17px/1.45 var(--body); font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
a { color: inherit; }
h1, h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
h1 { font-size: 2.1rem; line-height: 1.02; margin: 0 0 6px; }
h2 { font-size: 1.05rem; letter-spacing: .05em; color: var(--muted); margin: 26px 0 8px; display: flex; align-items: baseline; gap: 8px; }
h2 small { font-family: var(--body); font-size: .85rem; letter-spacing: 0; text-transform: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; z-index: 0; background: var(--concrete); }
.leaflet-container { font-family: var(--body); }
.leaflet-top { top: calc(var(--safe-t) + 70px); }
.leaflet-control-attribution { font-size: 11px; border-radius: 6px 0 0 6px; }
.pinwrap { background: none; border: 0; }
.pin {
  --pin: var(--ink-bar); --pin-fg: var(--on-bar);
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 9px));
  white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: var(--pin); color: var(--pin-fg);
  font: 600 13px/1.1 var(--body); box-shadow: 0 3px 10px oklch(0% 0 0 / .32); cursor: pointer;
}
.pin b { font-weight: 800; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: var(--pin); }
.pin.s-today, .pin.s-booked { --pin: var(--red); --pin-fg: var(--on-red); }
.pin.s-today { font-size: 15px; padding: 8px 12px; }
.pin.s-due, .pin.s-owes { --pin: var(--amber); --pin-fg: var(--on-amber); }
.pin.stack1 { transform: translate(-50%, calc(-200% - 18px)); }
.pin.stack2 { transform: translate(-50%, calc(-300% - 27px)); }
.pin.stack3 { transform: translate(-50%, calc(-400% - 36px)); }

/* ---------- top bar ---------- */
.bar {
  position: fixed; z-index: 10; top: calc(var(--safe-t) + 10px); left: var(--gl); right: var(--gr);
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 6px 6px 16px;
  background: var(--ink-bar); color: var(--on-bar); border-radius: 999px; box-shadow: 0 6px 20px oklch(0% 0 0 / .28);
}
.bar p { margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; color: var(--bar-soft); }
.bar b { font-family: var(--display); font-weight: 400; font-size: 19px; color: var(--on-bar); letter-spacing: .02em; }
.bar b.nm { font-family: var(--body); font-weight: 800; font-size: 15px; }
.lab { font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--red); margin-right: 8px; font-size: 15px; }
.bar .lab { color: oklch(68% 0.19 29); }

/* ---------- bottom tabs ---------- */
.tabs {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr 76px 1fr; align-items: end;
  padding: 4px var(--gr) calc(var(--safe-b) + 4px) var(--gl); background: var(--ink-bar); color: var(--on-bar); min-height: calc(var(--tabs-h) + var(--safe-b));
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; color: var(--bar-soft); text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.tabs a[aria-current] { color: var(--on-bar); }
.tabs a[aria-current] svg { stroke: oklch(68% 0.19 29); }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs .plus { justify-self: center; width: 62px; height: 62px; min-height: 0; margin-bottom: 6px; border-radius: 50%; background: var(--red); color: var(--on-red); border: 4px solid var(--ink-bar); box-shadow: 0 0 0 2px oklch(60% 0.2 29 / .35); transform: translateY(-14px); }
.tabs .plus svg { width: 28px; height: 28px; stroke-width: 2.6; }

/* ---------- the sheet ---------- */
.sheet {
  position: fixed; z-index: 5; left: 0; right: 0; top: calc(var(--safe-t) + 72px); bottom: calc(var(--tabs-h) + var(--safe-b));
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; outline: none;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px oklch(0% 0 0 / .2);
  padding: 18px var(--gr) 64px var(--gl); /* bottom room for the raised + button */
}
body[data-view="map"] .sheet, body[data-view="move"] .sheet {
  top: auto; background: none; box-shadow: none; border-radius: 0; overflow: visible; padding-top: 0; padding-bottom: 12px; pointer-events: none;
}
body[data-view="map"] .sheet > *, body[data-view="move"] .sheet > * { pointer-events: auto; }
body[data-view="card"] .sheet { top: 42vh; top: 42dvh; }

.head, .cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.head h1 { margin: 0; }
.back { text-decoration: none; font-weight: 700; color: var(--muted); padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center; }

.peek {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  background: var(--bg); border-radius: 20px; box-shadow: 0 10px 28px oklch(0% 0 0 / .3);
}
.peek-main { flex: 1; min-width: 0; margin: 0; text-decoration: none; display: grid; }
.peek-main b { font-size: 1.15rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-main small { color: var(--muted); font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek .go { min-width: 72px; }
.movebar { flex-wrap: wrap; }
.movebar .peek-main { flex-basis: 100%; }
.movebar .peek-main b, .movebar .peek-main small { white-space: normal; }
.movebar .row-btns { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--fg); background: transparent; color: var(--fg);
  font: 700 16px/1 var(--body); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.red { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.ghost { border-color: var(--line); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn:disabled { opacity: .55; }
.bar .btn.red { min-height: 40px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: 15px; padding: 10px 0; min-height: 44px; cursor: pointer; }
.danger { color: var(--red); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.row-btns.end { margin-top: 24px; }
.ask { width: 100%; margin: 0; font-weight: 800; }

/* ---------- client list ---------- */
.search input { margin-bottom: 4px; }
.sec h2 { margin-top: 20px; }
.rows, .hist, .cars { list-style: none; margin: 0; padding: 0; }
.rows li + li, .hist li + li, .cars li + li { border-top: 1px solid var(--line); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; text-decoration: none; min-height: 60px; }
.who { min-width: 0; display: grid; }
.who b { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small, .when small { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { flex: none; display: grid; justify-items: end; gap: 3px; text-align: right; }
.when b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .8rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.p-today { background: var(--red); color: var(--on-red); }
.p-booked { border: 1.5px solid var(--fg); }
.p-due, .p-owes { background: var(--amber); color: var(--on-amber); }

/* ---------- client card ---------- */
.addr { margin: 0; font-size: 1.05rem; font-weight: 600; }
.dir { margin: 4px 0 0; color: var(--muted); }
.warn { background: var(--warn-bg); padding: 10px 12px; border-radius: 12px; margin: 12px 0 0; font-size: .95rem; }
.warn a, .pinok a { font-weight: 800; }
.pinok { margin: 6px 0 0; font-size: .92rem; color: var(--muted); }
.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin: 16px 0 0; }
.act {
  display: flex; align-items: center; justify-content: center; min-height: 56px; border-radius: 16px; border: 0;
  background: var(--act); color: var(--on-bar); font: 800 16px/1 var(--body); text-decoration: none; cursor: pointer;
}
.act.red { background: var(--red); color: var(--on-red); }
.phone { margin: 8px 0 0; color: var(--muted); font-size: .95rem; user-select: all; -webkit-user-select: all; }
.texts { display: grid; gap: 8px; margin: 12px 0 0; padding: 12px; border: 1.5px solid var(--line); border-radius: 16px; }
.texts[hidden] { display: none; }
.texts p { margin: 0 0 2px; color: var(--muted); font-size: .92rem; }
.texts a { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.booking { background: var(--card); border: 2px solid var(--fg); border-radius: 18px; padding: 14px 16px 16px; }
.bwhen { font-family: var(--display); font-size: 1.7rem; line-height: 1; margin: 0 0 6px; color: var(--red); text-transform: uppercase; }
.cars li, .hist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; flex-wrap: wrap; }
.cars li > span:first-child, .hist li > span:first-child, .histlink { display: grid; min-width: 0; flex: 1; }
.cars small, .hist small { color: var(--muted); font-size: .9rem; }
.histlink { text-decoration: none; }
.amt { font-family: var(--display); font-size: 1.3rem; display: grid; justify-items: end; line-height: 1.05; }
.amt small { font-family: var(--body); font-size: .8rem; }
.amt em { font-style: normal; color: var(--red); font-weight: 800; }
.amt.in { color: var(--good); }
.hist-btns { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 0; padding-top: 10px; border-top: 2px solid var(--fg); font-weight: 800; }
.total b { font-family: var(--display); font-weight: 400; font-size: 1.7rem; }
.none { color: var(--muted); margin: 0; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; margin-top: 8px; }
.form label, .unlock label:not(.tick) { display: grid; gap: 6px; font-weight: 800; font-size: 15px; }
.form label small { font-weight: 500; color: var(--muted); }
input, select {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--fg); font: 400 17px/1.3 var(--body); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { border-color: var(--fg); outline: none; }
input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px oklch(55% 0.2 29 / .2); }
.tick { display: flex !important; align-items: center; gap: 10px; font-weight: 600 !important; min-height: 44px; }
.tick input { width: 24px; height: 24px; min-height: 0; padding: 0; accent-color: var(--red); -webkit-appearance: checkbox; appearance: auto; flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.find { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -4px; }
.find p { margin: 0; flex: 1; min-width: 12rem; font-size: .93rem; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 12px; }
legend { font-family: var(--display); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0; margin-bottom: 10px; font-size: 1.05rem; }
#cars { display: grid; gap: 12px; }
.car { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.pricerow { display: flex; align-items: end; gap: 12px; }
.pricerow label { flex: 1; }

/* ---------- money ---------- */
.ledger { width: 100%; border-collapse: collapse; background: var(--card); border: 2px solid var(--fg); border-radius: 14px; overflow: hidden; }
.ledger th, .ledger td { padding: 11px 8px; text-align: right; border-bottom: 1px solid var(--line); font-size: .95rem; }
.ledger tbody tr:last-child > * { border-bottom: 0; }
.ledger thead th { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ledger tbody th { text-align: left; font-weight: 600; color: var(--muted); }
.ledger td b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.facts { color: var(--muted); font-size: .95rem; margin: 10px 0 0; }
.fine { color: var(--muted); font-size: .85rem; margin: 18px 0 0; }

/* ---------- unlock ---------- */
body.locked #map, body.locked .bar, body.locked .tabs { display: none; }
body.locked { background: var(--ink-bar); }
body.locked .sheet { inset: 0; border-radius: 0; display: grid; place-items: center; background: var(--ink-bar); color: var(--on-bar); padding: calc(var(--safe-t) + 24px) var(--gr) calc(var(--safe-b) + 24px) var(--gl); }
.unlock { width: 100%; max-width: 24rem; display: grid; gap: 12px; }
.unlock img { border-radius: 18px; }
.unlock h1 { font-size: 2.6rem; margin: 6px 0 0; }
.unlock h1 span { color: oklch(68% 0.19 29); display: block; }
.unlock p { margin: 0; color: var(--bar-soft); }
.unlock input#code { font: 400 22px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; background: oklch(26% 0.006 60); color: var(--on-bar); border-color: oklch(36% 0.006 60); }
.unlock .msg { color: oklch(72% 0.17 29); font-weight: 700; min-height: 1.4em; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px);
  max-width: min(92vw, 30rem); padding: 12px 18px; border-radius: 14px; background: var(--ink-bar); color: var(--on-bar);
  font-weight: 700; font-size: .95rem; box-shadow: 0 8px 24px oklch(0% 0 0 / .35); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- laptop: the sheet becomes a side panel ---------- */
@media (min-width: 900px) {
  .sheet, body[data-view="card"] .sheet { left: 16px; right: auto; width: 430px; top: 16px; bottom: calc(16px + var(--tabs-h)); border-radius: 22px 22px 0 0; }
  body[data-view="map"] .sheet, body[data-view="move"] .sheet { left: 16px; right: auto; width: 430px; top: auto; bottom: calc(16px + var(--tabs-h)); }
  .tabs { left: 16px; right: auto; width: 430px; bottom: 16px; border-radius: 0 0 22px 22px; padding: 4px 16px; min-height: var(--tabs-h); }
  .bar { left: 466px; right: auto; width: min(560px, calc(100vw - 482px)); top: 16px; }
  .leaflet-top { top: 80px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
