/*
  Design: shrine and imambargah.
  Shrine green banners, Najaf gold, Mashhad tile turquoise, limewashed walls.
  The one bold element is the mihrab arch on the home page; everything else
  stays quiet. During Ayyam-e-Aza (set by season_controller.js) the whole app
  turns to mourning black, with gold dimmed and a thin red line.
*/

/*
  Urdu font: Jameel Noori Nastaleeq Kasheeda.
  Uses the copy installed on the device if there is one, otherwise the file
  in app/assets/fonts/. Falls back to Noto Nastaliq Urdu (Google Fonts).
*/
@font-face {
  font-family: "Jameel Noori Nastaleeq Kasheeda";
  src: local("Jameel Noori Nastaleeq Kasheeda"),
       local("JameelNooriNastaleeqKasheeda"),
       url("JameelNooriNastaleeqKasheeda.ttf") format("truetype");
  font-display: swap;
}

:root {
  --shrine: #0E4D3A;
  --shrine-deep: #0A3A2C;
  --gold: #C9A14A;
  --gold-soft: #F1E6C6;
  --tile: #1F7A80;
  --wall: #EEF2EE;
  --paper: #FFFFFF;
  --ink: #15231D;
  --muted: #5A6B63;
  --line: #D5DED8;
  --karbala: #8E1B1B;
  --aza-line: transparent;

  --font-latin: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", serif;
  --font-urdu: "Jameel Noori Nastaleeq Kasheeda", "Noto Nastaliq Urdu", serif;

  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23C9A14A' stroke-opacity='.22' stroke-width='1'%3E%3Cpath d='M14 14h20v20H14z'/%3E%3Cpath d='M24 9.9L38.1 24 24 38.1 9.9 24z'/%3E%3Cpath d='M0 0l6 6M48 0l-6 6M0 48l6-6M48 48l-6-6'/%3E%3C/g%3E%3C/svg%3E");

  --tabbar-height: 64px;
}

/* Ayyam-e-Aza: 1 Muharram to 8 Rabi ul Awwal */
html[data-season="aza"] {
  --shrine: #1C1C1C;
  --shrine-deep: #000000;
  --gold: #A8A08A;
  --gold-soft: #E7E4DC;
  --tile: #4A4A4A;
  --wall: #EDEDED;
  --muted: #5E5E5E;
  --aza-line: var(--karbala);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-latin);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--wall);
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
}

body.locale-ur {
  font-family: var(--font-urdu), var(--font-latin);
  font-size: 16px;
  line-height: 2.2;
}

a { color: var(--shrine); }

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

