:root {
  --bg: #f5f3ee; --card: #ffffff; --ink: #1d2422; --muted: #6b736f; --line: #e2ded5;
  --accent: #1f4d42; --accent-2: #2f6f5e; --accent-ink: #ffffff; --soft: #e7efe9;
  --warn: #b5431f; --warn-soft: #fbe9e2; --ok: #2c7a4b; --ok-soft: #e3f2e8; --pending: #b7861a; --pending-soft: #fbf2dc;
  --plate: #f4c400; --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --card: #1b2120; --ink: #e9eeec; --muted: #9aa5a0; --line: #2b3331;
    --accent: #5fb39a; --accent-2: #5fb39a; --accent-ink: #0d1312; --soft: #1f2d29;
    --warn: #ff8a65; --warn-soft: #3a221b; --ok: #6fcf97; --ok-soft: #1a2e22; --pending: #e6b94c; --pending-soft: #33291a;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
h2 { font-size: 1.15rem; margin: 18px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pad { padding: 24px 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--accent); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.who { font-size: .9rem; opacity: .9; }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; text-align: center; padding: 8px 2px 9px; font-size: .72rem; color: var(--muted); text-decoration: none;
  position: relative; min-width: 0;
}
.tabs a .ic { display: block; font-size: 1.25rem; line-height: 1.3; }
.tabs a.on { color: var(--accent-2); font-weight: 600; }
.dot { position: absolute; top: 5px; left: 55%; min-width: 17px; height: 17px; border-radius: 9px; background: var(--warn);
  color: #fff; font-size: .68rem; line-height: 17px; padding: 0 4px; font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0;
  box-shadow: var(--shadow); }
.card.urgent { border-color: var(--warn); }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 11px;
  padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 44px;
}
button.primary, .btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); font-weight: 600; }
button.danger { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.block, .btn.block { width: 100%; }
button.urgent-toggle { border: 2px dashed var(--warn); color: var(--warn); background: transparent; font-weight: 700; width: 100%; }
button.urgent-toggle.on { background: var(--warn); color: #fff; border-style: solid; }

label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent-2); }
.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: .95rem; margin: 8px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .two { grid-template-columns: 1fr; } }

/* car filter chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip { flex: none; border-radius: 999px; padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* month calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; }
.cal-head h2 { margin: 0; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .dow { font-size: .72rem; text-align: center; color: var(--muted); padding: 4px 0; }
.day {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; min-height: 64px; padding: 4px 3px;
  font-size: .78rem; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; gap: 2px; text-align: left;
  color: var(--ink); min-width: 0;
}
.day.other { opacity: .4; }
.day.today { border-color: var(--accent-2); border-width: 2px; }
.day.sel { outline: 2px solid var(--ink); outline-offset: -1px; }
.day .n { font-weight: 600; font-size: .8rem; }
.bar { border-radius: 4px; padding: 0 3px; font-size: .66rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 15px; }
.bar.pending { background: repeating-linear-gradient(45deg, var(--pending-soft), var(--pending-soft) 4px, transparent 4px, transparent 8px);
  color: var(--ink); border: 1px dashed var(--pending); }
.more { font-size: .64rem; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--muted); margin: 8px 0; flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.lg { width: 16px; height: 10px; border-radius: 3px; background: var(--accent-2); display: inline-block; }
.lg.p { background: var(--pending-soft); border: 1px dashed var(--pending); }

.slot { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.slot:first-child { border-top: 0; }
.slot .tm { font-variant-numeric: tabular-nums; font-size: .9rem; min-width: 96px; }

.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: .75rem; font-weight: 600; }
.b-pending { background: var(--pending-soft); color: var(--pending); }
.b-approved { background: var(--ok-soft); color: var(--ok); }
.b-rejected, .b-expired, .b-cancelled { background: var(--line); color: var(--muted); }
.b-urgent { background: var(--warn-soft); color: var(--warn); }
.b-active { background: var(--accent-2); color: var(--accent-ink); }

/* availability picker */
.cars-pick { display: grid; gap: 8px; }
.car-opt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg); cursor: pointer; }
.car-opt.busy { opacity: .55; cursor: not-allowed; }
.car-opt.on { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2) inset; }
.state-free { color: var(--ok); font-weight: 600; font-size: .85rem; }
.state-busy { color: var(--warn); font-weight: 600; font-size: .85rem; }

.plate { display: inline-flex; align-items: stretch; border-radius: 6px; overflow: hidden; border: 2px solid #111; font-weight: 800;
  letter-spacing: 1px; font-family: ui-monospace, "Segoe UI", sans-serif; }
.plate .eu { background: #003399; color: #ffcc00; font-size: .6rem; padding: 2px 4px; display: flex; align-items: flex-end; }
.plate .no { background: var(--plate); color: #111; padding: 3px 9px; font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .92rem; margin-top: 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.warn-txt { color: var(--warn); font-weight: 600; }
.note { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: .88rem; margin: 10px 0; }
.note.warn { background: var(--warn-soft); }
.amount { font-size: 1.6rem; font-weight: 800; }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-inner { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-inner h2 { margin-top: 0; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30; max-width: 520px;
  margin: 0 auto; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: .95rem; }
.toast.err { background: var(--warn); color: #fff; }

.photo-prev { max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 8px; display: block; }
.prob img { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.login { max-width: 420px; margin: 40px auto; }
.copy { word-break: break-all; font-family: ui-monospace, monospace; font-size: .85rem; background: var(--bg); padding: 8px;
  border-radius: 8px; border: 1px solid var(--line); }
table.members { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.members th, table.members td { padding: 6px 4px; border-top: 1px solid var(--line); text-align: center; }
table.members th:first-child, table.members td:first-child { text-align: left; }
.ev { font-size: .82rem; border-top: 1px solid var(--line); padding: 6px 0; }
details > summary { cursor: pointer; color: var(--accent-2); font-weight: 600; padding: 8px 0; }
