/* ============ نور · Design tokens ============ */
:root{
  --canvas:#EFEAE0;
  --bg:#FAF6EF;
  --surface:#FFFFFF;
  --ink:#2B2620;
  --ink-2:#3A3226;
  --ink-3:#4A4235;
  --muted:#8A8272;
  --muted-2:#B3A98F;
  --line:#ECE5D6;
  --chip:#F0ECE2;

  --gold:#D9B970;
  --gold-soft:#F3E6C8;
  --gold-ink:#8A6E33;
  --sand:#EFE3D0;

  --green:#7FA37A;
  --green-soft:#EAF0E6;
  --green-ink:#3E5B3B;

  --blue:#6FA0C9;
  --blue-soft:#DCEAF6;
  --blue-ink:#3E6E93;

  --r-lg:28px;
  --r-md:22px;
  --r-sm:16px;
  --shadow-card:0 8px 20px rgba(43,38,32,.05);
  --shadow-soft:0 6px 16px rgba(43,38,32,.05);
  --shadow-deep:0 12px 24px rgba(43,38,32,.20);
  --safe-b:env(safe-area-inset-bottom,0px);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;
  background:var(--canvas);
  color:var(--ink);
  font-family:'IBM Plex Sans Arabic',-apple-system,BlinkMacSystemFont,'Segoe UI',Tahoma,sans-serif;
  font-size:15px;
  line-height:1.6;
  overscroll-behavior-y:none;
}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
input,select,textarea{font:inherit;color:inherit}
h1,h2,h3,p{margin:0}
::-webkit-scrollbar{width:0;height:0}

/* ============ Shell ============ */
.stage{min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:0}
.phone{
  position:relative;width:100%;max-width:430px;height:100dvh;
  background:var(--bg);display:flex;flex-direction:column;overflow:hidden;
}
@media (min-width:900px) and (min-height:800px){
  .stage{padding:32px}
  .phone{height:min(880px,94dvh);border-radius:44px;box-shadow:0 30px 60px rgba(43,38,32,.16)}
}
.view{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}
.screen{padding:calc(24px + env(safe-area-inset-top,0px)) 20px 24px;display:flex;flex-direction:column;gap:16px;animation:fade .32s ease both}
@keyframes fade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* ============ Tab bar ============ */
.tabbar{
  flex-shrink:0;height:calc(74px + var(--safe-b));padding-bottom:var(--safe-b);
  border-top:1px solid var(--line);background:var(--surface);
  display:flex;align-items:center;justify-content:space-around;padding-inline:6px;
}
.tab{display:flex;flex-direction:column;align-items:center;gap:4px;flex:1;padding:6px 0;transition:transform .15s}
.tab:active{transform:scale(.92)}
.tab svg{width:23px;height:23px;stroke:var(--muted-2);fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;transition:stroke .2s}
.tab span{font-size:10px;color:var(--muted-2);font-weight:500;transition:color .2s}
.tab.is-active svg{stroke:var(--green)}
.tab.is-active span{color:var(--green);font-weight:600}

/* ============ Type ============ */
.title{font-size:24px;font-weight:700;letter-spacing:-.2px}
.title-sm{font-size:22px;font-weight:700}
.section-h{font-size:14px;font-weight:600;color:var(--ink);display:flex;align-items:center;justify-content:space-between;gap:8px}
.muted{color:var(--muted)}
.tiny{font-size:11px;color:var(--muted)}
.small{font-size:12px;color:var(--muted)}
.num{font-variant-numeric:tabular-nums}

/* ============ Cards ============ */
.card{background:var(--surface);border-radius:var(--r-md);padding:16px;box-shadow:var(--shadow-card)}
.card-lg{border-radius:var(--r-lg);padding:18px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.row{display:flex;align-items:center;gap:10px}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:10px}
.stack{display:flex;flex-direction:column;gap:12px}
.tone-green{background:var(--green-soft)}
.tone-blue{background:var(--blue-soft)}
.tone-gold{background:var(--gold-soft)}
.tone-sand{background:var(--sand)}
.press{transition:transform .12s ease,box-shadow .12s ease}
.press:active{transform:scale(.975)}

