:root {
  --ink: #070d18;
  --navy: #101a2c;
  --panel: #18253c;
  --gold: #d4b06a;
  --gold-2: #f0d7a0;
  --text: #f4efe6;
  --muted: #9aa6bf;
  --line: rgba(212, 176, 106, .28);
  --danger: #e07a6a;
  --ok: #8dcea8;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden { display: none !important; }
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  z-index: 0;
}

.auth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 16px 12px;
}
.logo {
  width: min(280px, 78vw);
  max-height: 160px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}
.glass {
  width: min(400px, 100%);
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.tab, button { font: inherit; cursor: pointer; }
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 9px;
  border-radius: 12px;
}
.tab.active {
  color: var(--gold-2);
  border-color: var(--line);
  background: rgba(212,176,106,.08);
}
input, select {
  width: 100%;
  background: rgba(7,13,24,.55);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 8px;
  font: inherit;
  font-size: 16px;
  outline: none;
}
input:focus, select:focus { border-color: var(--gold); }
.primary, .ghost {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}
.primary {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(180deg, #e3c37d, #c49a45);
  color: #1b1403;
}
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.error { color: var(--danger); min-height: 18px; font-size: 13px; margin: 0; }

.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(16,26,44,.94);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand-mini {
  display: flex;
  gap: 8px;
  align-items: center;
  background: none;
  border: 0;
  color: inherit;
  padding: 0;
  min-width: 0;
}
.logo-sm { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; flex-shrink: 0; }
.brand-mini strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.top-actions .ghost { width: auto; padding: 6px 10px; font-size: 13px; }
#hello { font-size: 12px; color: var(--muted); max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page { padding: 12px; max-width: 720px; margin: 0 auto; width: 100%; }
.toolbar { display: flex; margin-bottom: 10px; }
.toolbar .primary { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.cat, .room {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--navy);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
}
.cat { cursor: pointer; }
.cat b { font-size: 16px; }
.cat span, .room small { color: var(--muted); font-size: 12px; }
.room { grid-template-columns: auto 1fr auto; }
.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(212,176,106,.12);
  color: var(--gold-2);
  font-size: 14px;
}
.pill {
  display: inline-block;
  margin-right: 6px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--gold-2);
}
.pill.pub { color: var(--ok); border-color: rgba(141,206,168,.3); }
.room .primary { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,.72);
  display: grid;
  place-items: end center;
  z-index: 50;
  padding: 0;
}
.modal {
  width: 100%;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; margin-top: 10px; }
.modal-actions .primary, .modal-actions .ghost { flex: 1; width: auto; }

.meet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  display: grid;
  grid-template-rows: 48px 1fr;
}
.meet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #0c1422;
  border-bottom: 1px solid var(--line);
}
.meet-bar strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meet-bar .ghost { width: auto; padding: 6px 10px; font-size: 13px; }
#meet { height: 100%; min-height: 0; }

.sadaqa {
  margin-top: auto;
  width: 100%;
  text-align: center;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  color: var(--gold-2);
}
.sadaqa::before {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  margin: 0 auto 14px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.sadaqa p,
.sadaqa strong,
.sadaqa span {
  display: block;
  margin: 0;
}
.sadaqa p {
  font-size: 12px;
  color: var(--muted);
}
.sadaqa strong {
  font-family: Amiri, serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-2);
  margin: 6px 0 4px;
  line-height: 1.7;
}
.sadaqa span {
  font-family: Amiri, serif;
  font-size: 13px;
  color: #c4b48a;
}

@media (display-mode: standalone) {
  html, body { min-height: 100dvh; }
}

@media (min-width: 720px) {
  .logo { width: min(420px, 70vw); max-height: 240px; }
  .glass { padding: 24px; }
  .page { padding: 20px 18px 40px; max-width: 900px; }
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  #rooms.list { display: flex; flex-direction: column; }
  .overlay { place-items: center; padding: 16px; }
  .modal { width: min(420px, 100%); border-radius: 18px; padding: 22px; }
}
