:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.req { color: var(--danger); }

/* ---------- Screens ---------- */
.screen { min-height: 100%; }

/* ---------- Auth + Setup ---------- */
#auth-screen, #setup-screen {
  display: flex; align-items: center; justify-content: center;
  padding: 24px; padding-top: calc(24px + env(safe-area-inset-top));
}
.auth-card, .setup-card {
  background: var(--card); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
}
.setup-card code { background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.brand { text-align: center; margin-bottom: 16px; }
.brand img { border-radius: 14px; }
.brand h1 { margin: 8px 0 2px; font-size: 24px; }
.brand p { margin: 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border: none; border-radius: 10px;
  background: var(--bg); color: var(--muted); font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }

.auth-form, .form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: #334155; }
input, select {
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--text); font-weight: 400;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.btn {
  padding: 12px 16px; border: none; border-radius: 10px; font-size: 16px;
  font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.msg { font-size: 14px; min-height: 18px; margin: 4px 0 0; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent); color: #fff;
  padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top));
  font-size: 18px; font-weight: 700;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

#views { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.view-head h2 { font-size: 18px; margin: 0; }

.list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.05);
}
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* Offer card */
.offer { border-left: 4px solid var(--accent); }
.offer.heim { border-left-color: #f59e0b; }
.offer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.offer-day { font-weight: 700; font-size: 16px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.hin { background: #dbeafe; color: #1d4ed8; }
.badge.heim { background: #fef3c7; color: #b45309; }
.offer-meta { color: var(--muted); font-size: 14px; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.seats-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 600; }
.seats-pill { background: var(--bg); padding: 2px 10px; border-radius: 999px; }
.seats-pill.full { background: #fee2e2; color: var(--danger); }
.claimers { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.offer-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Point card */
.point-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.point-name { font-weight: 700; }
.point-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; border: none; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.nav-btn span { font-size: 22px; }
.nav-btn.active { color: var(--accent); }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(2, 6, 23, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow: auto;
}
.modal-card h3, .map-card h3 { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }

/* ---------- Map modal ---------- */
.map-card {
  background: var(--card); width: 100%; max-width: 600px; height: 100%;
  display: flex; flex-direction: column;
}
.map-head {
  display: flex; gap: 8px; padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top)); background: var(--accent);
}
.map-head input { flex: 1; }
.map { position: relative; flex: 1; }
#map { width: 100%; }
.center-pin {
  position: absolute; top: 50%; left: 50%; z-index: 500;
  transform: translate(-50%, -100%); font-size: 38px; pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.4));
}
.locate-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 600;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #fff; font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: pointer;
}
.map-foot { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); gap: 10px; }
.row { display: flex; gap: 10px; }
.row .grow { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 90%;
}