/* ============ Buttons ============ */
.btn{
  height:56px;border-radius:28px;background:var(--ink);color:var(--bg);
  display:flex;align-items:center;justify-content:center;gap:8px;
  font-size:16px;font-weight:600;width:100%;transition:transform .12s,opacity .2s;
}
.btn:active{transform:scale(.97)}
.btn[disabled]{opacity:.4}
.btn-ghost{background:var(--chip);color:var(--ink)}
.btn-sm{height:44px;border-radius:22px;font-size:14px}
.btn-line{background:transparent;border:1.5px solid var(--line);color:var(--ink-3)}
.icon-btn{width:44px;height:44px;border-radius:22px;background:var(--chip);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.icon-btn svg{width:20px;height:20px;stroke:var(--ink-3);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chip{background:var(--chip);border-radius:14px;padding:8px 14px;font-size:13px;font-weight:500;color:var(--ink-3);transition:transform .12s}
.chip:active{transform:scale(.95)}
.chip.is-on{background:var(--gold-soft);color:var(--gold-ink);font-weight:600}

/* ============ Forms ============ */
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:12px;font-weight:600;color:var(--muted)}
.input{
  height:50px;border-radius:16px;background:var(--chip);border:1.5px solid transparent;
  padding:0 16px;width:100%;outline:none;transition:border-color .2s,background .2s;
}
textarea.input{height:auto;padding:14px 16px;resize:none;line-height:1.7}
.input:focus{border-color:var(--gold);background:var(--surface)}
.input::placeholder{color:var(--muted-2)}

/* ============ Avatar / logo ============ */
.noor{position:relative;display:flex;align-items:center;justify-content:center}
.noor .glow{position:absolute;inset:-12%;border-radius:50%;background:radial-gradient(circle,rgba(217,185,112,.35),rgba(217,185,112,0) 72%);animation:noorPulse 3s ease-in-out infinite}
@keyframes noorPulse{0%,100%{opacity:.55;transform:scale(1)}50%{opacity:.85;transform:scale(1.08)}}
.noor .ray{position:absolute;top:50%;left:50%;border-radius:50%;background:rgba(243,230,200,.85)}
.noor .orb{
  border-radius:50%;background:radial-gradient(circle at 35% 30%,#FFFDF7,#F3E6C8 60%,#E8D9C3 100%);
  box-shadow:0 10px 30px rgba(217,185,112,.35),inset 0 -8px 16px rgba(201,168,118,.25);
  display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;
}
.noor .shine{position:absolute;border-radius:50%;background:rgba(255,255,255,.7)}
.noor .eyes{display:flex}
.noor .eye{border-radius:50%;background:var(--ink-2)}
.noor .smile{border-bottom:3px solid var(--ink-2);border-radius:0 0 16px 16px}
.avatar{width:44px;height:44px;border-radius:22px;background:var(--gold-soft);display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--gold-ink);flex-shrink:0;overflow:hidden}

/* ============ Splash / onboarding ============ */
.splash{
  height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:28px;
  background:linear-gradient(180deg,#FAF6EF 0%,#F3ECDD 100%);
}
.splash .brand{font-size:40px;font-weight:700;letter-spacing:1px;animation:fade .8s .15s ease both}
.splash .tag{font-size:15px;color:var(--muted);font-weight:500;animation:fade .8s .3s ease both}
.onb{height:100%;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0px)}
.onb-body{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:30px;padding:0 36px;text-align:center}
.onb-body h2{font-size:27px;font-weight:700;line-height:1.45}
.onb-body p{font-size:15px;color:var(--muted);line-height:1.75}
.onb-foot{padding:0 28px calc(40px + var(--safe-b));display:flex;flex-direction:column;gap:20px;align-items:center}
.dots{display:flex;gap:8px}
.dots i{width:6px;height:6px;border-radius:3px;background:#E7E0D3;transition:width .3s,background .3s}
.dots i.on{width:20px;background:var(--ink)}
.onb-skip{position:absolute;top:calc(20px + env(safe-area-inset-top,0px));left:20px;font-size:13px;color:var(--muted);z-index:2}

/* ============ Home ============ */
.hero{
  background:linear-gradient(135deg,#2B2620,#3A3226);border-radius:var(--r-lg);padding:20px 22px;
  display:flex;align-items:center;justify-content:space-between;box-shadow:var(--shadow-deep);
}
.hero .k{font-size:12px;color:#D9CFBE}
.hero .v{font-size:32px;font-weight:700;color:var(--bg);line-height:1.2}
.hero .s{font-size:12px;color:#B9AF9B}
.ring{transform:rotate(-90deg)}
.ring circle{transition:stroke-dashoffset .6s cubic-bezier(.4,0,.2,1)}
.ring-wrap{position:relative;display:grid;place-items:center}
.ring-label{position:absolute;text-align:center;line-height:1.25}

.check{
  width:22px;height:22px;border-radius:11px;border:1.8px solid #DCD5C6;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;transition:background .2s,border-color .2s,transform .12s;
}
.check svg{width:12px;height:12px;stroke:#fff;stroke-width:2.6;fill:none;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.5);transition:.2s}
.check.on{background:var(--green);border-color:var(--green)}
.check.on svg{opacity:1;transform:none}
.check-row{display:flex;align-items:center;gap:10px;padding:5px 0;width:100%;text-align:start}
.check-row span{font-size:14px;color:var(--ink-3);transition:color .2s,text-decoration-color .2s}
.check-row.done span{color:var(--muted-2);text-decoration:line-through;text-decoration-color:var(--muted-2)}

.prayers{display:flex;gap:6px;width:100%}
.prayer{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px}
.prayer i{width:100%;height:5px;border-radius:3px;background:#C7E0F0;display:block;transition:background .2s}
.prayer.on i{background:var(--blue)}
.prayer b{font-size:10px;font-weight:500;color:var(--muted)}
.prayer.on b{color:var(--blue-ink);font-weight:600}

.qa{display:flex;gap:10px}
.qa button{flex:1;background:var(--surface);border-radius:18px;padding:12px 4px;display:flex;flex-direction:column;align-items:center;gap:6px;box-shadow:var(--shadow-soft)}
.qa .dot{width:30px;height:30px;border-radius:15px;display:grid;place-items:center}
.qa .dot svg{width:16px;height:16px;stroke:var(--ink-2);fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.qa b{font-size:11px;color:var(--ink-3);font-weight:500}

/* ============ Quran ============ */
.juz-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
.juz{aspect-ratio:1;border-radius:12px;background:var(--chip);color:var(--muted-2);display:grid;place-items:center;font-size:12px;font-weight:600;transition:transform .12s,background .2s,color .2s}
.juz:active{transform:scale(.9)}
.juz.on{background:var(--green-soft);color:var(--green-ink)}
.surah-chips{display:flex;gap:10px}
.surah-chips button{flex:1;border-radius:16px;padding:10px;text-align:center;font-size:13px;font-weight:600}

/* ============ Dhikr ============ */
.counter{
  position:relative;width:min(260px,72vw);aspect-ratio:1;display:grid;place-items:center;margin:4px auto 0;
}
.counter svg{position:absolute;inset:0;width:100%;height:100%}
.counter-btn{
  width:73%;height:73%;border-radius:50%;background:var(--surface);
  box-shadow:0 14px 30px rgba(43,38,32,.10);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  transition:transform .1s ease,box-shadow .1s;
}
.counter-btn:active{transform:scale(.94);box-shadow:0 6px 14px rgba(43,38,32,.12)}
.counter-btn .n{font-size:52px;font-weight:700;line-height:1.1}
.counter-btn .t{font-size:13px;color:var(--muted)}
.bars{display:flex;gap:8px;align-items:flex-end;height:78px}
.bars .b{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.bars .b i{width:100%;border-radius:8px;background:var(--gold-soft);display:block;min-height:5px;transition:height .4s}
.bars .b i.hi{background:var(--gold)}
.bars .b em{font-size:10px;color:var(--muted);font-style:normal}
.wrap-chips{display:flex;flex-wrap:wrap;gap:8px}

/* ============ Goals ============ */
.goals-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.goal{background:var(--surface);border-radius:var(--r-md);overflow:hidden;box-shadow:var(--shadow-card);display:flex;flex-direction:column;text-align:start}
.goal .thumb{height:86px;display:grid;place-items:center;background-size:cover;background-position:center;position:relative}
.goal .thumb span{font-size:22px;opacity:.6}
.goal .b{padding:10px;display:flex;flex-direction:column;gap:6px;flex:1}
.goal .b h4{font-size:13px;font-weight:600;margin:0;line-height:1.4}
.goal .b p{font-size:10px;color:var(--muted);line-height:1.5;flex:1}
.pbar{height:5px;border-radius:3px;background:#EDE7D9;overflow:hidden}
.pbar i{display:block;height:100%;border-radius:3px;transition:width .4s}
.add-tile{
  border:1.5px dashed #DCD5C6;border-radius:var(--r-md);min-height:150px;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:8px;color:var(--muted);font-size:13px;font-weight:600;
}
.add-tile svg{width:26px;height:26px;stroke:var(--muted-2);fill:none;stroke-width:1.8;stroke-linecap:round}

/* ============ Weight / meals ============ */
.meal{background:var(--surface);border-radius:var(--r-sm);padding:12px 14px;display:flex;justify-content:space-between;align-items:center;gap:10px;box-shadow:0 6px 14px rgba(43,38,32,.04)}
.stepper{display:flex;align-items:center;gap:12px}
.stepper button{width:34px;height:34px;border-radius:17px;background:var(--chip);font-size:20px;font-weight:600;line-height:1;display:grid;place-items:center;color:var(--ink-3)}
.note{border-radius:18px;padding:14px 16px;font-size:12px;line-height:1.7}

/* ============ Achievements ============ */
.badges{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.badge{border-radius:20px;padding:16px 12px;display:flex;flex-direction:column;align-items:center;gap:10px;box-shadow:var(--shadow-soft);text-align:center}
.badge.locked{opacity:.5}
.badge .ic{width:44px;height:44px;border-radius:22px;display:grid;place-items:center;font-size:20px}
.badge h4{font-size:11px;font-weight:600;line-height:1.4;margin:0}

/* ============ More / settings ============ */
.list{background:var(--surface);border-radius:var(--r-md);overflow:hidden;box-shadow:var(--shadow-card)}
.list-item{display:flex;align-items:center;gap:12px;padding:14px 16px;width:100%;text-align:start;border-bottom:1px solid var(--line)}
.list-item:last-child{border-bottom:0}
.list-item .ic{width:34px;height:34px;border-radius:17px;display:grid;place-items:center;flex-shrink:0}
.list-item .ic svg{width:17px;height:17px;stroke:var(--ink-2);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.list-item b{font-size:14px;font-weight:500;flex:1}
.list-item .val{font-size:13px;color:var(--muted)}

/* ============ Switch ============ */
.switch{width:46px;height:27px;border-radius:14px;background:#DCD5C6;position:relative;flex-shrink:0;transition:background .22s}
.switch i{position:absolute;top:3px;inset-inline-start:3px;width:21px;height:21px;border-radius:11px;background:#fff;box-shadow:0 2px 5px rgba(43,38,32,.22);transition:transform .22s}
.switch.on{background:var(--green)}
.switch.on i{transform:translateX(-19px)}
[dir="ltr"] .switch.on i{transform:translateX(19px)}
.list-item .check{margin-inline-end:0}
select.input{appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(16px) calc(50% - 2px),calc(21px) calc(50% - 2px);background-size:5px 5px,5px 5px;background-repeat:no-repeat}

/* ============ Sheet ============ */
.sheet{position:fixed;inset:0;z-index:50;display:flex;align-items:flex-end;justify-content:center}
.sheet[hidden],.toast[hidden]{display:none}
.sheet-backdrop{position:absolute;inset:0;background:rgba(43,38,32,.42);animation:fade .2s ease both}
.sheet-panel{
  position:relative;width:100%;max-width:430px;background:var(--bg);
  border-radius:28px 28px 0 0;padding:10px 20px calc(24px + var(--safe-b));
  max-height:88dvh;overflow-y:auto;animation:up .3s cubic-bezier(.32,.72,0,1) both;
}
@keyframes up{from{transform:translateY(100%)}to{transform:none}}
.sheet-grip{width:40px;height:4px;border-radius:2px;background:#DCD5C6;margin:0 auto 14px}
.sheet h3{font-size:18px;font-weight:700;margin-bottom:14px}
.sheet-form{display:flex;flex-direction:column;gap:14px}

/* ============ Toast ============ */
.toast{
  position:fixed;bottom:calc(100px + var(--safe-b));left:50%;transform:translateX(-50%);z-index:60;
  background:var(--ink);color:var(--bg);padding:11px 20px;border-radius:22px;font-size:13px;font-weight:500;
  box-shadow:var(--shadow-deep);animation:fade .22s ease both;max-width:86%;text-align:center;
}

.empty{text-align:center;color:var(--muted);font-size:13px;padding:28px 10px;line-height:1.8}
.hidden{display:none !important}
@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms !important;transition-duration:.01ms !important}}
