/* Local Mass Finder — Catholic-inspired premium UI */

:root {
  --gold: #c9a227;
  --gold-soft: #e8d48b;
  --liturgical-purple: #4a1c6b;
  --purple-deep: #2d1044;
  --burgundy: #6b1e2e;
  --serene-blue: #1e3a5f;
  --green-lit: #2d6a4f;
  --cream: #faf6f1;
  --cream-dark: #f0e9df;
  --ink: #1a1520;
  --muted: #6b6570;
  --card: #ffffff;
  --card-border: rgba(74, 28, 107, 0.1);
  --shadow: 0 8px 30px rgba(45, 16, 68, 0.08);
  --shadow-lg: 0 16px 48px rgba(45, 16, 68, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 56px;
  --banner-h: 0px;
  --nav-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* Filled by JS from visualViewport when available — always matches the open tab */
  --app-height: 100dvh;
  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-display: 'Georgia', 'Times New Roman', serif;
  --map-h: 42%;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@supports not (height: 100dvh) {
  :root {
    --app-height: 100vh;
  }
}

[data-theme='dark'] {
  --cream: #121018;
  --cream-dark: #1a1524;
  --ink: #f3efe8;
  --muted: #a39eab;
  --card: #1e1830;
  --card-border: rgba(201, 162, 39, 0.15);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --liturgical-purple: #9b6bc9;
  --purple-deep: #c4a0e8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  overflow: hidden;
  box-sizing: border-box;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 8v16h-8v4h8v16h4V28h8v-4h-8V8h-4z' fill='%234a1c6b'/%3E%3C/svg%3E");
  z-index: 0;
}

/*
 * Full-browser shell: pin #app to the visual viewport so the app always
 * fills whatever size the browser tab is (Mac, Windows, phone, resized window).
 */
#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  box-sizing: border-box;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Chrome above main — never shrink; can scroll horizontally if needed */
.app-header,
.live-banner,
.location-bar,
.location-status,
.filters,
.view-toggle-bar,
.bottom-nav {
  flex-shrink: 0;
}

/* Header */
.app-header {
  position: relative;
  z-index: 100;
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 clamp(0.65rem, 2vw, 1.25rem);
  background: linear-gradient(135deg, var(--purple-deep), var(--liturgical-purple) 55%, #5c2d82);
  color: #fff;
  box-shadow: var(--shadow);
}

[data-theme='dark'] .app-header {
  background: linear-gradient(135deg, #0d0a14, #1e1230 50%, #2a1840);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* Always visible on main page */
.app-version-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  white-space: nowrap;
  line-height: 1.2;
}

/* Full-site language switcher (duplicate site in EN / ES / IT / 中文) */
.ui-lang-select {
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 0.35rem 1.6rem 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23fff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}

.ui-lang-select option {
  color: #1a1520;
  background: #fff;
}

.ui-lang-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

html[data-locale='zh'] body {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
}

html[data-locale='zh'] .brand h1,
html[data-locale='zh'] .panel-title h2 {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Songti SC', serif;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gold), #a8841a);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .tagline {
  display: none;
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.85;
}

@media (min-width: 720px) {
  .brand .tagline {
    display: block;
  }
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .brand-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }
}

.header-actions {
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  min-width: 42px;
  min-height: 42px;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Live banner */
.live-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(90deg, var(--green-lit), #40916c);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  animation: slideDown 0.35s ease;
}

.live-banner.soon {
  background: linear-gradient(90deg, var(--serene-blue), #2a5298);
}

.live-banner.empty {
  background: var(--cream-dark);
  color: var(--muted);
}

.live-banner .pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: pulse 1.6s infinite;
  flex-shrink: 0;
}

.live-banner .clock {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  opacity: 0.95;
  font-size: 0.85rem;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Soft color zones (spread out so each area is clear) ---- */
.chrome-zone {
  flex-shrink: 0;
  padding: 0.65rem clamp(0.85rem, 2.5vw, 1.5rem) 0.75rem;
  border-bottom: 1px solid transparent;
}

.zone-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.zone-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted, #5c566b);
}

/* Soft blue — where you are */
.zone-location {
  background: linear-gradient(180deg, #eef5fb 0%, #e4eef8 100%);
  border-bottom-color: #c5d8ea;
}
.zone-location .zone-dot { background: #4a90c8; }
.zone-location .zone-title { color: #2c5f8a; }

/* Keep Search next to the ZIP field — not stuck on the far right of a wide screen */
.zone-location .location-bar {
  max-width: 560px;
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 520px) {
  .zone-location .location-bar {
    flex-wrap: wrap;
    max-width: 100%;
  }
}

/* Soft cream / multi — filters */
.zone-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  background: #f7f3ec;
  border-bottom-color: #e0d6c8;
  padding-top: 0.75rem;
  padding-bottom: 0.85rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem 0.6rem;
  border-radius: 14px;
  min-width: min(100%, 200px);
  flex: 1 1 auto;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Soft lavender — distance */
.zone-dist {
  background: #f0eaf8;
  border: 1px solid #dccfee;
}
.zone-dist .filter-label { color: #5b3d7a; }

/* Soft rose — Mass language */
.zone-lang {
  background: #fceef2;
  border: 1px solid #f0cfd9;
  flex: 1 1 280px;
}
.zone-lang .filter-label { color: #8a3d55; }

/* Soft mint — when */
.zone-when {
  background: #e9f6f0;
  border: 1px solid #c5e6d4;
}
.zone-when .filter-label { color: #2d6a4f; }

/* Soft peach — form */
.zone-form {
  background: #fdf3e7;
  border: 1px solid #f0d9b8;
}
.zone-form .filter-label { color: #8a5a28; }

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0;
}

/* Soft slate — map/list layout toggle */
.zone-layout {
  background: #eef0f4;
  border-bottom-color: #d5dae3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
}
.zone-layout .layout-label {
  color: #4a5568;
  margin-right: 0.25rem;
}

/* Header Support (Stripe tips) */
.btn-support-header {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(201, 162, 39, 0.22);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-support-header:hover,
.btn-support-header:focus-visible {
  background: rgba(201, 162, 39, 0.4);
  border-color: rgba(255, 255, 255, 0.55);
  outline: none;
}

/* Settings — Support / Stripe card */
.support-card {
  margin: 0.75rem 1rem 1rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7f0ff 0%, #fff8ec 55%, #f3f7ff 100%);
  border: 1px solid rgba(74, 28, 107, 0.14);
  box-shadow: 0 8px 24px rgba(45, 16, 68, 0.06);
}
[data-theme='dark'] .support-card {
  background: linear-gradient(145deg, #241832 0%, #1e1a28 100%);
  border-color: rgba(201, 162, 39, 0.2);
}
.support-card-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}
.support-heart {
  color: #b4536a;
  font-size: 1.1rem;
  line-height: 1;
}
.support-blurb {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}
.support-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.support-amounts .btn {
  min-width: 3.5rem;
}
.support-open {
  width: 100%;
  margin-bottom: 0.35rem;
}
.support-secure {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  text-align: center;
}
.support-setup-hint {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--burgundy, #6b1e2e);
  background: rgba(107, 30, 46, 0.06);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

/* Stripe connect wizard (settings) */
.stripe-setup-card {
  margin: 0.75rem 1rem 1rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  background: #f0f7ff;
  border: 1px solid #b6d0f0;
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.08);
}
[data-theme='dark'] .stripe-setup-card {
  background: #152030;
  border-color: rgba(100, 160, 220, 0.25);
}
.stripe-setup-steps {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink);
}
.stripe-setup-steps li {
  margin-bottom: 0.35rem;
}
.stripe-setup-steps code {
  font-size: 0.78em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
}
@media (max-width: 700px) {
  .stripe-setup-card {
    margin: 0.5rem 0.65rem 0.75rem;
  }
}

/* Parish Pro card (settings) */
.pro-card {
  margin: 0 1rem 1rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #2d1044 0%, #4a1c6b 55%, #3a2a12 100%);
  color: #faf6f1;
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow: 0 10px 28px rgba(45, 16, 68, 0.2);
}
.pro-card .settings-h {
  color: #fff;
}
.pro-card .support-blurb,
.pro-card .meta-line,
.pro-card .support-secure {
  color: rgba(250, 246, 241, 0.82);
}
.pro-card .support-setup-hint {
  color: #fde68a;
  background: rgba(0, 0, 0, 0.2);
}
.pro-badge-icon {
  color: var(--gold, #c9a227);
  font-size: 1.15rem;
}
.pro-benefits {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: rgba(250, 246, 241, 0.9);
}
.pro-benefits li {
  margin-bottom: 0.25rem;
}
.pro-plans {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pro-plans .btn-primary {
  background: var(--gold, #c9a227);
  border-color: var(--gold, #c9a227);
  color: #1a1520;
}
.pro-plans .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.badge.pro {
  background: linear-gradient(135deg, #4a1c6b, #c9a227);
  color: #fff;
  border: none;
  font-weight: 700;
}
.parish-card.is-pro {
  border-color: rgba(201, 162, 39, 0.45);
  box-shadow: 0 6px 20px rgba(74, 28, 107, 0.1);
}

.claim-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.65rem 0 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(74, 28, 107, 0.08), rgba(201, 162, 39, 0.1));
  border: 1px solid rgba(74, 28, 107, 0.12);
}
.pro-active-banner,
.claim-pending-banner {
  margin: 0.35rem 0 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.pro-active-banner {
  background: rgba(201, 162, 39, 0.18);
  color: #5c3d00;
  border: 1px solid rgba(201, 162, 39, 0.35);
}
[data-theme='dark'] .pro-active-banner {
  color: var(--gold);
  background: rgba(201, 162, 39, 0.12);
}
.claim-pending-banner {
  background: rgba(74, 28, 107, 0.08);
  color: var(--liturgical-purple);
}
.claim-modal .claim-parish-name {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}
.claim-modal textarea {
  width: 100%;
  font: inherit;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  resize: vertical;
  background: var(--card);
  color: var(--ink);
}

@media (max-width: 700px) {
  .pro-card {
    margin: 0 0.65rem 0.75rem;
    padding: 0.85rem 0.9rem;
  }
}

@media (max-width: 700px) {
  .btn-support-header {
    font-size: 0.65rem;
    padding: 0.3rem 0.5rem;
    min-height: 32px;
  }
  .support-card {
    margin: 0.5rem 0.65rem 0.75rem;
    padding: 0.85rem 0.9rem;
  }
}

/* Soft gold accent — app language in header */
.zone-app-lang {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  padding: 0.25rem 0.35rem;
  border-radius: 12px;
  background: rgba(201, 162, 39, 0.18);
  border: 1px solid rgba(201, 162, 39, 0.35);
}

.lang-switch-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.85);
  padding-right: 0.25rem;
}

.zone-banner {
  /* keep gradient; slightly more padding */
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

/* Soft tint for map vs list panels */
.map-panel {
  background: #e2ebf4 !important;
  border-right: 1px solid #c9d6e5;
}

.list-panel {
  background: #faf7f2;
}

/* Location bar — compact cluster (Locate | ZIP | Search) */
.location-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0 0.35rem;
  background: transparent;
  border-bottom: none;
  max-width: 560px;
}

.location-bar .btn-locate {
  flex: 0 0 auto;
}

.location-bar input {
  flex: 1 1 auto;
  min-width: 8rem;
  max-width: 18rem;
  background: #fff;
}

.location-bar #btn-place-go {
  flex: 0 0 auto;
  margin-left: 0;
  white-space: nowrap;
}

.location-bar #btn-share-area {
  flex: 0 0 auto;
  white-space: nowrap;
}

.region-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.45rem 0 0.25rem;
}

.region-chip {
  background: #fff;
  border: 1.5px solid #9ec5e8;
  color: #2c5f8a;
  font-weight: 700;
  min-height: 34px;
}

.region-chip:hover,
.region-chip:focus-visible {
  border-color: #4a90c8;
  background: #e8f3fc;
}

.region-chip[data-region='hawaii'],
.region-chip[data-region='maui'],
.region-chip[data-region='oahu'] {
  border-color: #7ec8b8;
  color: #1d6b5c;
  background: #eef9f5;
}

.location-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem 0 0.15rem;
  background: transparent;
  border-bottom: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  min-height: 1.75rem;
}

/* Chips inside soft zones — slightly larger, more spacing */
.zone-filters .chip {
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.zone-filters .chip.active {
  background: var(--liturgical-purple);
  border-color: var(--liturgical-purple);
  color: #fff;
}

.zone-lang .chip.active {
  background: #9b4d68;
  border-color: #9b4d68;
}

.zone-dist .chip.active {
  background: #6b4c9a;
  border-color: #6b4c9a;
}

.zone-when .chip.active {
  background: #2d6a4f;
  border-color: #2d6a4f;
}

.zone-form .chip.active {
  background: #a67c3d;
  border-color: #a67c3d;
}

.location-status .loc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
}

#location-status-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* Detected device pill (Mac / Windows PC / phone…) */
.device-pill {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(74, 28, 107, 0.1);
  color: var(--liturgical-purple);
  border: 1px solid rgba(74, 28, 107, 0.15);
  white-space: nowrap;
}

[data-theme='dark'] .device-pill {
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold);
  border-color: rgba(201, 162, 39, 0.25);
}

html[data-device='mac'] .device-pill::before {
  content: ' ';
  font-weight: 400;
}

html[data-device='windows'] .device-pill {
  background: rgba(0, 120, 212, 0.1);
  color: #0067b8;
  border-color: rgba(0, 120, 212, 0.2);
}

/* Device-specific layout defaults */
html[data-form='desktop'] #main.layout-split {
  flex-direction: row !important;
}

html[data-form='desktop'] #main.layout-split .map-panel {
  flex: 1 1 65% !important;
  height: 100% !important;
  max-height: none !important;
}

html[data-form='desktop'] #main.layout-split .list-panel {
  flex: 0 0 min(400px, 35%) !important;
  width: min(400px, 35%) !important;
  height: 100% !important;
  max-width: 420px !important;
  border-left: 1px solid var(--card-border);
}

html[data-form='phone'] #main.layout-split {
  flex-direction: column !important;
}

html[data-form='phone'] #main.layout-split .map-panel {
  flex: 1 1 45% !important;
}

html[data-form='phone'] #main.layout-split .list-panel {
  flex: 1 1 55% !important;
  width: 100% !important;
  max-width: none !important;
  border-left: none !important;
}

html[data-form='tablet'] #main.layout-split {
  flex-direction: row !important;
}

