/* ============================================================
   Pick a Court — Cebu
   Clean, light-first, Airbnb-inspired: white ground, hairline
   borders, generous radii, one coral accent reserved for primary
   actions and favourites. Green is semantic (booked/played) only.
   Information hierarchy comes from weight and spacing, not hue.
   ============================================================ */

:root {
  --ground: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --ink: #222222;
  --ink-2: #5e5e5e;
  --ink-3: #8a8a8a;
  --line: #ebebeb;
  --line-2: #dddddd;

  --accent: #e0455c;
  --accent-2: #c93a50;
  --accent-ink: #ffffff;
  --accent-wash: #fdf0f2;

  --good: #0e8a5f;
  --good-wash: #e9f6f0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.18);

  --font-body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-card: 16px;
  --r-input: 12px;
  --r-pill: 999px;
  --wrap: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #141414;
    --surface: #1e1e1e;
    --surface-2: #262626;
    --ink: #f0f0f0;
    --ink-2: #b3b3b3;
    --ink-3: #8c8c8c;
    --line: #2e2e2e;
    --line-2: #404040;

    --accent: #ff5a76;
    --accent-2: #ff7089;
    --accent-ink: #1a1a1a;
    --accent-wash: #33212530;

    --good: #34c88a;
    --good-wash: #1d322833;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);
  }
}

/* The page follows the OS theme by default; the header toggle stamps
   data-theme on <html>, which must beat the media query both ways —
   hence full redeclaration, not partial override. */
:root[data-theme="light"] {
  --ground: #ffffff; --surface: #ffffff; --surface-2: #f7f7f7;
  --ink: #222222; --ink-2: #5e5e5e; --ink-3: #8a8a8a;
  --line: #ebebeb; --line-2: #dddddd;
  --accent: #e0455c; --accent-2: #c93a50; --accent-ink: #ffffff; --accent-wash: #fdf0f2;
  --good: #0e8a5f; --good-wash: #e9f6f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.18);
}
:root[data-theme="dark"] {
  --ground: #141414; --surface: #1e1e1e; --surface-2: #262626;
  --ink: #f0f0f0; --ink-2: #b3b3b3; --ink-3: #8c8c8c;
  --line: #2e2e2e; --line-2: #404040;
  --accent: #ff5a76; --accent-2: #ff7089; --accent-ink: #1a1a1a; --accent-wash: #33212530;
  --good: #34c88a; --good-wash: #1d322833;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win. Without this, any element that
   also has an explicit display (e.g. .grid { display: grid }) ignores
   hidden entirely — the UA's [hidden] rule loses to any authored display. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 20;
  background: var(--ink); color: var(--ground); padding: 8px 14px; border-radius: var(--r-pill);
}
.skip:focus { left: 24px; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

button { font-family: inherit; }

/* ─────────────── masthead ─────────────── */
.masthead {
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.masthead-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); display: block; }
.brand-mark svg { width: 28px; height: 28px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--ink-3); font-weight: 500; }

.header-tools { display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-pill); }
.tab {
  font-size: 13.5px; font-weight: 600;
  background: none; border: 0; color: var(--ink-2);
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: color .15s ease, background-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ground); background: var(--ink); }
.tab-count {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--accent); color: var(--accent-ink);
  padding: 1px 6px; border-radius: var(--r-pill);
}

.theme-btn {
  background: none; border: 1px solid var(--line-2); color: var(--ink-2);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s ease, color .15s ease;
}
.theme-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; }
/* No data-theme: follow the system. */
.ico-sun { display: none; }
.ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  .ico-sun { display: block; }
  .ico-moon { display: none; }
}
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }
:root[data-theme="light"] .ico-sun { display: none; }
:root[data-theme="light"] .ico-moon { display: block; }

/* ─────────────── stat strip ───────────────
   One quiet line of number+label pairs instead of KPI tiles: these are
   mostly facts, not metrics, and typography carries them fine. Hairline
   dividers between items; wraps naturally on narrow screens. */
