:root {
  --brand: #1ea7dc;        /* Availa blue */
  --brand-dark: #0e84b5;
  --brand-light: #e3f5fc;
  --coral: #ff8a76;        /* PLAY coral */
  --coral-dark: #f2694f;
  --coral-light: #ffeeea;
  --accent: #1e9e8e;       /* teal — available/success, echoes the logo's map base + underline */
  --accent-light: #e2f5f2;
  --session: #7c3aed;      /* purple — scheduled play, to set it apart from play-now listings */
  --session-light: #f3ecff;
  --warn: #e08e45;
  --danger: #c62828;       /* pawn red */
  --danger-light: #fbe4e4;
  --ink: #16233e;          /* navy, from the logo's outline */
  --ink-soft: #57647d;
  --border: #e1e8ec;
  --bg: #f5f9fa;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(22, 35, 62, 0.06), 0 6px 20px rgba(22, 35, 62, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- top nav ---- */
.topnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 12px 16px;
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .topnav { position: static; }
  .topnav-inner { justify-content: center; text-align: center; }
  .nav-links { justify-content: center; width: 100%; }
}
.brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .dot { color: var(--brand); }
.brand-availa { color: var(--brand); }
.brand-play { color: var(--coral); }
.brand span > span { text-decoration: none; }
.brand span {
  position: relative;
  padding-bottom: 3px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: bottom left;
  background-size: 100% 2.5px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}
.nav-links a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.nav-links a.active { background: var(--brand-light); color: var(--brand-dark); }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--brand-light); color: var(--brand-dark); }
.btn-secondary:hover { background: #ded9ff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f0f0f7; }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: #f6d6d6; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 8px; }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- layout helpers ---- */
/* Only top/bottom: `.page` is used together with `.container`, whose side padding must survive. */
.page { padding-top: 28px; padding-bottom: 60px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { margin: 0 0 4px; font-size: 1.6rem; }
.muted { color: var(--ink-soft); }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---- cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.asset-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.asset-card h3 { margin: 0; font-size: 1.05rem; }
.asset-card .biz { color: var(--ink-soft); font-size: 0.85rem; }
.asset-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

/* ---- play-now vs scheduled-play cards ---- */
.asset-card.playnow-card, .asset-card.session-card { overflow: hidden; }
.asset-card.playnow-card { border-top: 4px solid var(--accent); }
.asset-card.session-card {
  border-top: 4px solid var(--session);
  background: linear-gradient(180deg, var(--session-light) 0%, var(--card) 60%);
}
.card-kind {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
/* "Play now" / "Scheduled" label on the left, BYOG badge (when the venue has one) on the right. */
.card-kind-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-kind-now { color: var(--accent); }
.card-kind-scheduled { color: var(--session); }
.session-photo-wrap { position: relative; margin: -18px -18px 0 -18px; }
.session-photo-wrap .asset-photo, .session-photo-wrap .asset-photo-placeholder {
  margin: 0; width: 100%; display: block; border-radius: 0;
}
/* Must stay flex (not block) so the emoji is centred rather than tucked under the date chip. */
.session-photo-wrap .asset-photo-placeholder { display: flex; background: var(--session-light); }
.date-chip {
  position: absolute; top: 10px; left: 10px;
  background: #fff; border-radius: 10px; padding: 6px 12px; text-align: center; line-height: 1.1;
  box-shadow: 0 2px 8px rgba(22, 35, 62, 0.18);
}
.date-chip .dow { display: block; font-size: 0.65rem; font-weight: 800; color: var(--session); letter-spacing: 0.06em; text-transform: uppercase; }
.date-chip .day { display: block; font-size: 1.4rem; font-weight: 800; color: var(--ink); }
.date-chip .mon { display: block; font-size: 0.7rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; }
.session-when { font-size: 0.9rem; font-weight: 600; color: var(--session); }

/* ---- listing photos ---- */
.asset-photo, .asset-photo-placeholder {
  margin: -18px -18px 0 -18px;
  height: 140px;
  border-radius: var(--radius) var(--radius) 0 0;
}
/* Whole picture, centred, in a fixed-height strip — keeps the card grid even without cropping photos. */
.asset-photo { object-fit: contain; background: var(--brand-light); }
/* The negative side margins pull the photo out to the card edges; without an explicit width it only
   spans the padded area and sits off-centre. Cards have 18px padding on each side. */
.asset-card > .asset-photo { width: calc(100% + 36px); max-width: none; }
.session-photo-wrap .asset-photo { background: var(--session-light); }
.asset-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; background: var(--brand-light);
}
.detail-photo, .detail-photo-placeholder {
  width: 100%; height: 220px; border-radius: var(--radius); margin-bottom: 14px;
}
/* Show the whole photo (any shape) instead of cropping it to a wide strip; tall or square pictures
   are capped in height and centred on a soft background. */
.detail-photo {
  height: auto; max-height: 380px; object-fit: contain; background: var(--brand-light);
}
.detail-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; background: var(--brand-light);
}
.thumb, .thumb-placeholder { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; }
.thumb { object-fit: cover; }
.thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; background: var(--brand-light);
}
.name-with-thumb { display: flex; align-items: center; gap: 10px; }
.form-photo-preview, .form-photo-placeholder {
  width: 160px; height: 120px; border-radius: 10px; display: flex; margin-bottom: 8px;
}
.form-photo-preview { object-fit: cover; }
.form-photo-placeholder {
  align-items: center; justify-content: center; font-size: 2.5rem; background: var(--brand-light);
}