h1, h2 { line-height: 1.25; margin: 0; font-weight: 600; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.locale-ur h1, .locale-ur h2 { font-weight: 600; line-height: 1.9; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.icon { flex: none; vertical-align: -0.2em; }

/* Masthead */

.masthead {
  color: var(--gold-soft);
  background: var(--shrine-deep) var(--pattern);
  border-bottom: 3px solid var(--gold);
  box-shadow: inset 0 -1px 0 var(--aza-line);
}

.salawat {
  margin: 0;
  padding: 0.85rem 1rem;
  text-align: center;
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  line-height: 1.8;
  color: var(--gold);
}

.masthead-row {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.35rem 1rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
}
.brand .icon { color: var(--gold); }

/* Minbar-e-Sadiq logo mark (see logo_mark helper) */
.logo-mark { flex: none; display: block; }
.logo-mark .lm-arch { fill: none; stroke: var(--gold); stroke-width: 4; }
.logo-mark .lm-minbar { fill: var(--gold-soft); }
.logo-mark .lm-window { fill: var(--shrine-deep); }
.logo-mark .lm-star { fill: var(--gold); }
.logo-mark .lm-rail { stroke: var(--gold-soft); stroke-width: 3; stroke-linecap: round; }
.brand-name { font-family: "Marcellus", var(--font-latin); font-weight: 400; letter-spacing: 0.01em; }
.locale-ur .brand-name { font-family: var(--font-urdu); font-weight: 600; letter-spacing: 0; }
.brand-text { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.1; width: max-content; }
/* Fixed px sizes: the kashida length in community.yml is tuned to this ratio. */
.brand-text .brand-name { font-family: "Marcellus", var(--font-latin); font-weight: 400; font-size: 17px; letter-spacing: 0.02em; }
.brand-name-ur { font-family: var(--font-arabic); font-size: 22px; font-weight: 700; line-height: 1.45; margin-top: 5px; white-space: nowrap; color: var(--gold); }
.brand-name small { font-family: var(--font-latin); letter-spacing: 0; }

.lang-switch {
  margin-inline-start: auto;
  padding: 0.125rem 0.675rem;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  border-radius: 999px;
  color: var(--gold-soft);
  text-decoration: none;
  font-size: 0.95rem;
}
.lang-switch[lang="ur"] { line-height: 1.5; }
.lang-switch[lang="en"] { font-family: var(--font-latin); }

/* City and language switches */
.masthead-switches { display: flex; align-items: center; gap: 0.5rem; margin-inline-start: auto; }
.masthead-switches .lang-switch { margin-inline-start: 0; }

.city-switch { position: relative; flex-shrink: 0; }
.city-switch summary {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  border-radius: 999px;
  color: var(--gold-soft);
  font-size: 0.95rem;
  list-style: none;
  cursor: pointer;
}
.city-switch summary::-webkit-details-marker { display: none; }
.city-switch summary .icon { color: var(--gold); }
.city-switch[open] summary { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.city-switch ul {
  position: absolute;
  z-index: 1100;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 160px;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.city-switch a { display: block; padding: 0.45rem 0.75rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.city-switch a:hover { background: color-mix(in srgb, var(--shrine) 8%, var(--paper)); }
.city-switch a.is-selected { color: var(--shrine); font-weight: 600; }

.city-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
  max-width: 720px;
  margin: 0.9rem auto 0;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: var(--gold-soft);
  color: var(--shrine-deep);
}
.city-banner[hidden] { display: none; }
.city-banner .icon { color: var(--shrine); }
.city-banner span { flex: 1 1 auto; font-weight: 500; }
.city-suggest { padding: 0 1rem; }

/* Travel mode: a small pill at the top right of the page, details on tap */
.travel-mode {
  position: relative;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
}
.travel-wrap { position: relative; }
.travel-wrap[hidden] { display: none; }

.travel-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 999px;
  background: var(--shrine) var(--pattern);
  background-size: 28px;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 2px 10px rgba(10, 58, 44, 0.18);
  cursor: pointer;
  transition: background-color 0.15s;
}
.travel-pill .icon { color: var(--gold); }
.travel-pill:hover, .travel-pill[aria-expanded="true"] { background-color: var(--shrine-deep); }
.travel-pill:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Qasr / Full: gold word after a thin gold divider, not a nested pill */
.travel-status {
  padding-inline-start: 0.5rem;
  border-inline-start: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--gold);
  font-weight: 600;
}

.travel-pop {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(290px, calc(100vw - 2rem));
  padding: 0.9rem 1rem 0.8rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(10, 58, 44, 0.16);
}
.travel-pop[hidden] { display: none; }
.travel-detail { margin: 0; font-size: 0.9rem; color: var(--ink); }
.travel-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.travel-action {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.15rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--wall);
  color: var(--shrine);
  font: inherit;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
}
.travel-action:hover { background: var(--gold-soft); }
.travel-hide { display: block; margin-top: 0.65rem; font-size: 0.8rem; color: var(--muted); }

/* Pray full: gold pill, green text */
.travel-wrap.is-full .travel-pill { background: var(--gold-soft) none; border-color: var(--gold); color: var(--shrine); }
.travel-wrap.is-full .travel-pill .icon { color: var(--shrine); }
.travel-wrap.is-full .travel-status { color: var(--shrine); border-color: color-mix(in srgb, var(--shrine) 30%, transparent); }

/* Pull the home arch up so the pill sits just above it */
.travel-mode:has(.travel-wrap:not([hidden])) + .city-suggest + .page .arch,
.travel-mode:has(.travel-wrap:not([hidden])) + .page .arch { margin-top: 0.25rem; }

/* Qasr page: extra homes and "also my home" */
.qasr-extra-homes { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 0 0.75rem; border-bottom: 1px solid var(--line); }
.qasr-extra-homes[hidden] { display: none; }
.home-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.3rem 0.1rem 0.7rem;
  border-radius: 999px;
  background: var(--wall);
  font-size: 0.85rem;
}
.home-chip button { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; padding: 0.1rem 0.3rem; }
.home-chip button:hover { color: var(--karbala); }
.qasr-mark-home { flex-basis: 100%; justify-content: center; }
.qasr-mark-home[hidden] { display: none; }

/* "Qasr" tags show only in travel mode */
.qasr-tag {
  display: none;
  margin-inline-start: 0.4rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--tile);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.7;
  vertical-align: middle;
}
html[data-travel="qasr"] .qasr-tag { display: inline-block; }
.arch-qasr { display: none; margin: 0.2rem 0 0 !important; }
html[data-travel="qasr"] .arch[data-prayer="zuhr"] .arch-qasr,
html[data-travel="qasr"] .arch[data-prayer="asr"] .arch-qasr,
html[data-travel="qasr"] .arch[data-prayer="isha"] .arch-qasr { display: block; }
.arch .qasr-tag { background: var(--gold); color: var(--shrine-deep); font-size: 0.8rem; }

/* Tabs: bottom bar on phones, inline in the masthead on wide screens */

.tabs {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: none;
}
.locale-ur .tab { line-height: 1.7; font-size: 0.72rem; }
.tab.is-active { color: var(--shrine); font-weight: 600; }
.tab.is-active .icon { color: var(--gold); }
.tab:hover { color: var(--shrine); }