.statbar {
  display: flex; flex-wrap: wrap; align-items: baseline;
  row-gap: 8px; margin: 20px 0 18px;
}
.stat-item {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 13px; color: var(--ink-3); white-space: nowrap;
}
.stat-item b {
  font-size: 16px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.stat-item + .stat-item { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); }
.stat-item[title] { cursor: help; }

/* ─────────────── controls ─────────────── */
.controls { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.field { position: relative; display: flex; }
.field.search { flex: 1 1 300px; }
.search-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-3); pointer-events: none;
}

input, select, textarea {
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-input); padding: 10px 14px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select {
  cursor: pointer;
  padding-right: 42px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input[type="search"] {
  padding-left: 42px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
input[type="search"]:focus { box-shadow: var(--shadow-md); }
.field select { border-radius: var(--r-pill); }

/* ─────────────── catalog layout: filter rail + content ─────────────── */
.catalog {
  display: grid; grid-template-columns: 248px minmax(0, 1fr);
  gap: 32px; align-items: start;
}
.main-col { min-width: 0; }

.sidebar {
  position: sticky; top: 84px;
  max-height: calc(100vh - 100px); overflow-y: auto;
  padding-right: 6px;
}
.sidebar-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.sidebar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }

.facet { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facet:last-of-type { border-bottom: 0; }
.facet-title {
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 0 0 8px;
}
.facet-list { display: flex; flex-direction: column; gap: 2px; }

.facet-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  background: none; border: 0; cursor: pointer;
  padding: 7px 10px; border-radius: 8px;
  transition: background-color .12s ease, color .12s ease;
}
.facet-row:hover { background: var(--surface-2); color: var(--ink); }
/* Selected facet goes solid ink — the accent stays reserved for actions. */
.facet-row[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.facet-n { font-family: var(--font-mono); font-size: 11px; opacity: .6; }

.facet-check {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  padding: 7px 10px; border-radius: 8px;
  transition: background-color .12s ease, color .12s ease;
}
.facet-check:hover { background: var(--surface-2); color: var(--ink); }
.facet-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }

/* The Apply button exists only for the mobile sheet. */
.sidebar-apply { display: none; }
.sidebar-backdrop { display: none; }

/* Mobile: the rail becomes a bottom sheet behind the Filters button. */
.filters-btn {
  display: none;
  align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  padding: 10px 16px; border-radius: var(--r-pill); cursor: pointer;
}
.filters-btn svg { width: 15px; height: 15px; }
.filter-badge {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--ink); color: var(--ground);
  padding: 1px 6px; border-radius: var(--r-pill);
}