html[data-form='tablet'] #main.layout-split .map-panel {
  flex: 1 1 55% !important;
  height: 100% !important;
}

html[data-form='tablet'] #main.layout-split .list-panel {
  flex: 0 0 42% !important;
  width: 42% !important;
  height: 100% !important;
  border-left: 1px solid var(--card-border);
}

.location-status.is-gps .loc-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.28);
  animation: pulse 1.6s infinite;
}

.location-status.is-search .loc-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.3);
}

.location-status.is-default .loc-dot {
  background: #94a3b8;
}

.location-status.is-error {
  color: var(--burgundy);
}

.location-status #location-status-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-bar input {
  flex: 1 1 140px;
  min-height: 44px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font: inherit;
  background: var(--cream);
  color: var(--ink);
}

.location-bar input:focus {
  outline: 2px solid var(--gold);
  border-color: transparent;
}

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--liturgical-purple), #6b3a9e);
  color: #fff;
  box-shadow: 0 4px 14px rgba(74, 28, 107, 0.3);
}

[data-theme='dark'] .btn-primary {
  background: linear-gradient(135deg, #7c4db8, #5a2d8a);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(74, 28, 107, 0.4);
}

.btn-secondary {
  background: var(--cream-dark);
  color: var(--ink);
  border: 1px solid var(--card-border);
}

.btn-ghost {
  background: transparent;
  color: var(--liturgical-purple);
  border: 1px solid var(--card-border);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a8841a);
  color: #1a1520;
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Filters */
.filters {
  display: flex;
  gap: 0.45rem;
  padding: 0.4rem clamp(0.65rem, 2vw, 1.25rem);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  max-width: 100%;
}

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

.chip {
  appearance: none;
  border: 1.5px solid var(--card-border);
  background: var(--cream);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  min-height: 36px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.chip:hover {
  border-color: var(--gold);
}

.chip.active {
  background: var(--liturgical-purple);
  border-color: var(--liturgical-purple);
  color: #fff;
}

[data-theme='dark'] .chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1520;
}

/* Map / list layout toggle — spacing handled by .zone-layout */
.view-toggle-bar {
  /* base; zone-layout adds soft color */
}

.view-toggle {
  appearance: none;
  border: 1.5px solid var(--card-border);
  background: var(--cream);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  flex: 1;
  max-width: 160px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.view-toggle.active {
  background: var(--liturgical-purple);
  border-color: var(--liturgical-purple);
  color: #fff;
}

[data-theme='dark'] .view-toggle.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1520;
}

/* Main workspace — grows to fill everything between chrome and bottom nav */
.main {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column;
  background: var(--cream);
  position: relative;
  z-index: 1;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Split: map + list share the full main area 50/50 (no fixed max map height) */
.main.layout-split {
  flex-direction: column;
}

.main.layout-split .map-panel {
  flex: 1 1 50% !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  display: block !important;
  position: relative !important;
}

.main.layout-split .list-panel {
  flex: 1 1 50% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column;
}

/* Map only */
.main.layout-map {
  flex-direction: column;
}

.main.layout-map .map-panel {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  height: 100% !important;
  width: 100% !important;
  display: block !important;
}

.main.layout-map .list-panel {
  display: none !important;
}

/* List only */
.main.layout-list {
  flex-direction: column;
}

.main.layout-list .map-panel {
  display: none !important;
}

.main.layout-list .list-panel {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-width: none !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column;
  border-left: none !important;
}

.main.map-expanded .map-panel,
.main.layout-map.map-expanded .map-panel {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
}

/* Short landscape: side-by-side */
@media (max-height: 520px) and (orientation: landscape) {
  .main.layout-split {
    flex-direction: row !important;
    align-items: stretch;
  }
  .main.layout-split .map-panel,
  .main.layout-split .list-panel {
    flex: 1 1 50% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
  }
  .main.layout-split .list-panel {
    border-left: 1px solid var(--card-border);
  }
  .app-header {
    height: 44px;
    min-height: 44px;
  }
  .app-header .tagline {
    display: none;
  }
}

/* Desktop: map + list side by side, full height of main */
@media (min-width: 900px) {
  .main.layout-split {
    flex-direction: row !important;
    align-items: stretch;
  }
  .main.layout-split .map-panel {
    flex: 1 1 62% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
  }
  .main.layout-split .list-panel {
    flex: 0 0 min(420px, 38%) !important;
    width: min(420px, 38%) !important;
    max-width: 420px !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    border-left: 1px solid var(--card-border);
    display: flex !important;
    flex-direction: column;
    background: var(--cream);
  }
}

.map-panel {
  position: relative !important;
  min-height: 0 !important;
  background: #dfe7ef;
  overflow: hidden !important;
  isolation: isolate;
}

/* Critical: Leaflet needs a real-sized container */
#map {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  background: #c5d4e0;
  margin: 0;
  padding: 0;
}

#map.leaflet-container,
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  font: inherit;
  background: #c5d4e0;
  z-index: 1;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane {
  z-index: auto;
}

.leaflet-tile-container img,
.leaflet-tile {
  max-width: none !important; /* prevent global img CSS from squashing tiles */
}

/* Custom church / user markers (DivIcon — always visible) */
.mf-church-marker {
  background: transparent !important;
  border: none !important;
}

.mf-pin {
  position: relative;
  width: 32px;
  height: 42px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.mf-pin::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin, #4a1c6b);
  border: 2px solid #fff;
  top: 2px;
  left: 2px;
}

.mf-pin-cross {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 14px;
  line-height: 30px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.mf-church-marker.is-soon .mf-pin::before {
  background: #2d6a4f;
}

.mf-church-marker.is-fav .mf-pin::before {
  background: #c9a227;
}

.mf-user-marker {
  background: transparent !important;
  border: none !important;
}

.mf-user-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.map-status {
  position: absolute;
  left: 50%;
  bottom: 2.75rem;
  transform: translateX(-50%);
  z-index: 600;
  background: rgba(26, 21, 32, 0.88);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}

.map-status.is-error {
  background: rgba(107, 30, 46, 0.92);
}

.map-engine-badge {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1a73e8;
  box-shadow: var(--shadow);
}

.map-tool-google {
  background: #1a73e8 !important;
  color: #fff !important;
  border-color: #1a73e8 !important;
}

/* Google Maps embed engine */
.gembed-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #e8eaed;
}

.gembed-frame {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 0;
  background: #e8eaed;
}

.gembed-pinbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border-top: 1px solid var(--card-border);
  flex-shrink: 0;
  max-height: 88px;
  scrollbar-width: thin;
}