@media (min-width: 960px) {
  body { padding-bottom: 0; }

  .tabs {
    position: static;
    display: flex;
    gap: 0.25rem;
    height: auto;
    padding: 0;
    background: none;
    border: 0;
  }

  .tab {
    white-space: nowrap;
    flex-direction: row;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    color: var(--gold-soft);
    font-size: 0.95rem;
  }
  .tab:hover { color: #fff; background: color-mix(in srgb, var(--gold) 16%, transparent); }
  .tab.is-active, .tab.is-active:hover { color: var(--shrine-deep); background: var(--gold-soft); }
  .tab.is-active .icon { color: var(--shrine); }
}

/* Urdu (Nastaliq) needs more room: wider gaps and padding in the header and tabs */
.locale-ur .salawat { padding-top: 1rem; }
.locale-ur .masthead-row { padding-bottom: 1rem; }
.locale-ur .brand { gap: 0.7rem; }
.locale-ur .tab { gap: 0.25rem; }

@media (min-width: 960px) {
  .locale-ur .tabs { gap: 0.6rem; }
  .locale-ur .tab { gap: 0.6rem; padding: 0.3rem 1rem 0.45rem; font-size: 1rem; }
}

/* Page */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.page-head { margin-bottom: 1rem; }
.page-head p { margin: 0.2rem 0 0; }

.colophon {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0 1rem 1.5rem;
}

.flash {
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: var(--gold-soft);
}
.flash-alert { background: #F6DEDE; color: var(--karbala); }

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid var(--shrine);
  border-radius: 999px;
  background: var(--paper);
  color: var(--shrine);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.button { transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.button:hover { background: color-mix(in srgb, var(--shrine) 8%, var(--paper)); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.6; cursor: progress; }

.button-gold {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--shrine-deep);
}
.button-gold:hover { border-color: color-mix(in srgb, var(--gold) 88%, black); background: color-mix(in srgb, var(--gold) 88%, black); color: var(--shrine-deep); }

.button-primary { background: var(--shrine); color: #fff; }
.button-primary:hover { border-color: var(--shrine-deep); background: var(--shrine-deep); color: #fff; }
.button-danger { border-color: var(--karbala); color: var(--karbala); margin-top: 1rem; }
.button-danger:hover { background: color-mix(in srgb, var(--karbala) 8%, var(--paper)); color: var(--karbala); }
.button-small { min-height: 36px; padding: 0.3rem 0.85rem; font-size: 0.9rem; }

/* Home: the mihrab arch */

.arch {
  max-width: 460px;
  margin: 0.5rem auto 1.75rem;
  padding: 10px;
  color: #fff;
  text-align: center;
  background: var(--shrine) var(--pattern);
  border-radius: 230px 230px 22px 22px / 200px 200px 22px 22px;
  box-shadow: 0 0 0 3px var(--wall), 0 0 0 4px var(--gold);
}

.arch-inner {
  padding: 3.4rem 1.5rem 1.6rem;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 220px 220px 14px 14px / 190px 190px 14px 14px;
}

.arch p { margin: 0; }

.arch-date {
  min-height: 1.5em;
  color: var(--gold);
  font-size: 0.95rem;
}

.arch-label {
  margin-top: 0.9rem !important;
  color: var(--gold-soft);
  font-size: 0.95rem;
}

.arch-prayer {
  font-size: 2.6rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #fff;
}
.locale-ur .arch-prayer { font-size: 2.3rem; line-height: 2; }

.arch-time {
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}

.arch-time.is-until { font-size: 1.05rem; }

.arch-countdown {
  display: inline-block;
  margin-top: 0.7rem !important;
  padding: 0.15rem 0.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 22%, transparent);
  color: #fff;
  font-weight: 500;
}
.arch-countdown:empty { display: none; }

.arch-note {
  margin-top: 1.1rem !important;
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--gold-soft) 75%, transparent);
}

/* Home: finder */

.finder { margin-bottom: 0.75rem; }
.finder p { margin: 0.15rem 0 0; }

.finder-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 0.9rem;
}

.finder .section-head h2 { margin: 0; }
.finder .section-head { margin-bottom: 0.4rem; }

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: var(--shrine);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover { color: var(--shrine-deep); }
.link-button:disabled { opacity: 0.6; cursor: progress; }
.link-button[hidden], [data-locate-target="prompt"][hidden] { display: none; }

.finder-status { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; }
.finder-status:empty { display: none; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: inset-inline-start 0.15s;
}
.switch input:checked + .switch-track { background: var(--shrine); }
.switch input:checked + .switch-track::after { inset-inline-start: 21px; }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Home: jamaat results, a timetable rather than a card grid */

.jamaats {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border-radius: 14px;
  border-top: 3px solid var(--shrine);
}