@media (max-width: 900px) {
  .catalog { display: block; }
  .filters-btn { display: inline-flex; }

  .sidebar { display: none; }
  .sidebar.open {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    max-height: 78vh; overflow-y: auto;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px calc(16px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open .sidebar-apply {
    display: block; width: 100%;
    position: sticky; bottom: 0; margin-top: 10px;
  }
  .sidebar-backdrop.show {
    display: block;
    position: fixed; inset: 0; z-index: 39;
    background: rgba(0, 0, 0, .45);
  }
}

/* ─────────────── sync ─────────────── */
.sync-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-2);
  padding: 10px 14px; border-radius: var(--r-pill); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.sync-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.sync-btn:disabled { opacity: .55; cursor: default; }
.sync-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.sync-btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.share-btn:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.share-btn svg { width: 16px; height: 16px; }

/* ─────────────── show more ─────────────── */
.more-wrap { display: flex; justify-content: center; margin-top: 24px; }
.show-more {
  font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 10px;
  padding: 11px 22px; cursor: pointer;
  transition: background-color .15s ease;
}
.show-more:hover { background: var(--surface-2); }

.btn {
  font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 18px; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn-ghost {
  font-size: 13px; font-weight: 500;
  background: none; border: 1px solid transparent; color: var(--ink-2);
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; text-decoration-color: transparent;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.btn-ghost:hover { color: var(--ink); text-decoration-color: var(--ink-3); }

.result-line {
  font-size: 13px; color: var(--ink-3); margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.notice {
  display: inline-flex; align-items: center; gap: 7px;
  width: fit-content;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2);
  padding: 6px 10px; border-radius: var(--r-pill);
}
.offline-pill { margin: -4px 0 14px; }
.notice-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* ─────────────── court grid ─────────────── */
.grid {
  /* Default (stretch) alignment on purpose: every card in a row gets the
     row's height, and .court-foot's margin-top:auto absorbs the difference —
     so a 1-tier card and a 3-tier card sit flush top and bottom. */
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.court {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 18px;
  display: flex; flex-direction: column; gap: 11px;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 260px;
}
.court:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-2);
  transform: translateY(-2px);
}

.court-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.court-name {
  font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0; line-height: 1.3; text-wrap: balance;
}
.court-loc { font-size: 13px; color: var(--ink-3); margin: 2px 0 0; }

.fav {
  background: none; border: 0; cursor: pointer; padding: 4px;
  color: var(--ink-3); line-height: 0; flex-shrink: 0;
  transition: color .15s ease, transform .1s ease;
}
.fav:hover { color: var(--ink); transform: scale(1.1); }
.fav svg { width: 18px; height: 18px; }
.fav[aria-pressed="true"] { color: var(--accent); }
.fav[aria-pressed="true"] svg { fill: currentColor; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2);
}
.badge.type-Indoor, .badge.type-Outdoor, .badge.type-Covered { background: var(--surface-2); color: var(--ink-2); }
.badge.booked { background: var(--good-wash); color: var(--good); }

.rates { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.rate {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.rate-amt { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); font-weight: 500; }
.rate-free { color: var(--good); }

.court-foot {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: auto; padding-top: 6px;
}
.book {
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  transition: background-color .15s ease, border-color .15s ease;
}
.book:hover { background: var(--accent-2); border-color: var(--accent-2); }
/* Social is a fallback — it must not compete with the primary path. */
.book.social, .book.phone {
  background: none; color: var(--ink-2); border-color: var(--line-2);
}
.book.social:hover, .book.phone:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.book svg { width: 12px; height: 12px; }

.log-btn {
  font-size: 13px; font-weight: 600;
  background: none; border: 1px solid var(--line-2); color: var(--ink-2);
  padding: 8px 13px; border-radius: 10px; cursor: pointer; margin-left: auto;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.log-btn:hover { border-color: var(--ink); color: var(--ink); }

.verified { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.walkin { font-size: 11.5px; color: var(--ink-3); }

.empty { text-align: center; color: var(--ink-3); padding: 56px 0; }

/* ─────────────── bookings ─────────────── */
.booking-layout {
  display: grid; grid-template-columns: minmax(280px, 350px) 1fr;
  gap: 20px; align-items: start;
}
@media (max-width: 820px) { .booking-layout { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 20px;
}
.card-title {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 14px; color: var(--ink);
}
.past-head { margin-top: 30px; }

.form-card { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 84px; }
.field-row { display: flex; flex-direction: column; gap: 5px; }
.field-row > label,
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── segmented radio (booking status) ──────────────────── */
/* Native radios sharing a name, so arrow-key navigation and form reset come
   free; the inputs are hidden and their labels do the drawing. */
.seg {
  display: flex; gap: 4px; background: var(--surface-2);
  padding: 4px; border-radius: var(--r-pill);
}
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label {
  flex: 1; text-align: center; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  padding: 6px 4px; border-radius: var(--r-pill);
  transition: color .15s ease, background-color .15s ease;
}
.seg label:hover { color: var(--ink); }
.seg input:checked + label { background: var(--ink); color: var(--ground); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── star rating ───────────────────────────────────────── */
/* Stars sit in reverse DOM order (5→1) and row-reverse flips them back, so a
   plain `input:checked ~ label` fills every star to the left of the checked
   one. Avoids fifteen :has() selectors for the same effect. */
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; padding: 3px 0; }
.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.stars label {
  cursor: pointer; font-size: 20px; line-height: 1.1; color: var(--ink-3);
  opacity: .35; transition: opacity .12s ease, color .12s ease;
}
.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: var(--accent); opacity: 1; }
.stars input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form-msg { font-size: 13px; margin: 0; color: var(--ink-3); min-height: 1em; }
.form-msg.ok { color: var(--good); }
.form-msg.err { color: var(--accent); }

.list-head { display: flex; justify-content: space-between; align-items: center; }
.list-head .card-title { margin-bottom: 14px; }

.bk {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 14px 16px; margin-bottom: 10px;
  display: flex; gap: 14px; align-items: center;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.bk:hover { box-shadow: var(--shadow-sm); border-color: var(--line-2); }
.bk.is-past { opacity: .62; }
.bk-when {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
  text-align: center; line-height: 1.3; flex-shrink: 0;
  min-width: 54px; padding: 8px 6px;
  background: var(--surface-2); border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.bk-day { font-family: var(--font-body); font-size: 19px; font-weight: 700; color: var(--ink); display: block; }
.bk-body { flex: 1; min-width: 0; }
.bk-court { font-size: 14.5px; font-weight: 600; margin: 0; }
.bk-meta { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 0; }

/* A cancelled row stays legible but visibly out of the running — it is
   excluded from every total, so it should not read as a normal session. */
.bk.is-off { opacity: .5; }
.bk.is-off .bk-cost { text-decoration: line-through; }
.bk-tag {
  display: inline-block; vertical-align: 1px; margin-left: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 7px;
}
.bk-stars { margin-left: 6px; font-size: 12px; color: var(--accent); letter-spacing: 1px; }
.bk-cost { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.bk-acts { display: flex; gap: 2px; flex-shrink: 0; }

.foot {
  margin: 48px auto 32px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-3);
}
.foot p { margin: 0 0 4px; }
.foot a { color: var(--ink-2); }
.foot-sub { display: flex; gap: 6px; align-items: center; }
.sync { font-family: var(--font-mono); font-size: 11px; }
.sync.on { color: var(--good); }
.sync.off { color: var(--ink-3); }

/* ─────────────── dialog ─────────────── */
.dlg {
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--surface); color: var(--ink);
  padding: 24px; max-width: 360px; width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
}
.dlg::backdrop { background: rgba(0, 0, 0, .5); }
.dlg h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
.dlg p { font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }
.dlg code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.dlg form { display: flex; flex-direction: column; gap: 10px; }

/* ─────────────── view switcher ─────────────── */
.views {
  display: flex; gap: 4px; background: var(--surface-2);
  padding: 4px; border-radius: var(--r-pill); align-self: center;
}
.view-btn {
  background: none; border: 0; color: var(--ink-3); cursor: pointer;
  width: 36px; height: 32px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s ease, background-color .15s ease;
}
.view-btn:hover { color: var(--ink); }
.view-btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.view-btn svg { width: 15px; height: 15px; }

/* ─────────────── list view ─────────────── */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--r-card);
  overflow-x: auto; background: var(--surface);
}
.courts-table { border-collapse: collapse; width: 100%; min-width: 840px; }
.courts-table th {
  font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.courts-table td {
  font-size: 13.5px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.courts-table tr:last-child td { border-bottom: 0; }
.courts-table tbody tr { transition: background-color .12s ease; }
.courts-table tbody tr:hover { background: var(--surface-2); }
.courts-table .num { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-name { display: block; font-weight: 600; }
.t-loc { display: block; font-size: 12px; color: var(--ink-3); }
.t-check { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.book.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; white-space: nowrap; }
.courts-table .fav { padding: 2px; }
.courts-table .log-btn { margin-left: 0; padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

/* ─────────────── map view ─────────────── */
.map-wrap {
  border: 1px solid var(--line); border-radius: var(--r-card);
  overflow: hidden; background: var(--surface-2);
}
#map { height: min(62vh, 640px); min-height: 420px; width: 100%; }
.map-note { font-size: 12px; color: var(--ink-3); margin: 8px 2px 0; }

/* Leaflet chrome, restyled to match the cards. */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--ink);
  border-radius: 12px; box-shadow: var(--shadow-md);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-family: var(--font-body); font-size: 13px; margin: 14px 16px; line-height: 1.45; }
.pop-name { font-weight: 700; font-size: 14px; display: block; }
.pop-loc { color: var(--ink-3); font-size: 12px; display: block; margin-bottom: 4px; }
.pop-rate { font-family: var(--font-mono); font-size: 12px; display: block; margin-bottom: 8px; }
.leaflet-container a.pop-book {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 8px;
  text-decoration: none;
}
.leaflet-container a.pop-book:hover { background: var(--accent-2); color: var(--accent-ink); }
.leaflet-container a.pop-book.social { background: none; border: 1px solid var(--line-2); color: var(--ink-2); }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--ink-3); }
.leaflet-control-attribution a { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .wrap { padding-inline: 14px; }

  .masthead {
    top: 0;
    padding-top: env(safe-area-inset-top);
  }
  .masthead-in {
    min-height: 58px;
    gap: 10px;
  }
  .brand-mark svg { width: 25px; height: 25px; }
  .brand-text strong { font-size: 16px; }
  .brand-sub { display: none; }
  .header-tools { margin-left: auto; }
  .tabs { padding: 3px; }
  .tab {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 13px;
  }
  .theme-btn {
    width: 38px;
    height: 38px;
  }

  .statbar {
    margin: 14px 0 12px;
    row-gap: 6px;
  }
  .stat-item {
    font-size: 12px;
  }
  .stat-item b {
    font-size: 14px;
    max-width: 126px;
  }
  .stat-item + .stat-item {
    margin-left: 10px;
    padding-left: 10px;
  }
  .offline-pill { margin: 0 0 12px; }

  .controls {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    margin-bottom: 12px;
  }
  .field.search {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
  }
  input[type="search"] {
    min-height: 46px;
    font-size: 16px;
  }
  .filters-btn,
  .field select,
  .share-btn,
  .sync-btn {
    min-height: 42px;
  }
  .filters-btn {
    grid-column: 1;
    padding-inline: 14px;
  }
  .controls > .field:not(.search) {
    grid-column: 2;
    min-width: 0;
  }
  .views {
    grid-column: 3;
    align-self: stretch;
  }
  .view-btn {
    width: 34px;
    min-height: 34px;
  }
  .share-btn {
    grid-column: 4;
    width: 42px;
    height: 42px;
  }
  .sync-btn {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .court {
    border-radius: 14px;
    padding: 16px;
  }
  .court:hover {
    transform: none;
  }
  .court-foot {
    align-items: stretch;
  }
  .book,
  .log-btn {
    min-height: 40px;
    justify-content: center;
  }
  .log-btn {
    margin-left: 0;
    flex: 1 1 86px;
  }

  .sidebar.open {
    max-height: min(82vh, 680px);
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .facet-row,
  .facet-check {
    min-height: 42px;
  }

  .booking-layout {
    gap: 16px;
  }
  .form-card {
    position: static;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .bk {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: start;
    gap: 10px 12px;
    padding: 14px;
  }
  .bk-cost {
    grid-column: 2;
  }
  .bk-acts {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .bk-acts .btn-ghost {
    min-height: 38px;
  }

  #map {
    height: calc(100svh - 238px);
    min-height: 360px;
  }
}