.gembed-pin {
  appearance: none;
  border: 1.5px solid var(--card-border);
  background: var(--cream);
  border-radius: 12px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 120px;
  max-width: 160px;
  text-align: left;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.gembed-pin:hover,
.gembed-pin.active {
  border-color: #1a73e8;
  background: #e8f0fe;
}

.gembed-pin.soon {
  border-color: #2d6a4f;
}

.gembed-pin.fav {
  border-color: #c9a227;
}

.gembed-pin-num {
  font-weight: 800;
  color: #1a73e8;
  font-size: 0.7rem;
}

.gembed-pin-label {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.gembed-pin-dist {
  font-size: 0.68rem;
  color: var(--muted);
}

.gembed-pin-actions {
  font-size: 0.65rem;
  color: #1a73e8;
  font-weight: 700;
  margin-top: 0.1rem;
}

.gembed-pin-actions [data-act] {
  cursor: pointer;
  text-decoration: underline;
}

.gembed-note {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.3rem 0.75rem 0.45rem;
  background: var(--card);
  flex-shrink: 0;
}

.gembed-link {
  appearance: none;
  border: none;
  background: none;
  color: #1a73e8;
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Ensure toolbar always visible above map content */
.map-panel {
  background: #e5e7eb !important;
}

.map-toolbar {
  z-index: 1000 !important;
}

.map-legend {
  z-index: 1000 !important;
  bottom: 7.5rem !important; /* above pin bar */
}

/* ===== Main OpenStreetMap embed (same as drawer mini-map) ===== */
.osm-main {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #e5e7eb;
}

.osm-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: #dfe7ef;
}

.osm-zoom-stack {
  position: absolute;
  right: 0.75rem;
  top: 4.25rem; /* below toolbar */
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: stretch;
}

.osm-zoom-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: #fff;
  color: #1a1520;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.osm-zoom-btn:hover {
  background: #f3f4f6;
}

.osm-zoom-btn:active {
  transform: scale(0.96);
}

.osm-zoom-level {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4a1c6b;
  background: #fff;
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.osm-focus-chip {
  position: absolute;
  left: 0.75rem;
  top: 4.25rem;
  z-index: 20;
  max-width: min(280px, 55vw);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a1520;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.osm-pinbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card, #fff);
  border-top: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  flex-shrink: 0;
  scrollbar-width: thin;
}

.osm-pin {
  appearance: none;
  border: 1.5px solid var(--card-border, rgba(0, 0, 0, 0.1));
  background: var(--cream, #faf6f1);
  border-radius: 12px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  min-width: 128px;
  max-width: 170px;
  text-align: left;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.osm-pin:hover,
.osm-pin.active {
  border-color: #4a1c6b;
  background: #f3eef8;
  box-shadow: 0 2px 8px rgba(74, 28, 107, 0.12);
}

.osm-pin.you {
  border-color: #2563eb;
}

.osm-pin.you.active {
  background: #dbeafe;
}

.osm-pin.soon {
  border-color: #2d6a4f;
}

.osm-pin.fav {
  border-color: #c9a227;
}

.osm-pin-num {
  font-weight: 800;
  color: #4a1c6b;
  font-size: 0.7rem;
}

.osm-pin.you .osm-pin-num {
  color: #2563eb;
}

.osm-pin-label {
  font-weight: 600;
  color: var(--ink, #1a1520);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.osm-pin-dist {
  font-size: 0.68rem;
  color: var(--muted, #6b6570);
}

.osm-pin-actions {
  font-size: 0.65rem;
  color: #4a1c6b;
  font-weight: 700;
  margin-top: 0.1rem;
}

.osm-pin-actions [data-act] {
  cursor: pointer;
  text-decoration: underline;
}

.osm-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  background: var(--card, #fff);
  border-top: 1px solid var(--card-border, rgba(0, 0, 0, 0.06));
  font-size: 0.75rem;
  color: var(--muted, #6b6570);
}

.osm-link-btn {
  appearance: none;
  border: none;
  background: #eee;
  color: #1a1520;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.osm-link-btn.google {
  background: #1a73e8;
  color: #fff;
}

.osm-link-btn:hover {
  filter: brightness(0.95);
}

/* Detail drawer mini-map a bit taller */
.detail-map-wrap {
  height: 200px;
}

/* Map toolbar */
.map-toolbar {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  right: 0.65rem;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.map-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.map-count-label {
  font-weight: 500;
  color: var(--muted);
}

.map-tool-btn {
  appearance: none;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  min-height: 34px;
}

.map-tool-btn:hover {
  border-color: var(--gold);
}

.map-legend {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

[data-theme='dark'] .map-legend {
  background: rgba(30, 24, 48, 0.92);
}

.map-legend .leg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.2rem;
  vertical-align: middle;
}

.leg-user {
  background: #2563eb;
}
.leg-church {
  background: #4a1c6b;
}
.leg-soon {
  background: #2d6a4f;
}
.leg-fav {
  background: #c9a227;
}

.map-overlay-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  background: transparent;
  padding: 0;
  border-radius: var(--radius);
  text-align: center;
  max-width: min(340px, 90%);
  pointer-events: none;
}

.map-overlay-hint:not(.hidden) {
  pointer-events: auto;
}

.map-welcome-card {
  background: var(--card);
  padding: 1.35rem 1.4rem 1.25rem;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  text-align: center;
}

.map-welcome-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.65rem;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--gold), #a8841a);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.35);
}

.map-welcome-card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--purple-deep);
}

.map-welcome-card p {
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.map-welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

/* Leaflet popups */
.mf-popup .leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.mf-popup .leaflet-popup-content {
  margin: 0.75rem 0.9rem;
  font-family: var(--font);
  min-width: 160px;
}

.map-popup strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.map-popup-meta {
  font-size: 0.78rem;
  color: #6b6570;
  margin-top: 0.15rem;
}

.map-popup-next {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2d6a4f;
}

.map-popup-badge {
  display: inline-block;
  font-size: 0.65rem;
  background: #d8f3dc;
  color: #1b4332;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.map-popup-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.map-popup-btn {
  appearance: none;
  border: none;
  background: #4a1c6b;
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.map-popup-btn.secondary {
  background: #e8e4ef;
  color: #2d1044;
}

/* Detail drawer mini-map */
.detail-map-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--card-border);
  height: 180px;
  background: var(--cream-dark);
}

.detail-map-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.card-map-actions {
  margin-top: 0.5rem;
}

.card-map-actions .btn {
  font-size: 0.78rem;
}

/* List / secondary panels */
.list-panel {
  padding: 0;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 0;
  overflow: hidden;
}

/* Solo views (outside #main) — full remaining height under chrome */
.solo-view:not(.hidden):not([hidden]),
#ai-panel:not(.hidden):not([hidden]),
#tools-panel:not(.hidden):not([hidden]),
#settings-panel:not(.hidden):not([hidden]),
#logs-panel:not(.hidden):not([hidden]) {
  flex: 1 1 auto !important;
  max-width: none !important;
  width: 100% !important;
  min-height: 0 !important;
  overflow: auto !important;
  display: flex !important;
  flex-direction: column !important;
}

.parish-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 1rem 5.5rem;
}

/* Mobile portrait: equal share of remaining main height (grows with window) */
@media (max-width: 899px) and (orientation: portrait) {
  .main.layout-split .map-panel {
    flex: 1 1 48% !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  .main.layout-split .list-panel {
    flex: 1 1 52% !important;
    min-height: 0 !important;
  }
  .main.layout-map .map-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
}

.panel-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--purple-deep);
}