.jamaat {
  display: grid;
  grid-template-columns: 6rem 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.jamaat:last-child { border-bottom: 0; }

.jamaat-when {
  display: flex;
  flex-direction: column;
  padding-inline-end: 0.9rem;
  border-inline-end: 2px solid var(--gold);
}
.jamaat-time { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jamaat-prayer { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }

.jamaat-venue {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  text-decoration: none;
}
.jamaat-venue .icon { color: var(--tile); }

.jamaat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.jamaat-go { display: flex; flex-direction: column; align-items: stretch; gap: 0.35rem; text-align: center; }
.leave { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.jamaat.is-urgent .leave { color: var(--karbala); font-weight: 500; }
.jamaat.is-urgent .jamaat-when { border-color: var(--karbala); }

@media (max-width: 560px) {
  .jamaat { grid-template-columns: 5.8rem 1fr; }
  .jamaat-go {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.empty {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty .icon { color: var(--gold); }

/* Venues list */

/* Filters: chips instead of dropdowns */

.filters { display: grid; gap: 0.6rem; margin-bottom: 1rem; }

.chips {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 2px 1px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
  min-height: 38px;
  padding: 0.3rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  white-space: nowrap;
  text-decoration: none;
}
.chip { transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.chip:hover { border-color: var(--shrine); background: color-mix(in srgb, var(--shrine) 6%, var(--paper)); color: var(--shrine); }
.chip.is-selected { border-color: var(--shrine); background: var(--shrine); color: #fff; }
.chip.is-selected:hover { border-color: var(--shrine-deep); background: var(--shrine-deep); color: #fff; }
.chip.is-selected .icon { color: var(--gold); }

/* Period switch: one joined control */
.segmented {
  display: inline-flex;
  justify-self: start;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--shrine) 10%, var(--paper));
}
.segmented .chip { min-height: 34px; border: 0; background: none; color: var(--muted); }
.segmented .chip:hover { background: color-mix(in srgb, var(--shrine) 8%, transparent); color: var(--shrine); }
.segmented .chip.is-selected { background: var(--shrine); color: #fff; }
.segmented .chip.is-selected:hover { background: var(--shrine-deep); color: #fff; }

/* Remaining dropdowns (admin forms) */
select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  padding: 0.45rem 2.4rem 0.45rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background-color: var(--paper);
  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 d='M1 1.5l5 5 5-5' fill='none' stroke='%230E4D3A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
[dir="rtl"] select { padding: 0.45rem 0.85rem 0.45rem 2.4rem; background-position: left 0.85rem center; }
select:hover { border-color: var(--shrine); }
select:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

.map {
  height: 320px;
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  z-index: 0;
}
.map-small { height: 240px; margin-top: 1rem; }

/* Women-only events */
.women-only-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-inline-start: 0.4rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: #F3E3EC;
  color: #7A2A55;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.7;
  vertical-align: middle;
}
.status-women { margin-inline-start: 0.4rem; background: #F3E3EC; color: #7A2A55; }

.venues {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border-radius: 14px;
}
.venues li + li { border-top: 1px solid var(--line); }

.venue-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  color: inherit;
  text-decoration: none;
}
.venue-row:hover { background: color-mix(in srgb, var(--gold-soft) 45%, var(--paper)); }

.venue-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--shrine);
  color: var(--gold);
}

.venue-text { display: flex; flex-direction: column; min-width: 0; }
.venue-name { font-weight: 600; }
.venue-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  background: var(--wall);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.8;
}
.tag-gold { background: var(--gold-soft); color: var(--shrine-deep); }

/* Venue page */

/* Venue header: a rounded card, framed like the home page's prayer arch */
.venue-hero {
  margin: 0.5rem 0 1.25rem;
  padding: 8px;
  color: #fff;
  text-align: center;
  background: var(--shrine) var(--pattern);
  border-radius: 22px;
  box-shadow: 0 0 0 3px var(--wall), 0 0 0 4px var(--gold);
}
.venue-hero-inner {
  padding: 1.5rem 1.25rem 1.3rem;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 15px;
}
.venue-hero h1 { margin: 0; }
.venue-hero-mark { color: var(--gold); }

.venue-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 1rem;
  margin: 0.4rem 0 0.8rem;
  color: var(--gold-soft);
  font-size: 0.95rem;
}

.verified {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 25%, transparent);
  color: #fff;
  font-size: 0.8rem;
}
.verified.is-stale { background: #F3E2B8; color: #7A5410; }

/* Masjid page: one bar with Directions, Share and Donate */
.venue-actions {
  display: flex;
  margin: 1rem 0;
  padding: 0.35rem;
  border-radius: 16px;
  background: var(--paper);
}
.venue-action {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.55rem 0.25rem 0.5rem;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--shrine);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.venue-action + .venue-action,
.venue-actions .donate-wrap > .venue-action { border-inline-start: 1px solid var(--line); border-radius: 0; }
.venue-action:hover { background: color-mix(in srgb, var(--shrine) 6%, var(--paper)); border-radius: 12px; }
.venue-action:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 12px; }
.venue-action-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--shrine) 8%, var(--paper));
}
.venue-action.is-primary .venue-action-icon { background: var(--gold); color: var(--shrine-deep); }
/* Wider screens: icon and label side by side */
@media (min-width: 640px) {
  .venue-action { flex-direction: row; justify-content: center; gap: 0.6rem; padding: 0.45rem 0.5rem; font-size: 0.95rem; }
  .venue-action-icon { width: 34px; height: 34px; }
}

.panel {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--paper);
  border-radius: 14px;
}

.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.tile {
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tile-name { font-size: 0.85rem; color: var(--muted); }
.tile-time { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.tile-combined {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold-soft) 55%, var(--paper));
}

/* Masjid page: today's jamaats and Jummah as small mihrab cards */
.jamaat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.jamaat-head h2 { margin: 0; }
.jamaat-head .muted { font-size: 0.85rem; }
.jarch-none { display: flex; align-items: center; gap: 0.4rem; margin: 0.75rem 0 0; font-size: 0.9rem; }

