@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --bg:#17130F;
  --surface:#1F1A14;
  --surface-2:#241E17;
  --ink:#F3ECE1;
  --ink-muted:#B8AA97;
  --border:#33291E;
  --accent:#FF6B3D;
  --accent-ink:#1B0D06;
  --accent-soft:#3A2015;
  --ok:#5FD07E;
  --live-red:#E5484D;
  --nav-h:64px;
  --header-pad: env(safe-area-inset-top, 0px);
  --bottom-pad: env(safe-area-inset-bottom, 0px);
  --max:720px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.brand,.brand-mini{ font-family:'Archivo', system-ui, sans-serif; }
p{ margin:0 0 8px; }
.muted{ color:var(--ink-muted); }
.small{ font-size:12.5px; }
.hidden,[hidden]{ display:none !important; }

.screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.login-card{
  width:100%;
  max-width:340px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  padding:28px 24px;
}
.brand{ font-weight:800; font-size:22px; margin-bottom:8px; }
.brand-mini{ font-weight:800; font-size:16px; }
#login-form{ display:flex; flex-direction:column; gap:10px; margin-top:16px; }

input[type="password"], input[type="text"], input[type="search"], input[type="file"], select, textarea{
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--ink);
  border-radius:12px;
  padding:12px 14px;
  font-size:16px;
  font-family:inherit;
  width:100%;
}
input:focus, select:focus{ outline:2px solid var(--accent); outline-offset:1px; }

button{ font-family:inherit; cursor:pointer; border:none; }
.primary-btn, .secondary-btn, .ghost-btn, .play-now-btn{
  border-radius:12px;
  padding:12px 16px;
  font-size:14.5px;
  font-weight:600;
}
.primary-btn, .play-now-btn{
  background:var(--accent);
  color:var(--accent-ink);
}
.play-now-btn{ width:100%; margin-top:10px; }
.play-now-btn:disabled{ opacity:.55; cursor:not-allowed; }
.secondary-btn{
  background:var(--surface-2);
  color:var(--ink);
  border:1px solid var(--border) !important;
}
.ghost-btn{
  background:transparent;
  color:var(--ink-muted);
  border:1px solid var(--border) !important;
}
.tiny-btn{ padding:6px 10px; font-size:12px; }
.danger-ish{ border-color:#5a2a2a !important; }
.error{ color:var(--live-red); font-size:13px; margin-top:10px; }
.feedback{
  background:var(--accent-soft);
  color:var(--accent);
  border-radius:12px;
  padding:12px 14px;
  margin-bottom:12px;
  font-weight:600;
}
.feedback.error-fb{ background:#3a1515; color:#ff8f8f; }

.app{
  min-height:100vh;
  max-width:var(--max);
  margin:0 auto;
  padding-bottom:calc(var(--nav-h) + var(--bottom-pad) + 16px);
}
.app-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:calc(12px + var(--header-pad)) 16px 8px;
}
.station-bar{
  padding:4px 16px 12px;
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.station-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--ink-muted);
  width:100%;
}
.station-select{
  flex:1;
  min-width:0;
  min-height:44px;
  font-weight:700;
  font-size:16px;
  background:var(--surface);
  border-radius:10px;
  border:1px solid var(--border);
  color:var(--ink);
  padding:8px 12px;
}