[data-theme='dark'] .panel-title h2 {
  color: var(--gold-soft);
}

.meta-line {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Cards */
.parish-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeIn 0.35s ease both;
}

.parish-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(201, 162, 39, 0.45);
}

.parish-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.parish-card.soon {
  border-left: 4px solid var(--green-lit);
}

.parish-card.favorite {
  border-left: 4px solid var(--gold);
}

.parish-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.parish-card-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-family: var(--font-display);
  line-height: 1.25;
}

.parish-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--cream-dark);
  color: var(--ink);
}

.badge.now {
  background: #d8f3dc;
  color: #1b4332;
}

.badge.soon {
  background: #dbeafe;
  color: #1e3a5f;
}

.badge.lang {
  background: rgba(74, 28, 107, 0.1);
  color: var(--liturgical-purple);
}

.badge.live {
  background: #fee2e2;
  color: #991b1b;
}

.badge.ok {
  background: #e8f5e9;
  color: #1b4332;
}

.badge.warn {
  background: #fff3cd;
  color: #856404;
}

.parish-card.incomplete {
  border-left: 4px solid #d4a017;
  opacity: 0.98;
}

.schedule-missing {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.schedule-missing a {
  color: var(--liturgical-purple);
  font-weight: 600;
  display: inline-block;
  margin-top: 0.25rem;
}

.schedule-missing.block {
  background: var(--cream-dark);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid #d4a017;
}

.live-dot {
  color: #c0392b;
  font-size: 0.75rem;
  vertical-align: middle;
}

/* Directory chrome — sticky search “gravity” at top of right column */
.directory-header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--card) 0%, var(--cream) 100%);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 6px 18px rgba(45, 16, 68, 0.06);
  padding: 0.85rem 1rem 0.55rem;
  margin: 0;
}