.jarches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.6rem; }
.jarch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 1.6rem 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 60px 60px 12px 12px / 46px 46px 12px 12px;
  text-align: center;
}
.jarch-name { font-size: 0.9rem; color: var(--muted); }
.jarch-time { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jarch small { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.jarch.is-past { opacity: 0.55; }
.jarch.is-next { border-color: var(--gold); background: var(--shrine) var(--pattern); background-size: 30px; color: #fff; }
.jarch.is-next .jarch-name, .jarch.is-next small { color: var(--gold-soft); }
.jarch-tag { position: absolute; top: -0.6rem; padding: 0 0.55rem; border-radius: 999px; background: var(--gold); color: var(--shrine-deep); font-size: 0.7rem; font-weight: 600; line-height: 1.7; }
.jarch-jummah { border-color: var(--gold); background: var(--gold-soft); }
.jarch-jummah .jarch-name { color: #6B4A0E; }

.facilities {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem 1rem;
}
.facilities li { display: flex; align-items: center; gap: 0.45rem; }
.facilities .icon { color: var(--tile); }
.facilities .is-missing { color: var(--muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* Prayer times */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.day-nav {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.5rem;
  background: var(--shrine) var(--pattern);
  border-radius: 14px;
  border-bottom: 3px solid var(--gold);
  color: #fff;
  text-align: center;
}

.day-nav p { margin: 0; }
.day-nav-gregorian { font-size: 1.1rem; font-weight: 600; }
.day-nav-hijri { color: var(--gold); font-size: 0.95rem; }

.day-nav-arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  border-radius: 50%;
  background: none;
  color: var(--gold-soft);
  cursor: pointer;
}
.day-nav-arrow:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); }
.day-nav-next .icon { transform: scaleX(-1); }
[dir="rtl"] .day-nav-arrow .icon { transform: scaleX(-1); }
[dir="rtl"] .day-nav-next .icon { transform: none; }

.day-nav-today {
  margin-top: 0.35rem;
  padding: 0.1rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--shrine-deep);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.day-nav-today[hidden] { display: none; }

.place-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.place-bar p { margin: 0; display: inline-flex; align-items: center; gap: 0.35rem; }

.prayer-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
}

.prayer-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.prayer-row:last-child { border-bottom: 0; }

.prayer-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wall);
  color: var(--tile);
}

