/* MPC Live Prayer Times — styles */
:root {
  --ink: #0b1f1c;
  --night: #0d2a26;
  --night-2: #12352f;
  --night-3: #1a4740;
  --gold: #d9b45a;
  --gold-soft: #f1dfae;
  --cream: #f6f1e4;
  --mist: rgba(246, 241, 228, .66);
  --line: rgba(246, 241, 228, .12);
  --now: #ffe08a;
  --paper: #fbf9f4;
  --paper-2: #ffffff;
  --text: #1c2b28;
  --muted: #64716d;
  --border: #e3ddcf;
  --accent: #1f6f5c;
  --danger: #b4412f;
  --radius: 18px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); line-height: 1.5; }
a { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
code { font-family: var(--mono); font-size: .85em; background: rgba(0,0,0,.05); padding: .1em .35em; border-radius: 6px; word-break: break-all; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 40px); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .mark { width: 34px; height: 34px; color: var(--gold); }
.brand .mark svg { width: 100%; height: 100%; }
.brand b { display: block; font-weight: 600; letter-spacing: .01em; }
.brand small { display: block; font-size: .74rem; opacity: .7; margin-top: -2px; }
.bar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.bar nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: .92rem; opacity: .85; }
.bar nav a:hover { opacity: 1; background: rgba(127,127,127,.12); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; font: 600 .95rem var(--sans); padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.danger { background: var(--danger); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: wait; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--paper-2); min-height: 44px; }
textarea { min-height: auto; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: grid; gap: 5px; font-size: .88rem; font-weight: 500; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.check input { width: auto; min-height: 0; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-right: 0; border-radius: 12px 0 0 12px; background: rgba(0,0,0,.04); font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.prefix input { border-radius: 0 12px 12px 0; }

/* =========================================================
   PLAIN (admin / portal) pages
   ========================================================= */
body.plain { background: var(--paper); color: var(--text); min-height: 100vh; }
body.plain .bar { background: var(--night); color: var(--cream); }
.panel { max-width: 1040px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 32px) 80px; }
.panel.narrow { max-width: 520px; }
.panel h1 { font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem); margin: 8px 0 16px; }
.panel h1 small { font-size: .9rem; color: var(--muted); font-weight: 400; }
.card { background: var(--paper-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px clamp(16px, 3vw, 24px); margin: 0 0 18px; }
.card h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 14px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.card p { margin: 0 0 10px; }
.login { display: grid; gap: 14px; margin-top: 40px; }
.login h1 { margin: 0; }
.flash, .error, .ok { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; }
.flash { background: #e8f3ee; color: #1b5a49; }
.ok { background: #e8f3ee; color: #1b5a49; margin: 0; }
.error { background: #fbeae6; color: var(--danger); }
.grid2, .grid3, .grid6 { display: grid; gap: 14px; margin-bottom: 12px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid6 { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px; }
.span2 { grid-column: span 2; }
.hint { font-size: .86rem; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 500; color: var(--accent); font-size: .92rem; }
.rules { display: grid; gap: 10px; margin-bottom: 16px; }
.rule { display: grid; grid-template-columns: 90px 190px 150px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--paper); }
.rule b { font-weight: 600; }
.rule .o-min, .rule .o-time { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.rule .o-min input { width: 84px; }
.rule .prev { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.sticky-save { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--night); color: var(--cream); padding: 10px 10px 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.18); margin-bottom: 18px; }
.sticky-save .today-prev { font-family: var(--mono); font-size: .78rem; opacity: .85; }
.sticky-save .btn { background: var(--gold); color: var(--ink); }
.table-wrap { padding: 6px; overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
table.list th, table.list td { padding: 12px; border-bottom: 1px solid var(--border); }
table.list tr:last-child td { border-bottom: 0; }
.pill { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: #eee; color: var(--muted); }
.pill.on { background: #e1f1ea; color: #1b5a49; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
.danger-zone { border-color: #efcfc7; }

/* =========================================================
   LIVE (public) pages — night theme
   ========================================================= */
body.live {
  background-color: var(--night);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(217,180,90,.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(31,111,92,.35), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23f6f1e4' stroke-opacity='.045' stroke-width='1'%3E%3Cpath d='M48 8l11.7 28.3L88 48 59.7 59.7 48 88 36.3 59.7 8 48l28.3-11.7z'/%3E%3Crect x='26' y='26' width='44' height='44' transform='rotate(45 48 48)'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--cream);
  min-height: 100vh;
}
body.live .btn.ghost { color: var(--cream); }
body.live input, body.live select { background: rgba(255,255,255,.06); border-color: var(--line); color: var(--cream); }
body.live select option { color: var(--ink); }
body.live label { color: var(--mist); }
body.live .muted { color: var(--mist); }
body.live code { background: rgba(255,255,255,.08); }
.wrap-live { max-width: 1100px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 60px; }

.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; padding: clamp(12px, 3vw, 32px) 0 clamp(20px, 4vw, 40px); }
.place { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--cream); padding: 8px 14px; border-radius: 999px; font: 500 .95rem var(--sans); cursor: pointer; }
.place:hover { border-color: var(--gold); }
.place .pin { color: var(--gold); }
.dates { margin: 16px 0 4px; font-size: 1.02rem; }
.dates .hijri { color: var(--gold-soft); }
.clock { font-family: var(--mono); font-weight: 700; font-size: clamp(3.2rem, 10vw, 6.4rem); letter-spacing: -.03em; line-height: 1; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.clock .s { color: var(--gold); font-size: .42em; margin-left: .12em; vertical-align: .9em; }
.next { margin-top: 22px; padding: 18px 20px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(217,180,90,.18), rgba(217,180,90,.04)); border: 1px solid rgba(217,180,90,.35); }
.next .lbl { font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-soft); }
.next .name { font-size: 1.5rem; font-weight: 600; margin-top: 2px; }
.next .name .ar { font-family: 'Amiri', serif; font-weight: 700; color: var(--gold); margin-left: 8px; font-size: 1.15em; }
.next .cd { font-family: var(--mono); font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-prog { height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.bar-prog i { display: block; height: 100%; background: var(--gold); width: 0; transition: width 1s linear; }

.times { display: grid; gap: 8px; }
.times .t { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); transition: background .3s; }
.times .t .nm { font-weight: 500; font-size: 1.08rem; }
.times .t .nm .ar { font-family: 'Amiri', serif; color: var(--mist); font-size: 1.05rem; margin-left: 8px; }
.times .t .v { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.times .t .v small { display: block; font-family: var(--sans); font-size: .7rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--mist); }
.times .t .v.j { color: var(--gold); min-width: 4.2em; }
.times .t.sun { opacity: .72; }
.times .t.sun .nm { font-size: .98rem; }
.times .t.now { background: rgba(255,224,138,.12); border-color: rgba(255,224,138,.55); }
.times .t.now .nm::after { content: 'now'; margin-left: 10px; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; padding: 2px 8px; border-radius: 999px; background: var(--now); color: var(--ink); vertical-align: .2em; }
.times .t.nx { border-color: rgba(217,180,90,.5); }
.times.no-j .t { grid-template-columns: 1fr auto; }
.times-head { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 0 18px 2px; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.times-head span:nth-child(2), .times-head span:nth-child(3) { text-align: right; min-width: 4.2em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: .86rem; color: var(--mist); }
.chips span { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.notice { margin-top: 14px; padding: 12px 16px; border-left: 3px solid var(--gold); background: rgba(255,255,255,.04); border-radius: 0 12px 12px 0; white-space: pre-line; }
.jummah { margin-top: 10px; padding: 14px 18px; border-radius: 16px; background: rgba(31,111,92,.35); border: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.jummah b { font-family: var(--mono); color: var(--gold); font-size: 1.15rem; }

.section { margin-top: clamp(28px, 5vw, 56px); }
.section > h2 { font-weight: 600; font-size: 1.35rem; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.glass { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 3vw, 24px); }

.settings-pop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(5,15,13,.6); backdrop-filter: blur(4px); padding: 16px; }
.settings-pop .sheet { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--night-2); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: grid; gap: 14px; }
.settings-pop h3 { margin: 0; font-weight: 600; font-size: 1.2rem; display: flex; justify-content: space-between; align-items: center; }
.settings-pop .x { background: none; border: 0; color: var(--cream); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.city-list { max-height: 260px; overflow: auto; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.city-list button { text-align: left; background: none; border: 0; color: var(--cream); font: inherit; padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.city-list button:hover, .city-list button:focus { background: rgba(255,255,255,.08); outline: none; }
.city-list button small { color: var(--mist); }
.grid2-live { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.month { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.month th { font-weight: 500; text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mist); padding: 8px; position: sticky; top: 0; background: var(--night-2); }
.month td { font-family: var(--mono); padding: 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.month td:first-child { font-family: var(--sans); }
.month td.j { color: var(--gold); }
.month tr.today td { background: rgba(255,224,138,.12); }
.month tr.fri td:first-child { color: var(--gold-soft); }
.month-wrap { overflow: auto; max-height: 560px; border-radius: 14px; }

.dir-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.dir-results a { display: block; text-decoration: none; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.dir-results a:hover { border-color: var(--gold); }
.dir-results a b { display: block; font-weight: 600; }
.dir-results a small { color: var(--mist); }

.cta { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; background: linear-gradient(120deg, rgba(217,180,90,.16), rgba(31,111,92,.28)); border: 1px solid rgba(217,180,90,.3); border-radius: 24px; padding: clamp(20px, 4vw, 36px); }
.cta h2 { margin: 0 0 8px; font-weight: 600; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.cta p { margin: 0; color: var(--mist); }
.cta ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cta li::before { content: '✦'; color: var(--gold); margin-right: 8px; }
.cta .acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.masjid-head h1 { font-weight: 600; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; margin: 0; }
.masjid-head .addr { color: var(--mist); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { background: none; border: 0; color: var(--mist); font: 500 .85rem var(--sans); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.tabs button.on { background: var(--cream); color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-weight: 500; z-index: 40; }

.foot { text-align: center; padding: 30px 16px 40px; font-size: .88rem; color: var(--mist); display: grid; gap: 4px; }
body.plain .foot { color: var(--muted); }
.foot a { color: var(--gold-soft); }
body.plain .foot a { color: var(--accent); }

/* ---------- embed ---------- */
body.embed .bar, body.embed .foot, body.embed .section, body.embed .actions { display: none; }
body.embed .wrap-live { padding: 12px; }
body.embed .hero { grid-template-columns: 1fr; padding: 0; gap: 14px; }
body.embed .clock { font-size: 3rem; }
body.embed .powered { display: block; }
.powered { display: none; text-align: center; font-size: .75rem; color: var(--mist); margin-top: 10px; }

/* ---------- TV mode ---------- */
body.tv { overflow: hidden; height: 100vh; }
body.tv .bar, body.tv .foot, body.tv .section, body.tv .actions, body.tv .place { display: none; }
body.tv .wrap-live { max-width: none; height: 100vh; padding: 3.5vh 4vw; display: flex; flex-direction: column; }
body.tv .masjid-head h1 { font-size: 4.2vh; }
body.tv .masjid-head .addr { font-size: 2vh; }
body.tv .hero { flex: 1; grid-template-columns: 1fr 1.15fr; gap: 4vw; padding: 2vh 0 0; align-items: stretch; }
body.tv .hero > div:first-child { display: flex; flex-direction: column; justify-content: center; }
body.tv .dates { font-size: 2.6vh; }
body.tv .clock { font-size: 17vh; }
body.tv .next { padding: 2.4vh 2vw; margin-top: 3vh; }
body.tv .next .lbl { font-size: 1.8vh; }
body.tv .next .name { font-size: 3.6vh; }
body.tv .next .cd { font-size: 7vh; }
body.tv .times { gap: 1.1vh; align-content: center; }
body.tv .times .t { padding: 1.7vh 1.6vw; border-radius: 1.6vh; }
body.tv .times .t .nm { font-size: 3.4vh; }
body.tv .times .t .nm .ar { font-size: 3vh; }
body.tv .times .t .v { font-size: 4.6vh; }
body.tv .times .t .v small { font-size: 1.3vh; }
body.tv .times-head { font-size: 1.5vh; padding: 0 1.6vw; }
body.tv .jummah { padding: 1.6vh 1.6vw; font-size: 2.4vh; }
body.tv .jummah b { font-size: 3vh; }
body.tv .notice { font-size: 2.2vh; }
body.tv .chips { display: none; }
.tv-exit { display: none; }
body.tv .tv-exit { display: block; position: fixed; top: 10px; right: 12px; opacity: 0; transition: opacity .3s; }
body.tv:hover .tv-exit { opacity: .7; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero, .cta { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rule { grid-template-columns: 80px 1fr; }
  .rule .prev { grid-column: 1 / -1; }
  body.tv .hero { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid2, .grid3, .grid2-live { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .times .t { padding: 12px 14px; gap: 10px; }
  .times .t .v { font-size: 1.15rem; }
  .times-head { padding: 0 14px 2px; }
  .sticky-save { border-radius: 18px; flex-direction: column; align-items: stretch; padding: 12px; }
  .sticky-save .today-prev { display: none; }
}

/* ---------- print ---------- */
@media print {
  body.live { background: #fff; color: #000; }
  body.live * { color: #000 !important; background: none !important; border-color: #ccc !important; }
  .bar, .foot, .hero, .actions, .cta, #dirSection, .tabs, .btn, .no-print { display: none !important; }
  .month-wrap { max-height: none; overflow: visible; }
  .month th { position: static; }
  .print-title { display: block !important; }
}
.print-title { display: none; }

/* ---------- refinements ---------- */
.ar { unicode-bidi: isolate; }
.hero { align-items: start; }
.section > h2 select { font-size: .9rem; padding: 6px 12px; min-height: 38px; }
.glass.month-wrap { padding: 0 12px 8px; }
body.tv .tabs-row { display: none !important; }
body.tv .times .t { padding: 1.25vh 1.6vw; }
body.tv .times .t.now .nm::after { font-size: 1.3vh; }
body.tv .jummah, body.tv .notice { margin-top: 1vh; }
.soon { max-width: 560px; margin: 8vh auto; text-align: center; padding: 40px 28px; }
.soon h1 { font-weight: 600; font-size: clamp(1.4rem, 4vw, 2rem); margin: 10px 0; }
.soon-mark { font-size: 3rem; color: var(--gold); }
.switches { display: grid; gap: 4px; }
.switch { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: 0; }
.switch b { display: block; font-weight: 600; }
.switch span { color: var(--muted); font-size: .9rem; }
.switch.master b { font-size: 1.1rem; }
.toggle { position: relative; width: 52px; height: 30px; flex: none; }
.toggle input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; min-height: 0; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: #cfc9bb; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(22px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switches.off .switch:not(.master) { opacity: .45; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #c9c2b2; }
.status-dot.on { background: #2f9e6f; }
.switch b { color: var(--text); }
