:root {
  --ink: #152329;
  --muted: #65737c;
  --line: #dbe4e1;
  --paper: #f6f3ec;
  --panel: rgba(255, 255, 255, 0.88);
  --teal: #0b7774;
  --teal-soft: #dff2ee;
  --coral: #cf5948;
  --blue: #3f67a8;
  --gold: #bc861e;
  --green: #2d7a4b;
  --violet: #6c5aa7;
  --shadow: 0 28px 90px rgba(21, 35, 41, 0.17);
  --surface: #ffffff;      /* card/badge surfaces (was referenced but never defined) */
  --accent: var(--teal);   /* focus-ring / accent border colour */
  --teal-fill: #0b7774;    /* teal used as a FILLED button bg with white text (AA contrast) */
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
body.dark {
  --ink: #e8edf0;
  --muted: #8fa3ac;
  --line: #2a3338;
  --paper: #111618;
  --panel: rgba(22, 28, 32, 0.95);
  --teal: #0fa9a5;
  --teal-soft: #0d2e2d;
  --surface: #1c2529;
  --teal-fill: #0b7774;   /* darker teal for filled buttons so white text passes AA on dark */
  --shadow: 0 28px 90px rgba(0,0,0,0.5);
  color-scheme: dark;
}
body.dark {
  background:
    radial-gradient(circle at 12% 12%, rgba(11, 119, 116, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 16%, rgba(207, 89, 72, 0.1), transparent 24rem),
    linear-gradient(135deg, #0d1618, #111a1e 46%, #0e1a18);
}
body.dark .app {
  background: rgba(16, 22, 26, 0.92);
  border-color: rgba(255,255,255,0.07);
  backdrop-filter: none;
}
body.dark .topbar { border-bottom-color: var(--line); }
body.dark .brand-wordmark { color: var(--ink); }
body.dark .chip {
  background: #1c2529;
  border-color: #2e3d44;
  color: var(--ink);
}
body.dark .chip.active { background: var(--teal-fill); color: #fff; border-color: var(--teal); }
body.dark .context-pill { background: #1c2529; border-color: #2e3d44; color: var(--ink); }
body.dark .context-pill.active { border-color: var(--teal); }
body.dark .card {
  background: #161e22;
  border-color: #252f35;
}
body.dark .card:hover { background: #1c2730; }
body.dark .search-box input { color: var(--ink); background: transparent; }
body.dark .search-box input::placeholder { color: var(--muted); }
body.dark .filter-btn { background: #1c2529; border-color: #2e3d44; color: var(--muted); }
body.dark .filter-btn.active { background: var(--teal-fill); color: #fff; border-color: var(--teal); }
body.dark .quick-actions button { background: #1c2529; border-color: #2e3d44; color: var(--ink); }
body.dark .quick-actions button:hover { background: #242f36; }
body.dark .insights { background: #1c2529; border-color: #2e3d44; }
body.dark .drawer { background: #141c20; color: var(--ink); border-color: #2e3d44; }
body.dark .drawer-title { color: var(--ink); }
body.dark .badge { background: #1c2529; border-color: #2e3d44; color: var(--muted); }
body.dark .backend-badge { background: #1c2529; color: var(--muted); border-color: #2e3d44; }
body.dark .topbar-btn { background: #1c2529 !important; border-color: #2e3d44 !important; color: var(--ink) !important; }
body.dark .kid-toggle-btn.kid-mode-active { background: #2e2400 !important; }
body.dark .area-bar { background: #1c2529; border-color: #2e3d44; }
body.dark .top-pick { background: #1c2529; border-color: #2e3d44; }
body.dark .top-pick-inner:hover { background: rgba(11,119,116,0.12); }
body.dark .mood-chip { background: #1c2529; border-color: #2e3d44; color: var(--ink); }
body.dark .mood-chip.active { background: #0d2e2d; border-color: var(--teal); color: var(--teal); }
body.dark .dark-toggle-btn { font-size: 1rem !important; }
body.dark #liveTrackBtn.active { background: #0d2e2d !important; border-color: var(--teal) !important; color: var(--teal) !important; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(11, 119, 116, 0.14), transparent 28rem),
    radial-gradient(circle at 88% 16%, rgba(207, 89, 72, 0.11), transparent 24rem),
    linear-gradient(135deg, #eaf1ee, #faf6ee 46%, #e6f0ef);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 450px) minmax(300px, 430px);
  gap: 34px;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.app {
  width: min(100%, 450px);
  height: min(920px, calc(100vh - 42px));
  min-height: 720px;
  overflow: clip auto;
  border: 1px solid rgba(21, 35, 41, 0.16);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.77);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  padding: 16px;
  scrollbar-width: none;
}

.app::-webkit-scrollbar {
  display: none;
}

.topbar,
.context-row,
.search-panel,
.insights,
.place-card,
.drawer {
  border: 1px solid var(--line);
  background: var(--panel);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 24px;
  padding: 16px;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-wordmark {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.brand-wordmark span {
  color: var(--teal);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 6vw, 2.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.icon-btn {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 17px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.25rem;
}

.context-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  border-radius: 20px;
  padding: 8px;
}

.context-pill,
.filter-btn,
.quick-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  font-size: 0.84rem;
}

.context-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.context-pill strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-pill.active,
.filter-btn.active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.search-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  border-radius: 20px;
  padding: 10px;
}

.search-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  transition: border-color 0.15s;
}
.search-box:focus-within {
  border-color: var(--teal);
  color: var(--teal);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  padding: 0 13px;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 850;
}

.chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.chip-reset {
  border-color: var(--coral, #e05c4b);
  color: var(--coral, #e05c4b);
  background: transparent;
  cursor: pointer;
}
.chip-reset:hover { background: var(--coral, #e05c4b); color: white; }
body.dark .chip-reset { border-color: #e07060; color: #e07060; background: transparent; }
body.dark .chip-reset:hover { background: #e07060; color: white; }

/* ── Area summary bar ─────────────────────────────────────────────────────── */
.area-bar {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  padding: 10px 14px;
}

.area-summary-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.area-summary-btn span:first-child { flex-shrink: 0; }

.area-bar-chevron {
  margin-left: auto;
  font-size: 1.1rem;
  color: var(--muted);
  opacity: 0.5;
}

/* ── Top pick spotlight card ──────────────────────────────────────────────── */
.top-pick {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
}

.top-pick-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 140ms;
}

.top-pick-inner:hover,
.top-pick-inner:active { background: var(--teal-soft); }

.top-pick-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.top-pick-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--teal-soft);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.top-pick-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
}

.top-pick-lbl {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--teal);
  margin-bottom: 2px;
}

.top-pick-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.top-pick-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.top-pick-arrow {
  margin-left: auto;
  font-size: 1.3rem;
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.5;
}

.insights {
  margin-top: 12px;
  border-radius: 20px;
  padding: 13px 14px;
}

.insights div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.insights p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.38;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(45, 122, 75, 0.35);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(45, 122, 75, 0);
  }
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.feed-header h2 {
  font-size: 1.12rem;
}

.feed-header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.feed {
  display: grid;
  gap: 10px;
  padding: 10px 0 4px;
}

.place-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 22px;
  padding: 12px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-score {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  background: #eef3f1;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Onboarding overlay ──────────────────────────────────────────────────── */
@keyframes onboarding-slide-up {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes onboarding-slide-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-24px) scale(0.96); }
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(21, 35, 41, 0.52);
  backdrop-filter: blur(6px);
  padding: 24px;
  opacity: 0;
}

.onboarding-overlay.onboarding-in {
  animation: onboarding-slide-up 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.onboarding-overlay.onboarding-out {
  animation: onboarding-slide-out 0.3s ease-in forwards;
}

.onboarding-card {
  width: min(100%, 400px);
  background: #fff;
  border-radius: 28px;
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  box-shadow: 0 32px 80px rgba(21,35,41,0.28);
}

body.dark .onboarding-card {
  background: #141c20;
  color: var(--ink);
}

.onboarding-emoji {
  font-size: 3rem;
  line-height: 1;
}

.onboarding-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}

.onboarding-body {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  max-width: 300px;
}

.onboarding-dots {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.onboarding-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s, transform 0.2s;
}

.onboarding-dot.active {
  background: var(--teal);
  transform: scale(1.3);
}

.onboarding-next {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 16px;
  background: var(--teal);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 4px;
}

.onboarding-next:active { transform: scale(0.97); }
.onboarding-next:hover  { background: #0a6866; }

.onboarding-skip {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}

.onboarding-skip:hover { color: var(--ink); }

/* ── Place mood badge ────────────────────────────────────────────────────── */
.mood-badge {
  background: linear-gradient(135deg, #fff8e6, #fdefd8);
  color: #8a5f00;
  border: 1px solid rgba(188, 134, 30, 0.2);
}

body.dark .mood-badge {
  background: #2e2400;
  color: #c9a030;
  border-color: rgba(188, 134, 30, 0.25);
}

/* ── Score ring SVG animation ────────────────────────────────────────────── */
.score-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.score-ring-svg {
  position: absolute;
  top: 0; left: 0;
  width: 44px; height: 44px;
  transform: rotate(-90deg);
}

.score-ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

.score-ring-fill {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 119.4; /* 2π × r=19 */
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.score-ring-fill.ring-high   { stroke: var(--green); }
.score-ring-fill.ring-medium { stroke: var(--teal); }
.score-ring-fill.ring-low    { stroke: var(--muted); }

.score-ring-label {
  position: relative;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

body.dark .score-ring-fill.ring-high   { stroke: #3fa86e; }
body.dark .score-ring-fill.ring-medium { stroke: var(--teal); }
body.dark .score-ring-wrap            { /* inherits */ }

.place-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(21, 35, 41, 0.12);
}

.place-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: white;
  font-weight: 950;
}

.place-card h3 {
  font-size: 1rem;
  line-height: 1.15;
}

.place-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef3f1;
  color: #435159;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}
.badge-address {
  max-width: min(100%, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

.badge.open {
  background: #e1f2e7;
  color: var(--green);
}

.badge.soon {
  background: #fff0d8;
  color: #8e5f06;
}

.badge.closed {
  background: #f2e5e2;
  color: #994435;
}

.badge.unknown {
  background: #f0f0f0;
  color: #777;
}

.feed-loading {
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  padding: 28px 0;
  animation: fadePulse 1.2s ease-in-out infinite;
}

.location-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  gap: 12px;
}

.location-prompt-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.location-prompt-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.location-prompt-body {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 300px;
  line-height: 1.5;
  margin: 0;
}

.location-prompt-btn {
  margin-top: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.score {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 0.86rem;
  font-weight: 950;
}

.score-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.01em;
}


.drawer {
  width: min(92vw, 430px);
  border-radius: 28px;
  padding: 24px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.drawer::backdrop {
  background: rgba(21, 35, 41, 0.42);
  backdrop-filter: blur(5px);
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--ink);
  font-size: 1.35rem;
}

.drawer-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 21px;
  color: white;
  font-weight: 950;
}

.drawer-title {
  margin-top: 16px;
  padding-right: 34px;
  font-size: 1.55rem;
  line-height: 1.08;
}

.drawer-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.drawer-actions button,
.primary-wide {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  font-weight: 900;
}

.primary-action,
.primary-wide {
  background: var(--teal);
  color: white;
}

.secondary-action {
  background: #edf2f0;
  color: var(--ink);
}

.pref-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}

.pref-item strong,
.pref-item span {
  display: block;
}

.pref-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pref-item input {
  width: 74px;
  accent-color: var(--teal);
}

.primary-wide {
  width: 100%;
  margin-top: 14px;
}

.secondary-wide {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.feed-mode-notice {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 0 0 10px;
  line-height: 1.4;
}
.accessible-yes  { background: #e6f4ea !important; color: #276749 !important; }
.accessible-no   { background: #fff5f5 !important; color: #c53030 !important; }
.accessible-unknown { background: var(--surface) !important; color: var(--muted) !important; }
.feed-show-more {
  margin: 12px 0 4px;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.sparse-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 4px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.83rem;
  color: var(--muted);
}
.sparse-hint-btn {
  flex-shrink: 0;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Auth form */
.auth-form {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

/* Global keyboard-focus indicator. Mouse clicks don't trigger :focus-visible,
   so this only shows for keyboard/AT users and doesn't affect pointer UX. */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-consent {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 2px 0 8px;
}

.auth-consent a {
  color: var(--teal);
  font-weight: 700;
}

.auth-field span {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--muted);
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}

.auth-field input:focus {
  outline: 2px solid var(--teal);
  border-color: var(--teal);
}

.auth-error {
  color: #994435;
  font-size: 0.88rem;
  min-height: 1em;
}

/* Backend status badge */
.datetime {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.backend-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.backend-badge.live {
  background: #e1f2e7;
  color: #2d7a4b;
}

.backend-badge.demo {
  background: #f2e5e2;
  color: #994435;
}

.backend-badge.osm {
  background: #e8f0fe;
  color: #2255cc;
}

@media (max-width: 880px) {
  .shell {
    display: block;
    padding: 0;
  }

  .app {
    width: 100%;
    height: 100vh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .strategy {
    display: none;
  }
}

/* Mid-range phones (391–600px) — the gap between 390px and 880px breakpoints */
@media (max-width: 600px) {
  .context-row {
    grid-template-columns: 1fr 1fr;
  }

  /* 4-column admin stats → 2×2 grid */
  .admin-stats,
  .journey-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* Admin security event rows are too wide for phones — stack icon+label / email / actions */
  .admin-security-row {
    grid-template-columns: 20px 1fr auto;
    flex-wrap: wrap;
  }
  .sec-email, .sec-ip { display: none; }

  /* Prevent admin user email from overflowing */
  .admin-user-email { max-width: 120px; }
}

@media (max-width: 390px) {
  .app {
    padding: 12px;
  }

  .context-row {
    grid-template-columns: 1fr;
  }

  .place-card {
    grid-template-columns: 50px 1fr;
  }
}

/* Insight action buttons */
.insight-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.insight-action-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.insight-action-btn:hover { background: var(--teal); color: white; }
.insight-action-saved { background: #fff8e1 !important; border-color: #f9a825 !important; color: #7a5500 !important; }
.insight-action-saved:hover { background: #f9a825 !important; color: white !important; }

body.dark .insight-action-btn { background: #0d2e2d; border-color: var(--teal); color: var(--teal); }
body.dark .insight-action-btn:hover { background: var(--teal); color: white; }

/* Feed header right (toggle + count) */
.feed-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 3-way view switch: Map | List | Swipe */
.view-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.view-switch-btn {
  padding: 5px 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.view-switch-btn.active {
  background: var(--teal);
  color: white;
}

.view-switch-btn:not(.active):hover {
  background: var(--teal-soft);
  color: var(--teal);
}

body.dark .view-switch { background: #1c2529; border-color: #2e3d44; }
body.dark .view-switch-btn { color: var(--muted); }
body.dark .view-switch-btn.active { background: var(--teal); color: white; }
body.dark .view-switch-btn:not(.active):hover { background: #0d2e2d; color: var(--teal); }

/* User feedback buttons row */
.feedback-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.feedback-btn {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.feedback-btn:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

.feedback-btn.feedback-danger:hover {
  background: #fdecea;
  border-color: var(--coral);
  color: var(--coral);
}

.place-card.card-open {
  box-shadow: inset 3px 0 0 var(--green), 0 2px 12px rgba(21, 35, 41, 0.07);
  background: linear-gradient(to right, rgba(45, 122, 75, 0.05) 0%, transparent 35%);
}
body.dark .place-card.card-open {
  background: linear-gradient(to right, rgba(45, 122, 75, 0.18) 0%, var(--panel) 45%);
}

.place-card.card-closed {
  opacity: 0.45;
}

.place-card.card-closed:hover {
  opacity: 0.65;
  transform: none;
  box-shadow: 0 2px 12px rgba(21, 35, 41, 0.07);
}

/* SOS / Emergency button in topbar */
.sos-btn {
  background: #fff1f0 !important;
  border-color: #f5c4bf !important;
  color: #993322 !important;
}

.sos-btn:hover {
  background: #fde8e6 !important;
  border-color: var(--coral) !important;
  color: var(--coral) !important;
}

/* Emergency drawer */
.emergency-drawer {
  max-width: 400px;
}

.sos-country {
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.sos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.sos-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--sos-color, #666) 10%, white);
  border: 1.5px solid color-mix(in srgb, var(--sos-color, #666) 30%, white);
  text-decoration: none;
  color: var(--sos-color, #333);
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
}

.sos-card:hover {
  background: color-mix(in srgb, var(--sos-color, #666) 18%, white);
  transform: scale(1.03);
}

.sos-card:active {
  transform: scale(0.97);
}

.sos-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.sos-card strong {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.sos-number {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--sos-color, #333);
}

.sos-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 14px;
  padding: 8px 12px;
  background: var(--paper);
  border-radius: 10px;
}

.sos-actions {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.sos-actions .secondary-wide {
  margin-top: 0;
}

/* ── Personal contacts in SOS drawer ────────────────────────────────────── */
.my-contacts-section {
  margin-bottom: 4px;
}
.my-contacts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.my-contacts-title {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.add-contact-btn {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.add-contact-btn:hover { opacity: 0.85; }
.contact-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f7fcfb;
  border: 1px solid #d4eeeb;
  border-radius: 10px;
  margin-bottom: 6px;
  overflow: hidden;
}
.contact-call {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}
.contact-call:hover { background: #e8f7f5; }
.contact-icon { font-size: 1.3rem; }
.contact-info { flex: 1; }
.contact-info strong { display: block; font-size: 0.92rem; }
.contact-info span { font-size: 0.8rem; color: var(--muted); }
.contact-call-icon { font-size: 1.1rem; opacity: 0.6; }
.contact-delete {
  background: none;
  border: none;
  color: #cc4444;
  font-size: 1.3rem;
  padding: 0 12px;
  cursor: pointer;
  opacity: 0.6;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.contact-delete:hover { opacity: 1; background: #fff0f0; }
.no-contacts-msg {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  padding: 8px 0 4px;
}
.add-contact-form {
  flex-direction: column;
  gap: 8px;
  background: #f7fcfb;
  border: 1px solid #d4eeeb;
  border-radius: 10px;
  padding: 12px;
  margin-top: 4px;
}
.add-contact-form input {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
.add-contact-form input:focus { border-color: var(--teal); }
.add-contact-actions {
  display: flex;
  gap: 8px;
}
.primary-btn-sm {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}
.primary-btn-sm:hover { opacity: 0.85; }
.secondary-btn-sm {
  background: white;
  color: var(--muted);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.secondary-btn-sm:hover { border-color: #999; }
.sos-divider {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 14px 0;
}

/* ── Photo thumbnails on cards ──────────────────────────────────────────── */
.card-photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--line);
}
.card-body { flex: 1; min-width: 0; }
.drawer-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
  background: var(--line);
}

/* ── Vibe tags ──────────────────────────────────────────────────────────── */
.saved-badge { background: #fff8e1 !important; color: #bc861e !important; border-color: #ffe082 !important; }

/* ── Weekly opening hours in drawer ─────────────────────────────────────── */
.hours-section {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.hours-toggle {
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  background: var(--card);
}
.hours-toggle::-webkit-details-marker { display: none; }
.hours-toggle::before { content: "🕐  "; }
.hours-list {
  margin: 0;
  padding: 4px 0 8px;
  list-style: none;
  background: var(--card);
}
.hours-list li {
  padding: 3px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.hours-list li.hours-today {
  font-weight: 700;
  color: var(--text);
  background: var(--bg-subtle, #f3fafa);
}

/* Dark mode overrides for new elements */
body.dark .card-photo { background: #252f35; }
body.dark .drawer-photo { background: #252f35; }

/* ── Swipe cards mode ───────────────────────────────────────────────────── */
.swipe-container {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.swipe-stack {
  position: relative;
  width: 100%;
  height: 400px;
  margin-bottom: 20px;
}
.swipe-card {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  will-change: transform;
}
.swipe-card:active { cursor: grabbing; }
.swipe-overlay {
  position: absolute;
  top: 24px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.06s;
  z-index: 10;
}
.like-overlay {
  left: 20px;
  background: rgba(45, 122, 75, 0.9);
  color: white;
  border: 3px solid #2d7a4b;
  transform: rotate(-12deg);
}
.nope-overlay {
  right: 20px;
  background: rgba(207, 89, 72, 0.9);
  color: white;
  border: 3px solid #cf5948;
  transform: rotate(12deg);
}
.swipe-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 18px 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  color: white;
}
.swipe-meta-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.swipe-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
}
.swipe-badge.open   { background: rgba(45,122,75,0.85); }
.swipe-badge.closed { background: rgba(207,89,72,0.85); }
.swipe-place-name {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.swipe-place-sub {
  font-size: 0.85rem;
  margin: 0 0 8px;
  opacity: 0.85;
}
.swipe-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 10px;
}
.swipe-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: white;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.12s, box-shadow 0.12s;
}
.swipe-btn:hover { transform: scale(1.12); box-shadow: 0 6px 18px rgba(0,0,0,0.15); }
.swipe-btn:active { transform: scale(0.96); }
.swipe-nope { color: #cf5948; border-color: #f4c0b8; font-size: 1.1rem; }
.swipe-nope:hover { background: #fff5f3; border-color: #cf5948; }
.swipe-info { color: var(--blue); border-color: #c7d4f5; font-size: 1rem; width: 44px; height: 44px; }
.swipe-info:hover { background: #f0f4ff; }
.swipe-like { color: #2d7a4b; border-color: #b2ddc4; font-size: 1.3rem; }
.swipe-like:hover { background: #f0faf4; border-color: #2d7a4b; }
.swipe-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 4px;
  text-align: center;
}
.swipe-counter {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  text-align: center;
}
.swipe-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--teal-soft);
  border-radius: 22px;
  color: var(--teal);
  text-align: center;
  padding: 24px;
}
.swipe-empty-icon { font-size: 3rem; }
.swipe-empty p { font-size: 1rem; font-weight: 600; margin: 0; }

/* Swipe toggle active state */
#swipeToggle.active { background: var(--teal) !important; color: white !important; border-color: var(--teal) !important; }

/* Dark mode */
body.dark .swipe-btn { background: #1c2529; border-color: #2e3d44; }
body.dark .swipe-nope:hover { background: #2a1a18; }
body.dark .swipe-info:hover { background: #1a2030; }
body.dark .swipe-like:hover { background: #162219; }
body.dark .swipe-empty { background: #0d2e2d; }

/* ── Mood discovery chips ───────────────────────────────────────────────── */
.mood-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
}
.mood-row:empty { display: none; }
.mood-row::-webkit-scrollbar { display: none; }
.mood-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mood-chip:hover { border-color: var(--teal); background: var(--teal-soft); }
.mood-chip.active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); font-weight: 700; }
.mood-emoji { font-size: 1.2rem; line-height: 1; }
.mood-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; }

/* ── Share button ───────────────────────────────────────────────────────── */
.share-btn { min-width: auto !important; }

/* ── Dark toggle button ─────────────────────────────────────────────────── */
.dark-toggle-btn { font-size: 1rem !important; min-width: 36px; justify-content: center; }


/* ── Trending banner ────────────────────────────────────────────────────── */
.trending-strip {
  padding: 0 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trending-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--coral);
}
.trending-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.trending-scroll::-webkit-scrollbar { display: none; }
.trending-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  background: white;
  border: 1.5px solid #ffe0d6;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
  font-family: inherit;
  transition: all 0.13s;
  min-width: 120px;
}
.trending-item:hover { border-color: var(--coral); background: #fff5f3; }
.trending-name { font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.trending-meta { font-size: 0.72rem; color: var(--muted); }

/* ── Personal stats / My Journey ────────────────────────────────────────── */
.journey-heading {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 10px;
}
.journey-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.journey-stat {
  background: var(--teal-soft);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.journey-stat strong { display: block; font-size: 1.1rem; font-weight: 900; color: var(--teal); }
.journey-stat span   { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.journey-fav {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
.journey-fav strong { color: var(--ink); }
.journey-empty {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 16px 0 0;
  text-align: center;
  line-height: 1.5;
}

/* Dark mode */
body.dark .trending-item { background: #1c2529; border-color: #3a2520; }
body.dark .trending-item:hover { background: #2a1a18; border-color: var(--coral); }

/* ── Preferences redesign ───────────────────────────────────────────────── */
.pref-section {
  margin-bottom: 22px;
}
.pref-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 10px;
}
.pref-section-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 0 0;
}
.pref-hint {
  font-size: 0.73rem;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
}

/* Priority cards */
.priority-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.priority-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: white;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.priority-card:hover { border-color: var(--teal); background: var(--teal-soft); }
.priority-card.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 2px var(--teal);
}
.priority-emoji { font-size: 1.4rem; line-height: 1; }
.priority-card strong { font-size: 0.85rem; color: var(--ink); }
.priority-desc { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }

/* Radius options */
.radius-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.radius-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
  font-family: inherit;
}
.radius-btn:hover { border-color: var(--teal); background: var(--teal-soft); }
.radius-btn.active { background: var(--teal); color: white; border-color: var(--teal); }

/* Lifestyle chips */
.lifestyle-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lifestyle-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: white;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.13s;
  font-family: inherit;
}
.lifestyle-chip:hover { border-color: var(--teal); background: var(--teal-soft); }
.lifestyle-chip.active {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 700;
}
.lifestyle-chip.active::after {
  content: "✓";
  margin-left: auto;
  font-weight: 900;
}

/* Mode preset row */
.mode-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mode-preset-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
  font-family: inherit;
}
.mode-preset-btn:hover { border-color: var(--teal); background: var(--teal-soft); }
.mode-preset-btn.active { background: var(--teal); color: white; border-color: var(--teal); }

/* Dark mode overrides */
body.dark .priority-card  { background: #1c2529; border-color: #2e3d44; }
body.dark .priority-card:hover,
body.dark .priority-card.active { background: #0d2e2d; border-color: var(--teal); }
body.dark .radius-btn,
body.dark .mode-preset-btn { background: #1c2529; border-color: #2e3d44; color: var(--ink); }
body.dark .radius-btn.active,
body.dark .mode-preset-btn.active { background: var(--teal); color: white; }
body.dark .lifestyle-chip { background: #1c2529; border-color: #2e3d44; color: var(--ink); }
body.dark .lifestyle-chip.active { background: #0d2e2d; border-color: var(--teal); color: var(--teal); }

/* ── Location picker dialog ─────────────────────────────────────────────── */
.location-picker-dialog {
  border: none;
  border-radius: 18px;
  padding: 28px 24px 24px;
  max-width: 420px;
  width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
.location-picker-dialog::backdrop {
  background: rgba(0,0,0,0.35);
}
.loc-option-btn {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--teal);
  border-radius: 12px;
  background: #f0faf9;
  color: var(--teal);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.loc-option-btn:hover { background: #d9f3f0; }
.loc-or-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 14px 0;
  position: relative;
}
.loc-or-divider::before,
.loc-or-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #ddd;
}
.loc-or-divider::before { left: 0; }
.loc-or-divider::after  { right: 0; }

/* Location preview mini-map (OSM tiles + centred pin) */
.locmap {
  position: relative;
  width: 100%;
  height: 150px;
  margin: 4px 0 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #e6ebee;
  border: 1px solid rgba(0,0,0,0.08);
}
.locmap-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.locmap-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -100%);
  font-size: 30px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
  z-index: 2;
}
.locmap-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.locmap-attr {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 0.62rem;
  color: #333;
  background: rgba(255,255,255,0.7);
  padding: 1px 5px;
  border-radius: 5px;
  pointer-events: none;
  z-index: 2;
}
.loc-confirm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.loc-confirm-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-confirm-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.loc-confirm-btn:hover { filter: brightness(1.08); }
.address-search-form { display: flex; flex-direction: column; gap: 8px; }
.address-input-row {
  display: flex;
  align-items: center;
  position: relative;
}
.address-input-row input {
  flex: 1;
  border: 1.5px solid #ccc;
  border-radius: 10px;
  padding: 11px 40px 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}
.address-input-row input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11,119,116,0.12); }
.addr-search-spinner {
  position: absolute;
  right: 12px;
  font-size: 0.9rem;
  animation: spin 1s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.address-search-error {
  font-size: 0.8rem;
  color: #c0392b;
  min-height: 1rem;
}
.address-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 2px;
}
.address-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f7f7f7;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  transition: background 0.12s;
  width: 100%;
}
.address-result-item:hover { background: #e8f7f5; border-color: var(--teal); }
.addr-icon { flex-shrink: 0; font-size: 1rem; margin-top: 2px; }
.addr-text { display: flex; flex-direction: column; gap: 1px; }
.addr-main { font-size: 0.88rem; font-weight: 600; color: #1a1a1a; }
.addr-sub  { font-size: 0.78rem; color: var(--muted); }
.addr-no-results { font-size: 0.82rem; color: var(--muted); text-align: center; padding: 8px 0; }

/* ── Admin panel ─────────────────────────────────────────────────────────── */
.admin-btn { background: #f0f4ff !important; border-color: #c7d4f5 !important; color: #2a3f8f !important; }
.admin-btn:hover { background: #dce6ff !important; border-color: #3f67a8 !important; }
.admin-drawer { max-width: 440px; }
.admin-loading { color: var(--muted); font-size: 0.9rem; }
.admin-error { color: var(--coral); font-size: 0.9rem; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.admin-stat { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.admin-stat strong { font-size: 1.4rem; font-weight: 900; color: var(--teal); }
.admin-stat span { font-size: 0.72rem; color: var(--muted); font-weight: 700; margin-top: 2px; }
.admin-section-title { font-size: 0.8rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 10px; }
.admin-user-list { display: grid; gap: 8px; }
.admin-user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.admin-user-inactive { opacity: 0.55; }
.admin-user-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.admin-user-email { font-size: 0.82rem; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.admin-role-badge { font-size: 0.68rem; font-weight: 900; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.3px; }
.admin-role-admin { background: #e8f0fe; color: #1a5db5; }
.admin-role-user { background: var(--teal-soft); color: var(--teal); }
.admin-role-inactive { background: #fdecea; color: var(--coral); }
.admin-user-actions { display: flex; gap: 5px; flex-shrink: 0; }
.admin-action-btn { padding: 4px 10px; border-radius: 8px; font-size: 0.76rem; font-weight: 900; border: 1px solid var(--line); background: white; color: var(--muted); cursor: pointer; }
.admin-action-btn:hover { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.admin-delete-btn:hover { background: #fdecea; border-color: var(--coral); color: var(--coral); }
.admin-muted { font-size: 0.75rem; color: var(--muted); font-style: italic; }

/* ── Admin security events ─────────────────────────────────────────────────── */
.admin-security-list { display: grid; gap: 6px; margin-bottom: 20px; }
.admin-security-row { display: grid; grid-template-columns: 20px 1fr 1.4fr 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: 0.78rem; }
.sec-icon { font-size: 1rem; line-height: 1; }
.sec-label { font-weight: 700; color: var(--ink); }
.sec-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-ip { color: var(--muted); font-family: monospace; font-size: 0.72rem; }
.sec-time { color: var(--muted); white-space: nowrap; text-align: right; font-size: 0.72rem; }
.sec-event-fail  { border-left: 3px solid #ef4444; }
.sec-event-ok    { border-left: 3px solid #22c55e; }
.sec-event-admin { border-left: 3px solid var(--teal); }
.sec-event-warn  { border-left: 3px solid #f59e0b; }

/* ── Crash error banner ────────────────────────────────────────────────────── */
.crash-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff3f3;
  border: 1px solid #f5c6c6;
  border-radius: 12px;
  color: #b91c1c;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 8px 0 0;
}
.crash-reload {
  padding: 4px 12px;
  border: 1px solid #b91c1c;
  border-radius: 999px;
  background: white;
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── Labelled topbar buttons (Kids, SOS, Sign in) ────────────────────────── */
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-btn:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

/* ── Kid Mode toggle button ──────────────────────────────────────────────── */
.kid-toggle-btn {
  background: #fff8e1 !important;
  border-color: #ffe082 !important;
  color: #7a5500 !important;
}

.kid-toggle-btn:hover {
  background: #fff3cd !important;
  border-color: #f9a825 !important;
}

.kid-mode .kid-toggle-btn {
  background: #f9a825 !important;
  border-color: #e65100 !important;
  color: #fff !important;
}

/* ── Kid Mode app shell overrides ────────────────────────────────────────── */
.kid-mode {
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 200, 0, 0.18), transparent 22rem),
    radial-gradient(circle at 88% 20%, rgba(255, 100, 130, 0.14), transparent 20rem),
    radial-gradient(circle at 50% 90%, rgba(0, 180, 120, 0.12), transparent 18rem),
    linear-gradient(135deg, #fefce8, #fdf2f8 46%, #ecfdf5) !important;
  border-radius: 28px !important;
}

/* Bigger wordmark in kid mode */
.kid-mode .brand-wordmark {
  font-size: 1.7rem;
}

/* Hide complex controls kids don't need */
.kid-mode .mode-row,
.kid-mode .filter-btn {
  display: none;
}

/* Swipe mode — hide dead controls (none currently active) */
.swipe-mode .quick-actions,
.swipe-mode .mode-row,
.swipe-mode .filter-btn {
  display: none;
}
.feed-header h2::after {
  content: attr(data-swipe-hint);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

/* Keep location pill visible but simplify — hide walking/route pills */
.kid-mode .context-row .context-pill:not(:first-child) {
  display: none;
}

/* Make the location pill bigger and friendlier in kid mode */
.kid-mode #locationButton {
  font-size: 1rem;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.kid-mode #locationButton:hover {
  background: #0a6360;
}

/* Bigger search box */
.kid-mode .search-panel {
  gap: 0;
}

.kid-mode .search-box input {
  font-size: 1.1rem;
  min-height: 52px;
  border-radius: 18px;
}

/* Kid category chips — big, colorful, spaced out */
.kid-chip {
  font-size: 1rem !important;
  padding: 10px 18px !important;
  min-height: 46px !important;
  border-radius: 999px !important;
  font-weight: 900 !important;
  gap: 6px !important;
}

.kid-chip:nth-child(1) { --chip-color: #6c5aa7; }
.kid-chip:nth-child(2) { --chip-color: #e07b20; }
.kid-chip:nth-child(3) { --chip-color: #2d7a4b; }
.kid-chip:nth-child(4) { --chip-color: #cf5948; }
.kid-chip:nth-child(5) { --chip-color: #3f67a8; }
.kid-chip:nth-child(6) { --chip-color: #9c27b0; }
.kid-chip:nth-child(7) { --chip-color: #1a8a6e; }

.kid-chip {
  background: color-mix(in srgb, var(--chip-color, var(--teal)) 12%, white) !important;
  border-color: color-mix(in srgb, var(--chip-color, var(--teal)) 35%, white) !important;
  color: var(--chip-color, var(--teal)) !important;
}

.kid-chip.active {
  background: var(--chip-color, var(--teal)) !important;
  border-color: var(--chip-color, var(--teal)) !important;
  color: white !important;
}

/* Kid quick-action buttons */
.kid-mode .quick-actions button {
  font-size: 1rem;
  padding: 10px 16px;
  min-height: 46px;
  border-radius: 14px;
  font-weight: 900;
  background: white;
  border: 2px solid var(--line);
}

.kid-mode .quick-actions button:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

/* Kid place cards */
.kid-card {
  padding: 16px !important;
  border-radius: 22px !important;
  gap: 14px !important;
  min-height: 80px !important;
  align-items: center !important;
}

.kid-place-icon {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  font-size: 1.3rem !important;
  border-radius: 18px !important;
}

.kid-place-name {
  font-size: 1.15rem !important;
  font-weight: 900 !important;
  line-height: 1.3 !important;
  color: #152329 !important;
}

.kid-dist {
  font-size: 0.9rem !important;
  color: var(--teal) !important;
  font-weight: 700 !important;
  margin: 3px 0 !important;
}

/* Sidebar in kid mode */
.kid-mode ~ .strategy .metrics {
  display: none;
}

/* Feed header in kid mode */
.kid-mode .feed-header h2 {
  font-size: 1.2rem;
  color: #152329;
}

/* ── Kids mode + dark mode: undo light-mode overrides ───────────────────── */
/* Kids mode forces a light app background even in dark mode. These rules    */
/* restore proper dark coloring for elements that rely on transparency or    */
/* hardcoded light colours that only make sense on a light background.       */
body.dark .kid-mode .place-card.card-open {
  background: linear-gradient(to right, rgba(45, 122, 75, 0.18) 0%, var(--panel) 45%);
}
body.dark .kid-place-name {
  color: var(--ink) !important;
}
body.dark .kid-mode .feed-header h2 {
  color: var(--ink);
}

/* ── Live tracking button ────────────────────────────────────────────────── */
#liveTrackBtn.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(11, 119, 116, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(11, 119, 116, 0); }
}
#liveTrackBtn.active {
  animation: live-pulse 2s infinite;
}

/* ── Crowd / busy indicator badges ──────────────────────────────────────── */
.busy-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 600;
  border: none !important;
}
.busy-peak     { color: #e07b20 !important; background: rgba(224,123,32,0.13) !important; }
.busy-moderate { color: #bc861e !important; background: rgba(188,134,30,0.13) !important; }
.busy-quiet    { color: #2d7a4b !important; background: rgba(45,122,75,0.13)  !important; }

.swipe-busy { font-size: 0.7rem; }

/* ── App footer ─────────────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.app-footer a { color: var(--muted); text-decoration: underline; }
.app-footer a:hover { color: var(--teal); }

/* ── Forgot / reset password ────────────────────────────────────────────── */
.auth-link {
  display: block;
  background: none;
  border: none;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0 2px;
  text-align: center;
  width: 100%;
}
.auth-link:hover { text-decoration: underline; }

.forgot-sent-msg {
  background: var(--teal-soft);
  border-radius: 14px;
  padding: 16px;
  margin-top: 8px;
  color: var(--teal);
  font-size: 0.88rem;
  line-height: 1.55;
}
.forgot-sent-msg p { margin: 0; }

body.dark .forgot-sent-msg { background: rgba(11,119,116,0.15); }

/* ── Account profile drawer ─────────────────────────────────────────────── */
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--teal);
  color: white;
  font-size: 1.8rem;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.profile-fullname {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.profile-edit-name-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.profile-edit-name-btn:hover { opacity: 1; }
.profile-name-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.profile-name-edit-form.hidden { display: none; }
.profile-name-row.hidden { display: none; }
.profile-name-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  box-sizing: border-box;
}
.profile-name-input:focus { outline: none; border-color: var(--accent); }
.profile-name-edit-actions {
  display: flex;
  gap: 8px;
}
.btn-primary-text { color: var(--accent); font-weight: 700; }
.profile-email {
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 2px;
  word-break: break-all;
  color: var(--muted);
}
.profile-role-badge {
  display: inline-block;
  background: #e8f0fe;
  color: #1a5db5;
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 6px;
}
.profile-since {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}
.profile-stats {
  display: flex;
  justify-content: center;
  background: var(--teal-soft);
  border-radius: 18px;
  padding: 14px 10px;
  margin-top: 18px;
  text-align: center;
}
.profile-stats strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--teal);
}
.profile-stats span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.profile-stat-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: center;
  border-radius: 10px;
  transition: background 0.15s;
}
.profile-stat-btn:hover, .profile-stat-btn:focus-visible {
  background: rgba(11, 119, 116, 0.12);
  outline: none;
}
.profile-stat-btn:active { opacity: 0.7; }
.profile-stat-btn strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--teal);
}
.profile-stat-btn span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline dotted;
}
.saved-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.saved-view-back {
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--teal);
  cursor: pointer;
  padding: 4px 0;
  font-weight: 700;
  flex-shrink: 0;
}
.saved-view-title {
  margin: 0;
  font-size: 1.1rem;
}
.saved-view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-view-card {
  width: 100%;
  text-align: left;
}
.saved-view-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px 0;
  line-height: 1.5;
}
.profile-section {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.profile-section-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--ink);
}
.auth-success {
  color: var(--teal);
  font-size: 0.84rem;
  font-weight: 700;
  min-height: 18px;
}
.profile-danger-btn {
  color: #c53030 !important;
  border-color: #fed7d7 !important;
  margin-top: 8px;
}
.profile-danger-btn:hover {
  background: #fff5f5 !important;
  border-color: #c53030 !important;
}
.profile-guest-hint {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 10px;
}
.profile-guest-expiry {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
}
.profile-guest-expiry.warn {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fbbf24;
}
.profile-loading {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* Dark mode */
body.dark .profile-stats { background: rgba(11, 119, 116, 0.12); }
body.dark .profile-role-badge { background: #1a2a4a; color: #90b4f5; }
body.dark .profile-danger-btn { border-color: #742a2a !important; }
body.dark .profile-danger-btn:hover { background: #1a0a0a !important; border-color: #c53030 !important; }

/* SW update banner */
.sw-update-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink, #152329);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(21, 35, 41, 0.4);
  white-space: nowrap;
}
.sw-update-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: none;
  background: var(--teal, #0b7774);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

/* Confirm dialog (replaces window.prompt/confirm) */
.confirm-dialog {
  border: none;
  border-radius: 20px;
  padding: 28px 28px 24px;
  max-width: 360px;
  width: calc(100% - 48px);
  box-shadow: 0 24px 64px rgba(21, 35, 41, 0.28);
  background: var(--panel, #fff);
}
.confirm-dialog::backdrop {
  background: rgba(21, 35, 41, 0.55);
  backdrop-filter: blur(3px);
}
.confirm-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink, #152329);
}
.confirm-body {
  font-size: 0.88rem;
  color: var(--muted, #65737c);
  margin: 0 0 14px;
  line-height: 1.55;
}
.confirm-input-wrap { margin-bottom: 12px; }
.confirm-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line, #dbe4e1);
  border-radius: 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--paper, #f6f3ec);
  color: var(--ink, #152329);
}
.confirm-input:focus { outline: none; border-color: var(--teal, #0b7774); }
.confirm-error {
  font-size: 0.82rem;
  color: #c0392b;
  min-height: 18px;
  margin: 0 0 12px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-ghost {
  padding: 9px 20px;
  border: 1.5px solid var(--line, #dbe4e1);
  border-radius: 999px;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted, #65737c);
}
.btn-danger {
  padding: 9px 20px;
  border: none;
  border-radius: 999px;
  background: #c0392b;
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: #a93226; }
body.dark .confirm-dialog { background: #1a2a30; }
body.dark .confirm-title { color: #e8f0ee; }
body.dark .confirm-input { background: #0f1d22; border-color: #2a3d45; color: #e8f0ee; }

/* ── No-results / error empty state — red tint ───────────────────────────── */
.insights.state-error,
.insights.state-no-results {
  border-color: rgba(192, 57, 43, 0.25);
  background: rgba(192, 57, 43, 0.05);
}
.insights.state-error strong,
.insights.state-no-results strong {
  color: #c0392b;
}
.insights.state-error .pulse,
.insights.state-no-results .pulse {
  background: #c0392b;
  box-shadow: none;
  animation: none;
}
body.dark .insights.state-error,
body.dark .insights.state-no-results {
  border-color: rgba(224, 112, 96, 0.3);
  background: rgba(224, 112, 96, 0.08);
}
body.dark .insights.state-error strong,
body.dark .insights.state-no-results strong {
  color: #e07060;
}
/* Quantified "N places nearby are closed" hint inside the empty state */
.closed-count-hint {
  margin: 6px 0 2px;
  font-weight: 600;
  color: #b9770e;
}
body.dark .closed-count-hint {
  color: #e0a458;
}

/* ── Topbar compact — shrink on phones so all buttons stay inside the card ─── */
/* Covers iPhone 14 Pro Max (430px), Samsung S24 (412px), and all smaller phones  */
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 6px; }
  .topbar-btn { padding: 5px 8px; font-size: 0.72rem; }
  .sos-btn { padding: 5px 8px; }
  .icon-btn { width: 38px; height: 38px; font-size: 1.1rem; flex: 0 0 38px; }
  .brand-wordmark { font-size: 1.2rem; }
  .datetime { font-size: 0.7rem; }
  /* Hide backend badge and auth label text — icons alone are enough on mobile */
  .backend-badge { display: none !important; }
  #authLabel { display: none; }
}

/* ── Search box dark mode ─────────────────────────────────────────────────── */
body.dark .search-box { background: #1c2529; border-color: #2e3d44; }
body.dark .search-box:focus-within { border-color: var(--teal); }

/* ── Photo carousel in drawer ────────────────────────────────────────────── */
.photo-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--line);
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.carousel-img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
}

.carousel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot.active {
  background: #fff;
  transform: scale(1.3);
}

.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.36);
  color: #fff;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-prev:hover, .carousel-next:hover { background: rgba(0,0,0,0.56); }

/* ── Walking mode ahead-card pulse ───────────────────────────────────────── */
@keyframes ahead-glow {
  0%   { box-shadow: 0 0 0 0 rgba(11, 119, 116, 0.5), 0 12px 28px rgba(21,35,41,0.08); }
  50%  { box-shadow: 0 0 0 6px rgba(11, 119, 116, 0.15), 0 12px 28px rgba(21,35,41,0.08); }
  100% { box-shadow: 0 0 0 0 rgba(11, 119, 116, 0), 0 12px 28px rgba(21,35,41,0.08); }
}

.place-card.card-ahead {
  border-color: var(--teal) !important;
  animation: ahead-glow 1.2s ease-out 0.1s 1 both;
}

.ahead-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(11,119,116,0.2);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

body.dark .place-card.card-ahead { border-color: var(--teal) !important; }

/* ── Ambient "near you" banner ───────────────────────────────────────────── */
.ambient-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--teal-soft);
  border: 1px solid rgba(11, 119, 116, 0.18);
  text-align: center;
}

.ambient-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal);
  opacity: 1;
  transition: opacity 0.35s ease;
}

body.dark .ambient-banner {
  background: #0d2e2d;
  border-color: rgba(15, 169, 165, 0.2);
}

/* ── Heart burst save animation ──────────────────────────────────────────── */
@keyframes heart-burst {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(var(--r)); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r)); opacity: 0; }
}

.heart-particle {
  position: fixed;
  pointer-events: none;
  font-size: 1.1rem;
  z-index: 9998;
  animation: heart-burst 0.65s ease-out forwards;
}

/* ── Skeleton loading cards ──────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  margin-bottom: 8px;
  overflow: hidden;
}

.skel {
  background: linear-gradient(90deg, var(--line) 25%, #e8eeec 50%, var(--line) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
  flex-shrink: 0;
}

body.dark .skel {
  background: linear-gradient(90deg, #1c2529 25%, #252f35 50%, #1c2529 75%);
  background-size: 800px 100%;
}

.skel-icon  { width: 44px; height: 44px; border-radius: 14px; }
.skel-body  { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skel-title { height: 14px; width: 60%; }
.skel-meta  { height: 10px; width: 40%; }

/* ── Pull-to-refresh indicator ───────────────────────────────────────────── */
.ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  transition: height 0.2s ease;
}

.ptr-indicator.ptr-ready {
  height: 44px;
}

.ptr-indicator.ptr-refreshing {
  height: 44px;
}

.ptr-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Toast notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  background: #152329;
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.toast-success { background: var(--green, #2d7a4b); }
.toast.toast-error   { background: var(--coral, #cf5948); }
.toast.toast-info    { background: var(--teal, #0b7774); }

body.dark .toast { box-shadow: 0 4px 20px rgba(0,0,0,0.5); }

/* ── Reduced motion ──────────────────────────────────────────────────────────
   Respect the OS "reduce motion" setting: kill animations/transitions for users
   with vestibular sensitivity (WCAG 2.3.3). Keeps functional visibility. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