.prayer-name { font-size: 1.1rem; font-weight: 500; }
.prayer-time { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.prayer-row.is-past { color: var(--muted); }
.prayer-row.is-past .prayer-icon { opacity: 0.55; }

.prayer-row.is-next { background: var(--shrine); color: #fff; }
.prayer-row.is-next .prayer-icon { background: var(--gold); color: var(--shrine-deep); }
.prayer-row.is-next .prayer-time { color: var(--gold-soft); }

.sun-strip {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.sun-strip li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.7rem 0.3rem;
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
}
.sun-strip .icon { color: var(--gold); }
.sun-label { font-size: 0.8rem; color: var(--muted); }
.sun-time { font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 359px) {
  .sun-strip { grid-template-columns: repeat(2, 1fr); }
}

.table-scroll { overflow-x: auto; }

.month { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.month th, .month td {
  padding: 0.45rem 0.4rem;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.month th { color: var(--muted); font-weight: 500; }
.month td:first-child { text-align: start; font-weight: 500; }
.month tr.is-today { background: var(--gold-soft); }

/* Qasr calculator */
.qasr-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.qasr-link .icon { color: var(--tile); flex: none; }
.qasr-link:hover { box-shadow: inset 0 0 0 1.5px var(--shrine); }

.qasr { max-width: 560px; margin: 0 auto; }

.qasr-result {
  margin: 0 0 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  background: var(--paper);
  border-inline-start: 5px solid var(--line);
}
.qasr-result p { margin: 0; }
.qasr-verdict { font-size: 1.6rem; font-weight: 600; }
.qasr-verdict:empty { display: none; }
.qasr-reason { margin-top: 0.15rem !important; color: var(--muted); }
.qasr-result.is-qasr { border-inline-start-color: var(--shrine); background: color-mix(in srgb, var(--shrine) 7%, var(--paper)); }
.qasr-result.is-qasr .qasr-verdict { color: var(--shrine); }
.qasr-result.is-full { border-inline-start-color: var(--gold); }
.qasr-warning { margin-top: 0.6rem !important; padding: 0.5rem 0.75rem; border-radius: 8px; background: #F6EBD3; color: #6B4A0E; font-size: 0.9rem; }
.qasr-warning[hidden] { display: none; }

.qasr-card { border-radius: 14px; background: var(--paper); padding: 0 1rem; }
.qasr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.qasr-row:last-child { border-bottom: 0; }
.qasr-row > span { display: inline-flex; align-items: center; gap: 0.45rem; }
.qasr-row .icon { color: var(--tile); flex: none; }
.qasr-row .segmented .chip { min-height: 32px; padding: 0.2rem 0.85rem; cursor: pointer; }
.qasr-row .segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qasr-row .segmented .chip:has(input:checked) { background: var(--shrine); color: #fff; }
.qasr-row .segmented .chip:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

.qasr-change { flex-basis: auto; }
.qasr-change summary { list-style: none; }
.qasr-change summary::-webkit-details-marker { display: none; }
.qasr-change[open] { flex-basis: 100%; }
.qasr-change[open] summary { display: none; }
.qasr-change .chips { flex-wrap: wrap; }

.qasr-search { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.qasr-search input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}
.qasr-results { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.qasr-results:empty { display: none; }
.qasr-results li { padding: 0.15rem 0; }
.qasr-results button {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  text-align: start;
  cursor: pointer;
}
.qasr-results button:hover { background: color-mix(in srgb, var(--shrine) 8%, var(--paper)); }
.qasr-map-wrap { margin-top: 0.6rem; }
.qasr-map-wrap[hidden] { display: none; }
.qasr-map-wrap p { margin: 0 0 0.4rem; }
.qasr-map { height: 260px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 0.5rem; }

.qasr-more { margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: 14px; background: var(--paper); }
.qasr-more summary { cursor: pointer; font-weight: 500; color: var(--shrine); }
.qasr-more[open] summary { margin-bottom: 0.6rem; }
.qasr-more input {
  width: 100%;
  max-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}
.qasr-more ul { margin: 0 0 0.6rem; padding-inline-start: 1.2rem; }
.qasr-more li { margin-bottom: 0.35rem; }

/* Majalis and events */

.home-section { margin-top: 1.75rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.section-head h2 { margin: 0 0 0.6rem; }
.section-head a { font-size: 0.9rem; }

.event-day { margin-bottom: 1.25rem; }
.event-day-head { font-size: 1rem; color: var(--muted); font-weight: 500; }

.events {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border-radius: 14px;
  border-top: 3px solid var(--shrine-deep);
}
.events-plain { border-top: 0; }

.event {
  display: grid;
  grid-template-columns: 5.6rem 1fr;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.event:last-child { border-bottom: 0; }
.events-plain .event { padding-inline: 0; }

.event-when {
  display: flex;
  flex-direction: column;
  padding-inline-end: 0.9rem;
  border-inline-end: 2px solid var(--shrine-deep);
}
.event-time { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-date, .event-night { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.event-night { color: var(--karbala); }

.event-body p { margin: 0; }
.event-title { font-weight: 600; }
.event-speaker { color: var(--shrine); }
.event-topic { font-size: 0.9rem; color: var(--muted); }

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin-top: 0.3rem !important;
  font-size: 0.85rem;
  color: var(--muted);
}
.event-meta a { color: var(--tile); text-decoration: none; }
.event-meta a:hover { text-decoration: underline; }

/* Timing suggestions */

.report-link { margin: 0.8rem 0 0; font-size: 0.9rem; }
.suggest-form .field input, .suggest-form .field textarea {
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Islamic calendar */

.calendar {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
}
.calendar > li.muted { padding: 1rem; }

.calendar-month {
  padding: 0.55rem 1rem;
  background: var(--shrine) var(--pattern);
  color: var(--gold-soft);
  font-weight: 600;
}

.calendar-item {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  border-inline-start: 4px solid transparent;
}
.calendar-item:last-child { border-bottom: 0; }

.calendar-when { display: flex; flex-direction: column; align-items: center; text-align: center; }
.calendar-day { font-size: 1.5rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.calendar-greg { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }

.calendar-body { display: flex; flex-direction: column; }
.calendar-name { font-weight: 500; }
.calendar-meta { font-size: 0.82rem; color: var(--muted); }

.calendar-item.kind-wiladat, .calendar-item.kind-eid { border-inline-start-color: var(--gold); }
.calendar-item.kind-wiladat .calendar-day, .calendar-item.kind-eid .calendar-day { color: var(--shrine); }
.calendar-item.kind-shahadat, .calendar-item.kind-wafaat { border-inline-start-color: #1C1C1C; }
.calendar-item.kind-shahadat .calendar-day, .calendar-item.kind-wafaat .calendar-day { color: var(--karbala); }
.calendar-item.kind-night { border-inline-start-color: var(--tile); }

/* Donations (venue page) */
.donate-wrap { display: contents; }
.donations-dialog {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.1rem 1.2rem 1.2rem;
  border: 0;
  border-top: 4px solid var(--gold);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.donations-dialog::backdrop { background: rgba(10, 30, 22, 0.55); }
.donations-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.donations-dialog-head h2 { margin: 0; }
.dialog-close {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--wall);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { background: var(--line); }

.donation-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.donation { padding: 0.85rem 0.95rem; border: 1px solid var(--line); border-inline-start: 3px solid var(--gold); border-radius: 10px; }
.donation-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }
.donation-title { font-weight: 600; }
.donation-method { margin: 0.1rem 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.donation-numbers { display: grid; gap: 0.35rem; margin: 0; }
.donation-numbers > div { display: grid; grid-template-columns: 9rem 1fr; gap: 0.5rem; align-items: baseline; }
.donation-numbers dt { color: var(--muted); font-size: 0.85rem; }
.donation-numbers dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; }
.donation-value { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: 0.02em; word-break: break-all; }
.donations-warning { margin: 0.9rem 0 0; padding: 0.6rem 0.8rem; border-radius: 8px; background: #F6EBD3; color: #6B4A0E; font-size: 0.85rem; }
[data-donation-form-target][hidden] { display: none; }

@media (max-width: 480px) {
  .donation-numbers > div { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* Admin (functional, shares the palette) */

.admin { padding-bottom: 0; }

/* Admin shell: sidebar on wide screens, top bar + scrolling tabs on phones */
.admin-shell { min-height: 100vh; }

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--shrine-deep) var(--pattern);
  color: var(--gold-soft);
  border-bottom: 3px solid var(--gold);
}

.admin-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
}
.admin-brand .icon { color: var(--gold); }
.admin-brand small { display: block; font-weight: 400; font-size: 0.78rem; color: var(--gold); }
.admin-brand-side { display: none; }

.admin-account { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.admin-account-name { color: #fff; font-weight: 500; }
.admin-account-role { display: none; color: var(--gold); }
.admin-account form { margin: 0; }

.admin-signout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  border-radius: 999px;
  background: none;
  color: var(--gold-soft);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.admin-signout:hover { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.admin-signout span { display: none; }

.admin-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0 0.6rem 0.55rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }

.admin-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  color: var(--gold-soft);
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}
.admin-nav-link:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.admin-nav-link { transition: background-color 0.15s, color 0.15s; }
.admin-nav-link:hover { color: #fff; }
.admin-nav-link.is-active, .admin-nav-link.is-active:hover { background: var(--gold-soft); color: var(--shrine-deep); font-weight: 600; }
.admin-nav-link.is-active .icon { color: var(--shrine); }

.admin-badge {
  min-width: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--karbala);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35rem;
  text-align: center;
}

.admin-main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.admin-main > h1:first-of-type, .admin-main > .flash + h1 { margin-bottom: 0.75rem; }

.admin-guest-bar { padding: 0.8rem 1rem; background: var(--shrine-deep) var(--pattern); border-bottom: 3px solid var(--gold); }

@media (min-width: 960px) {
  .admin-shell { display: grid; grid-template-columns: 250px 1fr; }

  .admin-sidebar {
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-bottom: 0;
    border-inline-end: 3px solid var(--gold);
  }

  .admin-sidebar-top {
    order: 2;
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  }
  .admin-sidebar-top .admin-brand { display: none; }
  .admin-brand-side { display: flex; order: 0; padding: 1.4rem 1.25rem 0.5rem; font-size: 1.1rem; }

  .admin-account { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .admin-account-role { display: block; }
  .admin-account form { margin-top: 0.6rem; }
  .admin-signout span { display: inline; }

  .admin-nav {
    order: 1;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem 0.75rem;
    overflow: visible;
  }
  .admin-nav-link { padding: 0.6rem 0.8rem; }
  .admin-nav-link .admin-badge { margin-inline-start: auto; }
  .admin-nav-site { margin-top: 0.75rem; opacity: 0.85; }

  .admin-main { margin: 0; padding: 2rem 2.5rem 3rem; width: 100%; }
}

/* Admin page header and cards */
.admin-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.admin-page-head h1 { margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.admin-count {
  padding: 0 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--shrine) 10%, var(--paper));
  color: var(--shrine);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.8;
}
.admin-page-head { margin-bottom: 0.9rem; }
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.admin-toolbar .admin-search { flex: 1 1 320px; max-width: 520px; }
.admin-toolbar-filter { margin: 0; flex: 0 1 260px; }
.admin-toolbar-filter .ss { min-width: 0; }
.admin-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-inline-start: auto; }
.admin-page-actions form { margin: 0; }

.admin-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.admin-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--shrine);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.admin-card:hover { border-color: var(--shrine); }
.admin-card:hover .admin-card-edit { text-decoration: underline; }

.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.admin-card-title { font-size: 1.08rem; font-weight: 600; }
.admin-card-sub { margin: 0.15rem 0 0; color: var(--shrine); font-size: 0.92rem; }

.admin-card-facts { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
.admin-card-facts li { display: flex; align-items: center; gap: 0.45rem; }
.admin-card-facts .icon { color: var(--tile); }

.admin-card-edit { margin-top: auto; padding-top: 0.75rem; color: var(--shrine); font-weight: 500; font-size: 0.9rem; }

.admin-card-meta { display: block; font-size: 0.85rem; color: var(--muted); }
.admin-card-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: auto; padding-top: 0.9rem; }

.venue-card-name { display: flex; align-items: center; gap: 0.7rem; }
.venue-card-name .venue-mark { width: 38px; height: 38px; }

.venue-card-times {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.4rem;
}
.venue-card-times li {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--wall);
  font-size: 0.8rem;
  color: var(--muted);
}
.venue-card-times strong { color: var(--ink); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.venue-card-empty { margin: 0.85rem 0 0; }

.venue-card-verified { display: flex; align-items: center; gap: 0.35rem; margin: 0.7rem 0 0; font-size: 0.85rem; color: var(--shrine); }
.venue-card-verified.is-stale { color: #7A5410; }

.status { flex: none; padding: 0 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.7; }
.status-public { background: var(--green-tint, #DCEFE4); color: var(--shrine); }
.status-draft { background: #F3E2B8; color: #7A5410; }

/* Searchable dropdown (searchable_select_controller.js) */
.ss-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.ss { position: relative; min-width: 220px; }

.ss-button {
  width: 100%;
  min-height: 42px;
  padding: 0.45rem 2.4rem 0.45rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230E4D3A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.ss-button:hover { border-color: var(--shrine); }
.ss-button.is-placeholder { color: var(--muted); }
.ss-button[aria-expanded="true"] { border-color: var(--shrine); }

.ss-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  inset-inline: 0;
  min-width: 260px;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}
.ss-panel[hidden] { display: none; }

.ss-search {
  width: 100%;
  min-height: 38px;
  padding: 0.4rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.ss-search:focus { outline: none; border-color: var(--shrine); }

.ss-list { list-style: none; margin: 0.4rem 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ss-option { padding: 0.5rem 0.7rem; border-radius: 8px; cursor: pointer; }
.ss-option:hover, .ss-option.is-active { background: color-mix(in srgb, var(--shrine) 8%, var(--paper)); }
.ss-option[aria-selected="true"] { color: var(--shrine); font-weight: 600; }
.ss-empty { padding: 0.5rem 0.7rem; color: var(--muted); font-size: 0.9rem; }

select:disabled { background-color: var(--wall); color: var(--muted); cursor: not-allowed; opacity: 1; }

/* Admin search */
.admin-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(320px, 100%);
  padding: 0 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.admin-search:focus-within { border-color: var(--shrine); outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent); }
.admin-search .icon { color: var(--muted); }
.admin-search input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  outline: none;
}
.admin-search-clear { font-size: 0.85rem; color: var(--muted); }

/* Event form: speakers and fixed venue */
.field-label { font-weight: 400; }
.speaker-list { display: grid; gap: 0.4rem; }
.speaker-row { display: flex; align-items: center; gap: 0.6rem; }
.speaker-row input { flex: 1; padding: 0.5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 16px; }
.add-speaker { justify-self: start; margin-top: 0.2rem; }
.static-value { display: flex; align-items: center; gap: 0.4rem; margin: 0; min-height: 42px; font-weight: 500; }
.static-value .icon { color: var(--tile); }

/* Choice cards (event repeat options) */
.choice-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
}
.choice-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-title { font-weight: 600; }
.choice-hint { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.choice-card:has(input:checked) { border-color: var(--shrine); background: color-mix(in srgb, var(--shrine) 7%, var(--paper)); box-shadow: inset 0 0 0 1px var(--shrine); }
.choice-card:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

.recurrence-summary {
  margin: 0.25rem 0 0;
  padding: 0.6rem 0.8rem;
  border-inline-start: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold-soft) 45%, var(--paper));
  border-radius: 6px;
  font-weight: 500;
}
.recurrence-summary:empty { display: none; }
.field[hidden], fieldset[hidden] { display: none; }
.auth-card { max-width: 420px; margin: 2rem auto; }
.auth-card .admin-form { background: var(--paper); padding: 1rem; border-radius: 14px; margin: 1rem 0; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 0.6rem; border-bottom: 1px solid var(--line); text-align: start; }
.row-actions a { margin-inline-end: 0.75rem; }
.row-buttons { white-space: nowrap; text-align: end; }
.row-buttons form { display: inline-block; margin: 0; }
.row-buttons form + form { margin-inline-start: 0.4rem; }
.empty p { margin: 0; }

.checkbox { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.4rem 1rem 0.4rem 0; }

.admin-form fieldset { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); margin: 1rem 0; padding: 1rem; min-width: 0; }
.admin-form legend { font-weight: 600; padding: 0 0.4rem; }
.field { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.75rem; flex: 1 1 200px; min-width: 0; }
.field > input:not([type=checkbox]):not([type=radio]), .field > select, .field > textarea, .field .ss { width: 100%; max-width: 100%; }
.field-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.field input, .field textarea,
.schedule-table input {
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.schedule-table { width: 100%; border-collapse: collapse; margin-bottom: 0.5rem; }
.schedule-row[hidden] { display: none; }
.schedule-table th, .schedule-table td { padding: 0.3rem; text-align: start; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }

@media (max-width: 640px) {
  .schedule-table thead { display: none; }
  .schedule-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* SEO content: timetable, FAQ, breadcrumbs, footer links */

.timetable-section { margin-top: 1.75rem; }

.timetable-wrap {
  overflow-x: auto;
  background: var(--paper);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.timetable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timetable th, .timetable td { padding: 0.45rem 0.6rem; text-align: start; border-bottom: 1px solid var(--line); }
.timetable thead th { position: sticky; top: 0; background: var(--shrine); color: var(--gold-soft); font-weight: 500; }
.timetable tbody th { font-weight: 500; }
.timetable tbody tr:last-child th, .timetable tbody tr:last-child td { border-bottom: 0; }
.timetable tr.is-today { background: var(--gold-soft); }
.timetable-date, .timetable-hijri { display: block; }
.timetable-hijri { font-size: 0.75rem; color: var(--muted); font-weight: 400; }

.timetable-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 0.75rem 0 0.25rem; font-size: 0.9rem; }

.faq { margin-top: 1.75rem; }
.faq h2 { margin-bottom: 0.5rem; }
.faq p { margin: 0; line-height: 1.6; }

.crumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.venue-hero-title { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.venue-hero-title .venue-hero-mark { display: inline-flex; flex-shrink: 0; }

.sun-strip-five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 420px) {
  .sun-strip-five { grid-template-columns: repeat(3, 1fr); }
}

.other-cities { margin-top: 1.25rem; }

.colophon-links p { margin: 0.25rem 0; }
.colophon-links a { color: inherit; }
.section-head .section-title { font-size: 1.2rem; margin: 0 0 0.6rem; }
