:root{
  --primary:#2F6BFF; --primary2:#4BA3FF;
  --bg:#EEF5FF; --text:#0E1B3D; --muted:#5B6B8C;
  --shadow:0 18px 40px rgba(8,20,45,.12);
}
*{box-sizing:border-box}
html,body{height:100%}
html{background:linear-gradient(135deg,var(--primary),var(--primary2));}
body{
  margin:0;
  font-family:"Cairo",-apple-system,BlinkMacSystemFont,system-ui;
  background:
    radial-gradient(900px 700px at 14% 0%, #ffffff 0%, var(--bg) 58%, #eaf1ff 100%),
    radial-gradient(700px 500px at 90% 20%, rgba(47,107,255,.12) 0%, rgba(47,107,255,0) 60%);
  color:var(--text);
}
.wrap{min-height:100%;display:grid;place-items:center;padding:20px 14px}
.card{
  width:min(520px, calc(100vw - 28px));
  background:rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.55);
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:16px;
  backdrop-filter: blur(10px);
}
.brand{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.logo{
  width:44px;height:44px;border-radius:16px;
  background:rgba(47,107,255,.12);
  border:1px solid rgba(47,107,255,.22);
  display:grid;place-items:center;font-weight:1000;
}
h1{margin:0;font-size:18px;font-weight:1000}
.sub{color:var(--muted);font-weight:900;font-size:12px;margin-top:4px}
.row{display:grid;gap:8px;margin:10px 0}
label{font-size:12px;font-weight:900;color:var(--muted)}
.input{
  width:100%; padding:12px; border-radius:14px;
  border:1px solid rgba(14,27,61,.12);
  background:rgba(255,255,255,.96);
  outline:none; font-weight:900;
  font-size:16px;
}
.btn{
  width:100%;
  border:0;border-radius:14px;
  padding:12px 14px;
  font-weight:1000;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:#fff;
}
.btn.ghost{background:rgba(14,27,61,.06);color:var(--text);border:1px solid rgba(14,27,61,.10)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.hr{height:1px;background:rgba(14,27,61,.08);margin:12px 0}
.muted{color:var(--muted);font-weight:900;font-size:12px}
.toast{
  position:fixed; left:14px;
  bottom:calc(14px + env(safe-area-inset-bottom));
  padding:10px 12px;
  background:rgba(14,27,61,.92);
  color:#fff;
  border-radius:14px;
  box-shadow:0 14px 34px rgba(8,20,45,.22);
  z-index:999;
  font-weight:900;
  max-width:calc(100vw - 28px);
}
.hidden{display:none !important}
.list{display:grid;gap:10px;margin-top:10px}
.app{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:12px;border-radius:16px;
  border:1px solid rgba(14,27,61,.10);
  background:rgba(255,255,255,.86);
}
.app b{font-size:14px}
.app .go{padding:10px 12px;border-radius:14px;border:0;background:rgba(47,107,255,.12);font-weight:1000}
.topRow{display:flex;justify-content:space-between;align-items:center;gap:10px}
.smallBtn{padding:10px 12px;border-radius:14px;border:1px solid rgba(14,27,61,.10);background:rgba(14,27,61,.06);font-weight:1000}
.lock{
  position:fixed; inset:0;
  background: rgba(8,20,45,.55);
  backdrop-filter: blur(6px);
  display:grid; place-items:center;
  z-index: 1000;
}
.lock__card{
  width:min(420px, calc(100vw - 28px));
  background: rgba(255,255,255,.96);
  border:1px solid rgba(255,255,255,.45);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
  text-align:center;
}
.lock__title{ font-weight:1000; font-size:20px; margin-bottom:6px; }
.lock__sub{ color: var(--muted); font-weight:900; margin-bottom:10px; }
.lock__pin{ text-align:center; letter-spacing: .35em; font-weight:1000; }
.lock__err{ margin-top:10px; color: #FF4D6D; }

/* UX polish */
.logoImg{ width:46px;height:46px;border-radius:16px; box-shadow:0 10px 22px rgba(47,128,237,.18); }
.card{ animation: cardIn .28s ease both; }
@keyframes cardIn{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:translateY(0); } }
.btn{ transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
.btn:active{ transform: scale(.985); }
.smallBtn:active{ transform: scale(.985); }
.app{ transition: transform .18s ease, box-shadow .18s ease; }
.app:hover{ transform: translateY(-1px); box-shadow:0 14px 34px rgba(8,20,45,.12); }
.topRow h1{ letter-spacing:.2px; }

/* subtle background bubbles */
.wrap::before{
  content:"";
  position:fixed; inset:-120px;
  background:
    radial-gradient(320px 240px at 20% 10%, rgba(86,204,242,.22) 0%, rgba(86,204,242,0) 60%),
    radial-gradient(280px 240px at 85% 15%, rgba(47,128,237,.20) 0%, rgba(47,128,237,0) 62%),
    radial-gradient(360px 260px at 30% 90%, rgba(47,128,237,.12) 0%, rgba(47,128,237,0) 60%);
  pointer-events:none;
  filter: blur(0px);
  animation: floatBg 8s ease-in-out infinite;
  opacity:.9;
}
@keyframes floatBg{
  0%,100%{ transform: translateY(0px); }
  50%{ transform: translateY(-10px); }
}

/* iPhone-friendly page transition */
.pageFadeWrap{
  transition: opacity .22s ease, transform .22s ease;
  will-change: opacity, transform;
}
.pageFadeOut{
  opacity: 0;
  transform: translateY(10px);
}
.btn[disabled]{ opacity:.7; }

.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight:1000;
  font-size:12px;
  background: rgba(14,27,61,.06);
  border: 1px solid rgba(14,27,61,.10);
}
.badge.ok{ background: rgba(25,195,125,.12); border-color: rgba(25,195,125,.22); }
.badge.warn{ background: rgba(255,196,0,.14); border-color: rgba(255,196,0,.24); }
.badge.bad{ background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.22); }

.not-standalone::before{
  content:"📲 أضف SAJiL إلى الشاشة الرئيسية لتجربة تطبيق كاملة";
  position:fixed;
  bottom:16px;
  left:16px;
  right:16px;
  background:#2F80ED;
  color:#fff;
  padding:12px;
  border-radius:14px;
  text-align:center;
  z-index:9999;
}