.dir-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.directory-header .panel-title h2 {
  margin-top: 0.1rem;
}

.dir-lookup {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.65rem 0 0.5rem;
  position: relative;
}

.dir-lookup.sticky-search {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 0.25rem 0.35rem 0.25rem 0.55rem;
  box-shadow: 0 2px 10px rgba(45, 16, 68, 0.06);
}

.dir-search-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.85;
}

.dir-lookup input {
  flex: 1;
  min-height: 40px;
  min-width: 0;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.35rem;
  font: inherit;
  font-size: 0.92rem;
  background: transparent;
  color: var(--ink);
}

.dir-lookup input:focus {
  outline: none;
}

.dir-lookup.sticky-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

.dir-lookup select {
  flex-shrink: 0;
  min-height: 38px;
  border: none;
  border-left: 1px solid var(--card-border);
  border-radius: 0 10px 10px 0;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--cream-dark);
  color: var(--ink);
  max-width: 118px;
  cursor: pointer;
}

.dir-chips {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.45rem;
  scrollbar-width: none;
}

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

.dir-chip {
  appearance: none;
  border: 1.5px solid var(--card-border);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.dir-chip:hover {
  border-color: var(--gold);
}

.dir-chip.active {
  background: var(--liturgical-purple);
  border-color: var(--liturgical-purple);
  color: #fff;
}

.dir-chip.parish {
  background: var(--cream-dark);
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.85rem 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-label span {
  font-weight: 700;
  letter-spacing: 0;
  background: var(--cream-dark);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  color: var(--ink);
}

.dir-chip.zip {
  font-variant-numeric: tabular-nums;
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #312e81;
}

.zip-browser {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 55vh;
  overflow-y: auto;
}

.zip-row {
  appearance: none;
  border: 1px solid var(--card-border);
  background: var(--cream);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.15rem 0.75rem;
}

.zip-row.has {
  border-left: 3px solid var(--green-lit, #2d6a4f);
}

.zip-row strong {
  grid-row: span 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
  color: var(--liturgical-purple);
}

.zip-row span {
  font-size: 0.78rem;
  color: var(--muted);
}

.zip-names {
  grid-column: 2;
  color: var(--ink) !important;
  font-weight: 500;
}

.zip-row:hover {
  border-color: var(--gold);
  background: var(--card);
}

[data-theme='dark'] .badge.now {
  background: #1b4332;
  color: #d8f3dc;
}

[data-theme='dark'] .badge.soon {
  background: #1e3a5f;
  color: #bfdbfe;
}

[data-theme='dark'] .badge.lang {
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold-soft);
}

.mass-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.mass-pill {
  font-size: 0.8rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(74, 28, 107, 0.08), rgba(201, 162, 39, 0.1));
  border: 1px solid var(--card-border);
  font-variant-numeric: tabular-nums;
}

.mass-pill.highlight {
  background: var(--green-lit);
  color: #fff;
  border-color: transparent;
}

.star-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
  padding: 0.25rem;
  min-width: 44px;
  min-height: 44px;
  margin: -0.5rem -0.5rem 0 0;
}

