:root {
  --bg: #f8f6f1;
  --surface: #ffffff;
  --surface-alt: #f1ede4;
  --ink: #1c2434;
  --ink-muted: #566074;
  --border: #dfd9cc;
  --gold: #a67c2e;
  --gold-soft: #f7f0df;

  --trad-roman-ordinary: #2c4a70;
  --trad-roman-1962: #7c2d36;
  --trad-byzantine: #6b4c9a;
  --trad-maronite: #2b624b;

  --tier-parish: #1f6b48;
  --tier-bulletin: #255a8a;
  --tier-website: #8a5a18;
  --tier-unverified: #9b2c2c;

  --radius: 12px;
  --shadow: 0 2px 10px rgba(28, 36, 52, 0.06);
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hidden {
  display: none !important;
}

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

.small {
  font-size: 0.875rem;
}

/* Top Bar */
.topbar {
  background: var(--ink);
  color: #f8f6f1;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  flex-shrink: 0;
  border-radius: 8px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 0;
  font-size: 0.8rem;
  color: #cfd5e1;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
}

.status-online {
  background: rgba(43, 145, 98, 0.22);
  color: #a9f0cb;
  border: 1px solid rgba(169, 240, 203, 0.35);
}

.status-offline {
  background: rgba(217, 119, 6, 0.25);
  color: #fde68a;
  border: 1px solid rgba(253, 230, 138, 0.4);
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f8f6f1;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #2c3850;
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--ink);
  background: var(--surface-alt);
}

.small-btn {
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--trad-roman-ordinary);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.2rem 0.25rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover {
  color: var(--ink);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 0.25rem 0.45rem;
}

/* Trust Banner */
.main-layout {
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

.trust-banner {
  background: var(--gold-soft);
  border: 1px solid #e4d4ad;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.location-banner {
  font-weight: 600;
  color: var(--trad-maronite);
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.mode-tab {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.mode-tab:hover {
  background: var(--surface-alt);
}

.mode-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Filters */
.filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.filter-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 0.28rem;
}

.filter-group input[type="search"],
.filter-group input[type="date"],
.filter-group select {
  width: 100%;
  padding: 0.46rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.88rem;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.filter-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.84rem !important;
  color: var(--ink) !important;
  cursor: pointer;
}

/* Main Split Grid */
.content-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.15rem;
  align-items: start;
}

@media (max-width: 920px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.panel-card h2,
.panel-card h3,
.results-header h2 {
  margin: 0;
  font-family: var(--font-serif);
}

.panel-card h2 {
  font-size: 1.12rem;
}

.panel-card h3 {
  font-size: 0.98rem;
  margin-bottom: 0.4rem;
}

/* Interactive Offline Vector Map */
.map-container {
  background: #ece8de;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.calgary-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-pin-group {
  cursor: pointer;
  transition: transform 0.12s ease;
}

.map-pin-group:hover circle.pin-core {
  stroke-width: 3;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-roman_ordinary { background: var(--trad-roman-ordinary); }
.dot-roman_1962 { background: var(--trad-roman-1962); }
.dot-byzantine { background: var(--trad-byzantine); }
.dot-syriac_maronite { background: var(--trad-maronite); }
.dot-shared {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--ink);
}

.selected-location-summary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

/* Results Area */
.results-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.date-divider {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid var(--border);
  margin-top: 0.35rem;
}

.schedule-card,
.parish-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  box-shadow: var(--shadow);
}

.schedule-card.is-cancelled {
  border-left: 4px solid #b91c1c;
  background: #fef8f8;
}

.schedule-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.time-block {
  min-width: 135px;
}

.time-main {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ink);
}

.is-cancelled .time-main {
  text-decoration: line-through;
  color: #991b1b;
}

.time-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.schedule-main {
  flex: 1;
  min-width: 220px;
}

.schedule-title {
  margin: 0 0 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.parish-line {
  font-size: 0.87rem;
  color: var(--ink-muted);
  margin-bottom: 0.45rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.badge-trad-roman_ordinary { background: #e8eef6; color: var(--trad-roman-ordinary); }
.badge-trad-roman_1962 { background: #f8e9eb; color: var(--trad-roman-1962); }
.badge-trad-byzantine { background: #efe9f8; color: var(--trad-byzantine); }
.badge-trad-syriac_maronite { background: #e6f2ec; color: var(--trad-maronite); }

.badge-tier-parish_confirmed { background: #e4f5ec; color: var(--tier-parish); }
.badge-tier-bulletin_verified { background: #e6f0fa; color: var(--tier-bulletin); }
.badge-tier-website_only { background: #fbf1df; color: var(--tier-website); }
.badge-tier-unverified { background: #fdeaea; color: var(--tier-unverified); }

.badge-obligation {
  background: var(--gold-soft);
  color: #7c5814;
  border: 1px solid #e2c98d;
}

.badge-non-obligation {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

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

.badge-shared {
  background: #1c2434;
  color: #f7e6bf;
}

.cutoff-alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.schedule-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--surface-alt);
  font-size: 0.8rem;
}

.action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--ink-muted);
}

/* Parish Directory Card */
.parish-entries-mini {
  margin-top: 0.65rem;
  border-top: 1px solid var(--surface-alt);
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mini-entry-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.86rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  border-radius: 8px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 0;
  font-size: 0.84rem;
}

.footer-inner p {
  margin: 0.2rem 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

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

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

.modal-body {
  padding: 1.1rem 1.15rem;
  overflow-y: auto;
  font-size: 0.9rem;
}

.quote-box {
  background: var(--bg);
  border-left: 4px solid var(--gold);
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  font-family: var(--font-serif);
  margin: 0.6rem 0;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 0.6rem 0 1rem;
}

.modal-table th,
.modal-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.modal-table th {
  background: var(--bg);
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.report-form label {
  font-size: 0.82rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.2rem;
}

.report-form textarea,
.report-form input,
.report-form select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
}

.report-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}