/* ---- badges / pills ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-available { background: var(--accent-light); color: var(--accent); }
.badge-rented { background: #fdf1e2; color: var(--warn); }
.badge-free { background: var(--accent-light); color: var(--accent); }
.badge-price { background: var(--brand-light); color: var(--brand-dark); }
.badge-tag { background: #f0f0f7; color: var(--ink-soft); margin: 2px; }
.badge-banned { background: var(--danger-light); color: var(--danger); }
.badge-byog { background: var(--coral-light); color: var(--coral-dark); }

/* ---- business avatars ---- */
.biz-row { display: flex; align-items: center; gap: 8px; }
.biz-avatar, .biz-avatar-placeholder {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
}
.biz-avatar { object-fit: cover; }
.biz-avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; background: var(--brand-light);
}
.biz-avatar-lg, .biz-avatar-placeholder-lg {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
}
.biz-avatar-lg { object-fit: cover; }
.biz-avatar-placeholder-lg {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; background: var(--brand-light);
}

/* ---- forms ---- */
form.stack { display: flex; flex-direction: column; gap: 14px; }
label { font-weight: 700; font-size: 0.88rem; display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
.checkbox-row { display: flex; gap: 14px; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.88rem; margin: 0; }
.field-hint { color: var(--ink-soft); font-size: 0.8rem; margin-top: 4px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 20px; }
.filter-bar .field { min-width: 150px; }

/* ---- flashes ---- */
.flashes { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; }
.flash-success { background: var(--accent-light); color: var(--accent); }
.flash-error { background: var(--danger-light); color: var(--danger); }

/* ---- role shell: customer bottom-tab feel on mobile, dashboard sidebar for business ---- */
.dash-layout { display: flex; gap: 26px; align-items: flex-start; }
.dash-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 78px;
}
.dash-sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.dash-sidebar a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.dash-sidebar a.active { background: var(--brand); color: #fff; }
.dash-main { flex: 1; min-width: 0; }
@media (max-width: 800px) {
  /* stretch (not flex-start) so the content area is held to the screen width — otherwise a wide
     table makes the whole page scroll sideways instead of scrolling inside its own card */
  .dash-layout { flex-direction: column; align-items: stretch; }
  .dash-sidebar { width: 100%; position: static; display: flex; overflow-x: auto; gap: 4px; }
  .dash-sidebar a { white-space: nowrap; }
  .dash-main { width: 100%; }
}
@media (max-width: 600px) {
  .table-wrap.card { padding: 6px 14px; }

  /* Tables marked .stack-sm turn each row into a small labelled card on phones (cells carry a
     data-label), so nothing needs sideways scrolling and nothing gets squeezed or overlaps. */
  .stack-sm thead { display: none; }
  .stack-sm, .stack-sm tbody, .stack-sm tr, .stack-sm td { display: block; width: 100%; }
  .stack-sm tr { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .stack-sm tr:last-child { border-bottom: none; }
  .stack-sm td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 4px 0; border: none; text-align: right;
  }
  .stack-sm td::before {
    content: attr(data-label); flex-shrink: 0; text-align: left;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft);
  }
  .stack-sm td[data-label=""]::before { display: none; }
  .stack-sm td:first-child { justify-content: flex-start; text-align: left; font-weight: 700; padding-bottom: 8px; }
  .stack-sm td.actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; white-space: normal !important; }
  .stack-sm td:empty { display: none; }
  .stack-sm .name-with-thumb { gap: 10px; }

  /* Browse filters: every dropdown and the search box fill the card instead of being different widths */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .field { width: 100%; min-width: 0; }
  .filter-bar .field select, .filter-bar .field input[type="text"] { width: 100%; }
  .filter-bar .btn { width: 100%; }
}