.star-btn.active {
  color: var(--gold);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Detail drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 30, 0.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  z-index: 210;
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.drawer.open {
  transform: translateY(0);
}

@media (min-width: 720px) {
  .drawer {
    left: auto;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100%);
    max-height: 100dvh;
    border-radius: 0;
    transform: translateX(110%);
  }
  .drawer.open {
    transform: translateX(0);
  }
}

.drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--muted);
  opacity: 0.35;
  border-radius: 4px;
  margin: 0.65rem auto 0.25rem;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--card-border);
}

.drawer-header h2 {
  margin: 0;
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.drawer-body {
  overflow-y: auto;
  padding: 1rem 1.15rem 2rem;
  flex: 1;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.75rem 0 1rem;
}

.action-row a,
.action-row button {
  text-decoration: none;
}

.section {
  margin-bottom: 1.25rem;
}

.section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.schedule-day {
  margin-bottom: 0.65rem;
}

.schedule-day strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.disclaimer {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--cream-dark);
  border-left: 3px solid var(--gold);
  padding: 0.65rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 1rem;
}

/* Modals / sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 30, 0.5);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal {
    border-radius: var(--radius);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--card-border);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.modal-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  flex: 1;
}

.form-row {
  margin-bottom: 0.85rem;
}

.form-row label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--muted);
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font: inherit;
  background: var(--cream);
  color: var(--ink);
}

.form-row textarea {
  min-height: 88px;
  resize: vertical;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--card-border);
}

/* AI chat */
.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 160px;
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.ai-msg {
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.92rem;
  max-width: 92%;
  line-height: 1.45;
}

