/* موقع المهرة: ألوان الشعار (كحلي ورملي) على أرضية فاتحة، بطابع نظيف */
:root {
  --navy: #02385F; --navy-dark: #012640; --navy-soft: #E8EEF3;
  --sand: #998779; --sand-soft: #F1ECE7; --sand-ink: #6B5A4C;
  --ground: #F5F5F7; --card: #FFFFFF; --paper: #FFFDF9; --paper-line: #EDE6DE;
  --ink: #1D1D1F; --muted: #6E6E73; --line: #D1D1D6; --track: #E5E5EA;
  --err: #A1271F; --err-soft: #FBECEA; --warn: #8A5A00; --warn-mark: #B07400; --warn-soft: #FBF1DE;
  --ok: #1E6B3A; --ok-soft: #E6F0E9;
  --radius: 18px;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); text-decoration: none; }
.quran { font-family: 'Amiri Quran', serif; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 96px; }

/* الرأس */
.top { padding: 24px 20px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { position: relative; width: 118px; height: 50px; overflow: hidden; flex-shrink: 0; }
.logo img { position: absolute; width: 322px; height: 322px; right: -126px; top: -136px; }
.date-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.date-pick span { font-size: 13px; color: var(--muted); }
.date-pick input { border: none; background: none; font-weight: 600; font-size: 15px; padding: 0; color: var(--ink); }

.title { padding: 6px 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.title h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.3px; }
.title p { margin: 0; font-size: 15px; color: var(--muted); }
.bar { margin-top: 10px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 6px; background: var(--navy); border-radius: 3px; transition: width .4s ease; }

/* قائمة الطلاب */
.list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 14px; background: var(--card); border: none; border-radius: var(--radius); padding: 14px 16px; min-height: 72px; width: 100%; text-align: right; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .15s ease; }
.row:active { transform: scale(.985); }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--navy-soft); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 17px; flex-shrink: 0; }
.row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .who b { font-size: 17px; font-weight: 600; }
.row .who small { font-size: 13px; color: var(--muted); }
.pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 12px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.todo { background: var(--sand-soft); color: var(--sand-ink); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* شاشة التسجيل */
.head { padding: 20px 16px 10px; display: flex; align-items: center; gap: 12px; }
.back { width: 44px; height: 44px; border-radius: 22px; background: var(--card); border: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.head .who { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.head .who b { font-size: 20px; font-weight: 700; }
.head .who small { font-size: 13px; color: var(--muted); }

.seg { display: flex; background: #E8E8ED; border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: none; background: transparent; border-radius: 9px; padding: 8px 10px; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--muted); transition: background .15s ease, color .15s ease; }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.card { margin: 10px 16px 0; background: var(--card); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.card .lbl { font-size: 13px; color: var(--muted); }

.tabs { padding: 6px 16px 0; display: flex; gap: 8px; }
.tabs button { flex: 1; min-height: 46px; border: none; border-radius: 14px; font-size: 15px; font-weight: 600; background: var(--card); color: var(--ink); position: relative; }
.tabs button.on { background: var(--navy); color: #fff; }
.tabs button .dot { position: absolute; top: 8px; left: 10px; width: 7px; height: 7px; border-radius: 4px; background: var(--sand); }

.range { display: flex; gap: 8px; }
.range button { flex: 1; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: #F9F9FB; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 12px; gap: 1px; }
.range button small { font-size: 11px; color: var(--muted); }
.range button b { font-size: 15px; font-weight: 600; color: var(--navy); }
.range button.picking { border-color: var(--navy); background: var(--navy-soft); }
.hint { font-size: 12px; color: var(--navy); background: var(--navy-soft); border-radius: 10px; padding: 8px 10px; }

/* المصحف */
.mushaf { margin: 10px 16px 0; background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.mushaf .bar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mushaf .bar-top button { min-width: 44px; min-height: 44px; border-radius: 12px; border: none; background: transparent; color: var(--navy); font-size: 14px; font-weight: 600; }
.mushaf .where { font-size: 13px; color: var(--sand); font-weight: 600; text-align: center; flex: 1; }
.mushaf .surah-head { text-align: center; font-size: 15px; color: var(--sand-ink); background: var(--sand-soft); border-radius: 10px; padding: 6px; margin: 6px 0 2px; font-weight: 600; }
.mushaf .basmala { text-align: center; font-size: 20px; color: var(--navy); padding: 2px 0 4px; }
.ayah { display: block; width: 100%; text-align: right; border: none; border-radius: 12px; padding: 4px 8px; background: transparent; font-size: 21px; line-height: 2.05; color: var(--ink); transition: background .15s ease; }
.ayah.in { background: #F3EEE8; }
.ayah.sel { background: #E4ECF4; }
.ayah .w { border-bottom: 2.5px solid transparent; padding-bottom: 1px; }
.ayah .w.e { color: var(--err); border-bottom-color: var(--err); }
.ayah .w.n { color: var(--warn-mark); border-bottom-color: var(--warn-mark); }
.ayah .num { color: var(--sand); font-size: 18px; }
.goto { display: flex; gap: 8px; }
.goto select, .goto input { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #F9F9FB; padding: 0 10px; font-size: 15px; }
.goto select { flex: 1; }
.goto input { width: 80px; }

/* الشريط السفلي */
.foot { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(245,245,247,.92); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid rgba(0,0,0,.06); }
.foot .in { max-width: 560px; margin: 0 auto; padding: 12px 16px 20px; display: flex; gap: 10px; align-items: center; }
.foot .tally { display: flex; flex-direction: column; gap: 2px; min-width: 96px; }
.foot .tally small { font-size: 12px; color: var(--muted); }
.foot .tally b { font-size: 14px; }
.primary { flex: 1; min-height: 50px; border: none; border-radius: 16px; background: var(--navy); color: #fff; font-size: 17px; font-weight: 600; transition: background .15s ease; }
.primary:hover { background: var(--navy-dark); }
.primary:disabled { opacity: .5; }

/* النافذة السفلية */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.18); animation: fade .2s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 10px 18px 26px; box-shadow: 0 -8px 30px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 14px; animation: up .25s cubic-bezier(.2,.8,.2,1); max-height: 80vh; overflow: auto; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.sheet .row2 { display: flex; justify-content: space-between; align-items: center; }
.sheet .row2 b { font-size: 17px; }
.link { min-height: 44px; border: none; background: none; color: var(--navy); font-size: 15px; font-weight: 600; }
.types { display: flex; gap: 10px; }
.types button { flex: 1; min-height: 48px; border-radius: 14px; font-size: 16px; font-weight: 600; background: #fff; }
.types .e { border: 1.5px solid var(--err); color: var(--err); }
.types .e.on { background: var(--err); color: #fff; }
.types .n { border: 1.5px solid var(--warn-mark); color: var(--warn); }
.types .n.on { background: var(--warn-mark); color: #fff; }
.words { display: flex; flex-wrap: wrap; gap: 8px; }
.words button { min-height: 44px; padding: 4px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 19px; }
.words button.e { background: var(--err); border-color: var(--err); color: #fff; }
.words button.n { background: var(--warn-mark); border-color: var(--warn-mark); color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); padding: 0 12px; font-size: 15px; background: #F9F9FB; color: var(--ink); }

/* الدخول */
.login { margin: 40px 16px; background: var(--card); border-radius: 22px; padding: 26px 20px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 24px; }
.login p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; animation: fade .2s ease; z-index: 10; }
.demo { margin: 0 16px 10px; font-size: 12px; color: var(--sand-ink); background: var(--sand-soft); border-radius: 10px; padding: 8px 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 15px; }
.credit { text-align: center; font-size: 11px; color: var(--muted); padding: 18px 0 0; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes up { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