/* ---- landing page ---- */
.hero {
  background: linear-gradient(160deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff;
  padding: 70px 0;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 16px; max-width: 700px; }
.hero p { font-size: 1.1rem; max-width: 600px; opacity: 0.95; }
.hero .cta-row { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--brand-dark); }
.hero .btn-primary:hover { background: #f0f0ff; }
.hero .btn-secondary { background: rgba(255,255,255,0.15); color: #fff; }
.hero .btn-secondary:hover { background: rgba(255,255,255,0.25); }
.hero-stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats div strong { font-size: 1.6rem; display: block; }

.section { padding: 60px 0; }
.section h2 { font-size: 1.7rem; margin-bottom: 10px; }
.section .lead { color: var(--ink-soft); max-width: 640px; margin-bottom: 34px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-card .emoji { font-size: 1.8rem; }

.tier-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tier-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .tier-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .tier-grid { grid-template-columns: 1fr; } }
.tier-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.tier-card.highlight { border-color: var(--coral); box-shadow: 0 0 0 2px var(--coral-light); }
.tier-card .price { font-size: 2rem; font-weight: 800; margin: 10px 0; }
.tier-card .price span { font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }
.tier-card ul { padding-left: 18px; margin: 16px 0; }
.tier-card li { margin-bottom: 6px; }

.footer { padding: 30px 0; color: var(--ink-soft); font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 40px; }
.footer .container { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; justify-content: space-between; }
.footer a { color: var(--ink-soft); font-weight: 600; }
.footer a:hover { color: var(--brand-dark); }
.footer-links { display: flex; gap: 18px; }

/* ---- legal pages (privacy policy, terms) ---- */
.legal { max-width: 760px; }
.legal h1 { margin-bottom: 4px; }
.legal .legal-updated { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 26px; }
.legal h2 { margin: 30px 0 8px; font-size: 1.2rem; }
.legal p, .legal li { line-height: 1.65; }
.legal ul { padding-left: 22px; margin: 8px 0 12px; }
.legal li { margin-bottom: 6px; }
.legal .legal-summary { background: var(--brand-light); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 8px; }

/* ---- auth ---- */
.auth-wrap { max-width: 440px; margin: 60px auto; }
.role-toggle { display: flex; gap: 8px; margin-bottom: 18px; }
.role-toggle a { flex: 1; text-align: center; padding: 10px; border-radius: 10px; border: 1px solid var(--border); font-weight: 700; color: var(--ink-soft); }
.role-toggle a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- misc ---- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }
.inline-form { display: inline; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; min-width: 140px; box-shadow: var(--shadow); }
.stat-box .num { font-size: 1.6rem; font-weight: 800; }
.stat-box .label { color: var(--ink-soft); font-size: 0.82rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; font-weight: 700; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }

/* In-page confirmation dialog (replaces the browser's confirm()) */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 30, 45, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.confirm-box {
  background: var(--card); border-radius: 14px; max-width: 420px; width: 100%;
  padding: 22px 22px 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}
.confirm-message { margin: 0 0 18px; font-size: 1rem; line-height: 1.45; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---- phone app: fixed top and bottom bars (templates/_app_bars.html), only inside the app ---- */
body.in-app {
  padding-top: calc(56px + env(safe-area-inset-top));
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}
body.in-app.app-typing { padding-bottom: 0; }
.app-topbar, .app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--card);
}
.app-topbar {
  top: 0;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.app-topbar svg, .app-tabbar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-back {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 8px 0 2px;
  border: 0;
  background: none;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 1.1rem;
}
.app-brand:hover { text-decoration: none; }
.app-menu { justify-self: end; position: relative; }
.app-menu summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}
.app-menu summary::-webkit-details-marker { display: none; }
.app-menu-panel {
  position: absolute;
  right: 4px;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(22, 35, 62, 0.15);
}
.app-menu-panel a {
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 600;
}
.app-menu-panel a:hover { background: var(--bg); text-decoration: none; }
.app-menu-name { margin: 0; padding: 8px 12px 6px; font-size: 0.85rem; color: var(--ink-soft); }
.app-menu-panel .app-menu-logout { color: var(--danger); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; }
.app-tabbar {
  bottom: 0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
}
.app-tabbar a {
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}
.app-tabbar a:hover { text-decoration: none; }
.app-tabbar a.active { color: var(--brand-dark); }
body.app-typing .app-tabbar { display: none; }