.ai-msg.user {
  align-self: flex-end;
  background: var(--liturgical-purple);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg.bot {
  align-self: flex-start;
  background: var(--cream-dark);
  border-bottom-left-radius: 4px;
}

.ai-input-row {
  display: flex;
  gap: 0.45rem;
}

.ai-input-row input {
  flex: 1;
}

/* ---------- Activity Logs panel ---------- */
#logs-panel {
  overflow: auto;
  padding: 0.75rem 1rem 1.5rem;
  background: var(--cream);
}

.logs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.logs-header h2 {
  margin: 0.1rem 0 0.15rem;
  font-size: 1.25rem;
}

.logs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.logs-meta {
  margin-bottom: 0.65rem;
}

.logs-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.4rem 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-size: 0.78rem;
}

.logs-meta-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.logs-meta-grid strong {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.logs-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 2rem;
}

.logs-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border-radius: 12px;
  border: 1px dashed var(--card-border);
}

.log-entry {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  border-left: 4px solid var(--muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.log-entry.level-change {
  border-left-color: var(--liturgical-purple);
}

.log-entry.level-success {
  border-left-color: #2e7d4f;
}

.log-entry.level-warn {
  border-left-color: #c9a227;
}

.log-entry.level-error {
  border-left-color: #b33a3a;
}

.log-entry.level-info {
  border-left-color: #4a7ab0;
}

.log-entry-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-bottom: 0.25rem;
}

.log-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.log-ver {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(74, 28, 107, 0.1);
  color: var(--liturgical-purple);
}

[data-theme='dark'] .log-ver {
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold);
}

.log-level {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.log-entry-mid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.log-cat,
.log-act {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
}

.log-cat {
  background: rgba(74, 28, 107, 0.08);
  color: var(--liturgical-purple);
}

.log-act {
  background: var(--cream-dark, rgba(0, 0, 0, 0.05));
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.log-msg {
  margin: 0.25rem 0 0.15rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.log-details {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.log-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}

.log-details pre {
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.65rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  overflow: auto;
  max-height: 220px;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme='dark'] .log-details pre {
  background: rgba(255, 255, 255, 0.06);
}

.log-iso {
  margin-top: 0.25rem;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Bottom nav is in-flow (not fixed) — main needs no extra padding */

/* Filter row — labeled groups, horizontal scroll on mobile */
.filters-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.35rem;
  mask-image: linear-gradient(to right, #000 92%, transparent);
}

.filters-scroll .chip {
  flex: 0 0 auto;
  min-height: 40px;
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
}

.filter-label {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-left: 0.35rem;
}

.filter-sep {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  background: var(--card-border);
  margin: 0.15rem 0.25rem;
}

/* Next Mass hero card */
.next-mass-hero {
  padding: 0 1rem 0.5rem;
}

.next-mass-hero.hidden {
  display: none !important;
}

.next-mass-hero-btn {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, rgba(74, 28, 107, 0.08), rgba(201, 162, 39, 0.12));
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  display: grid;
  gap: 0.15rem;
  box-shadow: 0 1px 3px rgba(36, 26, 56, 0.08);
}

.next-mass-hero-btn:hover {
  border-color: var(--liturgical-purple);
}

.nmh-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--liturgical-purple);
}

.nmh-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.nmh-meta {
  font-size: 0.9rem;
  color: var(--ink);
}

.nmh-cta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--liturgical-purple);
  margin-top: 0.15rem;
}

.next-mass-line {
  font-size: 0.95rem;
  color: var(--liturgical-purple);
  margin: 0.2rem 0 0.15rem;
  line-height: 1.35;
}

.next-mass-line.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.parish-card h3 {
  font-size: 1.1rem;
}

.list-footnote {
  padding: 0.5rem 1rem 1.5rem;
  font-size: 0.8rem;
}

.ai-suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.settings-section {
  margin: 0.75rem 0 1rem;
  padding: 0 0.15rem;
}

.settings-h {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--ink);
}

.settings-advanced {
  margin: 1rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card);
}

.settings-advanced summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.88rem;
}

#btn-locate.is-insecure {
  opacity: 0.75;
}

/*
 * Secondary tabs are OUTSIDE #main (siblings under #app).
 * When Assistant/Rosary/Settings is open: hide the entire #main (map+list).
 * They can never appear as columns next to Mass Assistant again.
 */
html[data-view='ai'] #main,
html[data-view='tools'] #main,
html[data-view='settings'] #main,
html[data-view='logs'] #main,
#app[data-view='ai'] #main,
#app[data-view='tools'] #main,
#app[data-view='settings'] #main,
#app[data-view='logs'] #main {
  display: none !important;
  visibility: hidden !important;
  flex: 0 0 0 !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.solo-view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;
  flex-direction: column;
  background: var(--cream);
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem) 1rem;
  box-sizing: border-box;
}