.main{ padding:0 16px 16px; }
.view{ display:none; }
.view.active{ display:block; }
.view-head{ margin:4px 0 14px; }
.view-head h1{ margin:0 0 4px; font-size:22px; }

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  margin-bottom:14px;
}
.card h3{ margin:0 0 10px; font-size:15px; }
.muted-card{ opacity:.95; }
.summary-card{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.summary-card .big{ font-size:28px; font-weight:800; }

.now-card .now-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--ink-muted);
  margin-bottom:10px;
}
.now-row{ display:flex; gap:14px; align-items:center; }
.np-art{
  width:72px; height:72px; border-radius:12px;
  object-fit:cover; background:var(--surface-2); flex:none;
}
.np-art.is-placeholder{
  background:linear-gradient(135deg, var(--surface-2), var(--accent-soft));
  opacity:.4;
}
.np-art:not(.is-placeholder){ opacity:1; }
.now-meta{ min-width:0; flex:1; }
.now-meta h2{
  font-size:18px; margin:2px 0 0;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.now-meta p{ margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.badge{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px; font-weight:600;
  padding:2px 8px; border-radius:100px;
}
.badge.live{ background:var(--live-red); color:#fff; }

.progress-wrap{ margin-top:14px; }
.progress-bar{
  height:6px; border-radius:100px; background:var(--surface-2); overflow:hidden;
}
.progress-fill{
  height:100%; width:0%; background:var(--accent); border-radius:100px;
  transition:width .4s linear;
}
.progress-times{
  display:flex; justify-content:space-between;
  font-family:'IBM Plex Mono', monospace;
  font-size:11px; color:var(--ink-muted); margin-top:6px;
}

.stat-row{ display:flex; gap:8px; margin-top:14px; }
.stat{
  flex:1; background:var(--surface-2); border-radius:10px; padding:10px 8px; text-align:center;
}
.stat .k, .status-chip .k, .summary-card .k{
  display:block; font-size:10px; color:var(--ink-muted);
  font-family:'IBM Plex Mono', monospace; text-transform:uppercase; letter-spacing:.05em;
}
.stat .v{ font-weight:700; font-size:13px; }
.stat .v.ok, .status-chip .v.ok{ color:var(--ok); }
.stat .v.bad, .status-chip .v.bad{ color:var(--live-red); }

.hero-cta{
  width:100%;
  display:flex; flex-direction:column; align-items:flex-start; gap:4px;
  text-align:left;
  background:linear-gradient(135deg, var(--accent) 0%, #ff8f5c 100%);
  color:var(--accent-ink);
  border-radius:18px;
  padding:22px 20px;
  margin-bottom:14px;
}
.hero-cta-title{ font-family:'Archivo', sans-serif; font-size:22px; font-weight:800; }
.hero-cta-sub{ font-size:13px; opacity:.85; }

.card-list{ list-style:none; margin:0; padding:0; }
.card-list > li{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 16px;
  margin-bottom:10px;
}
.card-list .item-title{ font-weight:700; font-size:15px; }
.card-list .item-sub{ color:var(--ink-muted); font-size:12.5px; margin-top:2px; }
.card-list .item-row{ display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.card-list button.row-hit{
  width:100%; background:transparent; color:inherit; text-align:left; padding:0;
}
.pill{
  font-size:11px; font-weight:600; padding:3px 8px; border-radius:100px;
  background:var(--surface-2); color:var(--ink-muted); flex:none;
}
.pill.on{ background:var(--accent-soft); color:var(--accent); }

.simple-list{ list-style:none; margin:0; padding:0; }
.simple-list li{
  padding:8px 0; border-top:1px solid var(--border);
  font-size:14px; display:flex; justify-content:space-between; gap:8px;
}
.simple-list li:first-child{ border-top:none; }

.ip-card .ip{
  font-family:'IBM Plex Mono', monospace;
  font-size:16px; font-weight:600; letter-spacing:.02em;
}

.status-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.status-chip{
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:10px; padding:10px 12px;
}
.status-chip .v{ font-weight:700; font-size:14px; }
.btn-row{ display:flex; flex-wrap:wrap; gap:8px; }
.search-input{ margin-bottom:12px; }
.stack-form{ display:flex; flex-direction:column; gap:10px; }
.danger-text-btn{
  background:transparent;
  color:#e08a8a;
  border:1px solid #5a2a2a !important;
  border-radius:10px;
  padding:8px 12px;
  font-size:12.5px;
  font-weight:600;
  margin-top:8px;
  width:100%;
}
.home-ezan-card{
  width:100%;
  text-align:left;
  cursor:pointer;
  color:inherit;
  margin-top:10px;
}
.home-ezan-card.is-pause{
  border-color:rgba(220,80,80,.4);
  background:rgba(220,80,80,.08);
}
.home-ezan-card.is-approaching{
  border-color:rgba(220,150,40,.4);
  background:rgba(220,150,40,.08);
}
.home-ezan-main{
  font-size:16px;
  font-weight:700;
  margin:6px 0 4px;
}
.ezan-status-card{
  margin-bottom:14px;
}
.ezan-status-card.is-normal{ border-color:rgba(95,208,126,.28); }
.ezan-status-card.is-approaching{ border-color:rgba(220,150,40,.4); background:rgba(220,150,40,.08); }
.ezan-status-card.is-pause{ border-color:rgba(220,80,80,.4); background:rgba(220,80,80,.08); }
.ezan-status-title{ font-size:18px; font-weight:800; margin-bottom:8px; }
.ezan-status-line{ margin:4px 0; font-size:14px; }
.ezan-countdown{ font-size:20px; font-weight:800; margin-top:10px; }
.ezan-today-list{ list-style:none; margin:0; padding:0; }
.ezan-pray-row{
  display:flex;
  justify-content:space-between;
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:15px;
}
.ezan-pray-row.is-past{ opacity:.45; }
.ezan-pray-row.is-next{ font-weight:800; color:var(--accent); }
.ezan-pray-time{ font-family:'IBM Plex Mono', monospace; }
.ezan-health-warn{
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(220,150,40,.12);
  border:1px solid rgba(220,150,40,.35);
  font-size:13px;
}
.home-stores-kpi{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:8px 0 6px;
}
.home-stores-main{
  font-size:18px;
  font-weight:700;
}
.stores-kpi-card{ margin-bottom:14px; }
.stores-kpi-main{
  font-size:22px;
  font-weight:800;
  letter-spacing:-.01em;
  line-height:1.2;
}
.stores-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
@media (min-width:700px){
  .stores-grid{ grid-template-columns:1fr 1fr; }
}
.store-card{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 14px 12px;
  background:rgba(255,255,255,.03);
}
.store-card.is-offline,
.store-card.is-alarm{
  border-color:rgba(220,80,80,.35);
  background:rgba(220,80,80,.06);
}
.store-card.is-prayer{
  border-color:rgba(80,140,200,.4);
  background:rgba(80,140,200,.08);
}
.store-card.is-prayer .store-status{ color:#6BA3D6; }
.store-card.is-prayer-recovery{
  border-color:rgba(220,180,40,.4);
  background:rgba(220,180,40,.08);
}
.store-card.is-prayer-recovery .store-status{ color:#D4A017; }
.store-card.is-online{
  border-color:rgba(95,208,126,.28);
  background:rgba(95,208,126,.05);
}
.store-card.is-alarm .store-status,
.store-card.is-offline .store-status{ color:#E07070; }
.store-card.is-short .store-status{ color:#D4A017; }
.store-card.is-online .store-status{ color:var(--ok); }
.store-events-list .store-event-hit{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  margin-bottom:8px;
  list-style:none;
}
.store-card-title{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:4px;
}
.store-dot{ font-size:14px; line-height:1; }
.store-name{
  font-weight:800;
  font-size:17px;
}
.store-status{
  font-size:14px;
  font-weight:600;
  margin-top:2px;
}
.store-conn{
  font-size:13px;
  margin-top:4px;
  color:var(--ink-muted);
}
.store-ip{
  margin-top:8px;
  font-family:'IBM Plex Mono', monospace;
  letter-spacing:.02em;
}
.section-label{
  font-size:13px;
  margin:16px 0 8px;
  color:var(--ink-muted);
  text-transform:uppercase;
  letter-spacing:.04em;
  font-family:'IBM Plex Mono', monospace;
}
.summary-line{ display:flex; align-items:baseline; gap:8px; }
.ip{
  font-family:'IBM Plex Mono', monospace;
  font-size:14px;
  font-weight:600;
  letter-spacing:.02em;
  margin-top:4px;
}
.unknown-hit{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  margin-bottom:8px;
  list-style:none;
}

/* Bottom nav — no horizontal page scrollbars */
.bottom-nav{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:0;
  width:100%;
  max-width:var(--max);
  height:calc(var(--nav-h) + var(--bottom-pad));
  padding:6px 4px var(--bottom-pad);
  display:flex;
  justify-content:space-between;
  gap:0;
  background:rgba(23,19,15,.96);
  border-top:1px solid var(--border);
  backdrop-filter:blur(10px);
  z-index:50;
}
.nav-item{
  flex:1;
  min-width:0;
  background:transparent;
  color:var(--ink-muted);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  padding:6px 2px;
  font-size:10px;
  font-weight:600;
}
.nav-item .nav-ico{ font-size:15px; line-height:1; }
.nav-item.active{ color:var(--accent); }

@media (min-width:640px){
  :root{ --nav-h:68px; }
  .nav-item{ font-size:11px; }
  .np-art{ width:88px; height:88px; }
  .hero-cta-title{ font-size:24px; }
  .main{ padding:0 20px 20px; }
}

@media (min-width:900px){
  body{ background:#120f0c; }
  .app{
    margin-top:12px;
    border:1px solid var(--border);
    border-radius:20px 20px 0 0;
    background:var(--bg);
    min-height:calc(100vh - 12px);
  }
}

/* EZAN-3 settings */
.ezan-field{ display:flex; justify-content:space-between; align-items:center; gap:12px; margin:10px 0; font-size:14px; }
.ezan-field input[type=number]{ width:88px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); background:var(--surface-2); color:var(--ink); }
.ezan-check-list{ display:flex; flex-direction:column; gap:8px; margin:8px 0 14px; }
.ezan-check-list label{ display:flex; gap:8px; align-items:flex-start; font-size:14px; }
.ezan-subh{ margin:16px 0 6px; font-size:15px; }
.ezan-upload-result{ white-space:pre-wrap; background:var(--surface-2); padding:10px; border-radius:8px; max-height:180px; overflow:auto; }
.small-btn{ padding:6px 10px; font-size:12px; margin-left:8px; }

.ezan-station-row{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  margin:10px 0;
  background:var(--surface-2);
}
.ezan-station-title{ font-weight:600; margin-bottom:6px; }
.ezan-station-badge{ margin:6px 0; font-size:13px; }

/* MOBIL-1 */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); border:0;
}
.offline-banner{
  position:sticky; top:0; z-index:80;
  display:flex; flex-wrap:wrap; gap:6px 12px; align-items:center;
  padding:10px 14px;
  padding-top:calc(10px + env(safe-area-inset-top, 0px));
  background:#5c2b1a; color:#f8e8de; font-size:13px;
}
.offline-banner[hidden]{ display:none !important; }
.sw-update-banner{
  position:fixed; left:50%; transform:translateX(-50%);
  bottom:calc(var(--nav-h) + var(--bottom-pad) + 12px);
  z-index:70; max-width:calc(100% - 24px);
  display:flex; gap:10px; align-items:center;
  padding:10px 14px; border-radius:12px;
  background:var(--surface); border:1px solid var(--border);
  box-shadow:0 8px 24px rgba(0,0,0,.35);
}
.sw-update-banner[hidden]{ display:none !important; }
.station-bar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:8px 16px;
}
.station-select{
  flex:1; min-width:0; min-height:44px; font-size:16px;
  border-radius:10px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--ink); padding:8px 12px;
}
.station-loading{ white-space:nowrap; }
.primary-btn, .secondary-btn, .hero-cta, .nav-item{
  min-height:44px;
}
.nav-item{ padding:8px 4px; font-size:11px; }
.nav-item .nav-ico{ font-size:18px; }
.more-sheet{
  position:fixed; inset:0; z-index:60;
}
.more-sheet[hidden]{ display:none !important; }
.more-sheet-backdrop{
  position:absolute; inset:0; background:rgba(0,0,0,.45);
}
.more-sheet-panel{
  position:absolute; left:50%; transform:translateX(-50%);
  bottom:0; width:100%; max-width:var(--max);
  padding:16px 16px calc(16px + var(--bottom-pad));
  background:var(--surface); border-radius:18px 18px 0 0;
  border-top:1px solid var(--border);
  display:flex; flex-direction:column; gap:8px;
}
.more-sheet-title{ font-weight:700; margin:0 0 4px; }
.more-sheet-item{
  min-height:48px; text-align:left; padding:12px 14px;
  border-radius:12px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--ink); font-size:16px;
}
.more-sheet-item.ghost{ background:transparent; }
body.is-offline [data-requires-online]{ opacity:.45; pointer-events:none; }
.hero-cta.is-disabled-offline{ opacity:.45; pointer-events:none; }
.home-freshness{ margin-top:8px; }
.ezan-field input[type=number],
.ezan-field input[type=text],
input, select, button.primary-btn, button.secondary-btn{
  font-size:16px;
}
.login-card input{
  min-height:48px; font-size:16px; width:100%;
  border-radius:10px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--ink); padding:12px;
}
/* Prefer fixing width without relying on overflow:hidden alone */
.app, .main, .card, .now-card, .bottom-nav{
  max-width:100%;
}
.now-meta h2, .now-meta p{
  max-width:100%;
}
.ezan-acc{ margin-bottom:12px; }
.ezan-acc > summary{
  list-style:none; cursor:pointer; font-weight:700; font-size:16px;
  padding:12px 4px; min-height:44px; display:flex; align-items:center;
}
.ezan-acc > summary::-webkit-details-marker{ display:none; }
.ezan-acc > summary::before{ content:'▸ '; color:var(--accent); }
.ezan-acc[open] > summary::before{ content:'▾ '; }