.solo-view-inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Readable body floor */
body {
  font-size: 16px;
}

.meta-line {
  color: #5c566b;
}

/* Bottom nav — in document flow on desktop; fixed on phone (see phone section) */
.bottom-nav {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 150;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 0.15rem;
  width: 100%;
  min-height: var(--nav-h);
  padding: 0.3rem 0.25rem calc(0.3rem + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.nav-item {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: clamp(0.58rem, 1.6vw, 0.72rem);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.3rem 0.15rem;
  min-height: 48px;
  cursor: pointer;
  border-radius: 12px;
  min-width: 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-item.active {
  color: var(--liturgical-purple);
  background: rgba(74, 28, 107, 0.08);
}

[data-theme='dark'] .nav-item.active {
  color: var(--gold);
  background: rgba(201, 162, 39, 0.1);
}

/* Install prompt — above in-flow bottom nav */
.install-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  z-index: 160;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 0.75rem;
  animation: slideUp 0.35s ease;
}

.install-banner.show {
  display: flex;
}

.install-banner p {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
}

/* Toast */
#toast-host {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
  width: min(360px, calc(100% - 2rem));
}

.toast {
  background: var(--ink);
  color: var(--cream);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-success {
  background: var(--green-lit);
}

.toast-error {
  background: var(--burgundy);
}

/* Empty / offline */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.empty-state .cross {
  font-size: 2rem;
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

.empty-state.filter-empty {
  background: var(--card);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
  margin: 0.5rem 0 1rem;
  padding: 1.5rem 1rem;
}

.empty-state .btn {
  display: inline-flex;
  margin: 0.25rem;
}

.banner-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--liturgical-purple);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.live-banner.empty .banner-link {
  color: var(--liturgical-purple);
}

.offline-bar {
  background: #5c3d1e;
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.35rem;
  display: none;
}

.offline-bar.show {
  display: block;
}

/* Rosary */
.rosary-panel {
  text-align: center;
  padding: 1rem 0;
}

.rosary-bead-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.bead {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream-dark);
  border: 2px solid var(--gold);
  transition: background 0.2s;
}

.bead.done {
  background: var(--gold);
}

.rosary-timer {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--liturgical-purple);
  margin: 0.5rem 0;
}

/* Leaflet cluster polish */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(74, 28, 107, 0.25) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--liturgical-purple) !important;
  color: #fff !important;
  font-weight: 700 !important;
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   Phone / iPhone — scroll + always-visible bottom tabs
   Desktop keeps the locked full-viewport shell.
   ============================================================ */
@media (max-width: 700px) {
  #app {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain;
    /* room for fixed bottom tabs + home indicator */
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 4px) !important;
  }

  /* Compact chrome so more map/list fits above the fold */
  .app-header {
    height: auto;
    min-height: 48px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }
  .app-header .tagline {
    display: none;
  }
  .zone-app-lang .lang-switch-label {
    display: none;
  }
  .chrome-zone {
    padding: 0.4rem 0.7rem 0.45rem;
  }
  .zone-heading {
    margin-bottom: 0.25rem;
  }
  .zone-title {
    font-size: 0.65rem;
  }
  .live-banner {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.8rem;
  }

  /* Location: keep one compact row when possible */
  .zone-location .location-bar {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  #btn-share-area {
    flex: 0 0 auto;
  }
  .region-quick {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }
  .region-quick::-webkit-scrollbar {
    display: none;
  }
  .region-chip {
    flex: 0 0 auto;
  }

  /* Filters: horizontal scroll instead of tall wrap stack */
  .zone-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-top: 0.45rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
  }
  .zone-filters::-webkit-scrollbar {
    display: none;
  }
  .zone-filters .filter-group {
    flex: 0 0 auto;
    min-width: max-content;
    max-width: 88vw;
    padding: 0.4rem 0.55rem 0.45rem;
  }

  .view-toggle-bar.zone-layout {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }

  /* Main content has real height so list/map are usable */
  #main.main,
  .main {
    flex: 1 0 auto !important;
    min-height: 48vh !important;
    overflow: hidden !important;
  }

  .main.layout-split .map-panel {
    flex: 0 0 38vh !important;
    min-height: 180px !important;
    max-height: 42vh !important;
  }
  .main.layout-split .list-panel {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    overflow: hidden !important;
  }
  .parish-list-scroll {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 1rem !important;
    max-height: none;
  }

  /* Tabs always on screen — fixed to bottom of the phone */
  .bottom-nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 400 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    min-height: var(--nav-h);
    padding: 0.25rem 0.2rem calc(0.25rem + var(--safe-bottom));
    background: var(--card) !important;
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
  }

  .solo-view:not(.hidden):not([hidden]) {
    flex: 1 0 auto !important;
    min-height: 55vh !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 0.75rem !important;
  }

  .install-banner {
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px);
  }
}

/* Also when device detection marks phone/iOS (covers wide iPhones in landscape) */
html[data-form='phone'] #app,
html[data-device='ios'] #app {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 4px) !important;
}

html[data-form='phone'] .bottom-nav,
html[data-device='ios'] .bottom-nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 400 !important;
}

html[data-form='phone'] #main.main,
html[data-device='ios'] #main.main {
  flex: 1 0 auto !important;
  min-height: 48vh !important;
}

/* Desktop: never apply phone scroll shell */
@media (min-width: 901px) {
  html[data-form='desktop'] #app {
    overflow: hidden !important;
    padding-bottom: 0 !important;
  }
  html[data-form='desktop'] .bottom-nav {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }
}

/* High contrast preference */
@media (prefers-contrast: more) {
  .parish-card,
  .chip,
  .btn {
    border-width: 2px;
  }
  :root {
    --card-border: rgba(0, 0, 0, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
