/* ==========================================================================
   منصة نادي تحفيظ القرآن الكريم — نظام التصميم
   ========================================================================== */

:root {
  --brand: #0e6b50;
  --brand-600: #0b5a43;
  --brand-700: #094a37;
  --brand-800: #07392b;
  --brand-50: #eaf4ef;
  --brand-100: #d2e9de;
  --gold: #b8892b;
  --gold-600: #9a7020;
  --gold-50: #fbf4e3;
  --ink: #15211c;
  --ink-2: #34433c;
  --muted: #66746d;
  --line: #e1e7e3;
  --line-2: #eef2ef;
  --bg: #f4f6f2;
  --card: #ffffff;
  --ok: #157f3c;
  --ok-50: #e7f6ec;
  --bad: #c03b16;
  --bad-50: #fdede7;
  --warn: #a95f06;
  --warn-50: #fdf3df;
  --info: #1e55c9;
  --info-50: #e9effc;
  --violet: #6d3fc9;
  --violet-50: #f1ebfd;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17, 33, 26, .05), 0 3px 10px rgba(17, 33, 26, .04);
  --shadow-lg: 0 10px 40px rgba(10, 30, 22, .18);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-quran: "Amiri", "Traditional Arabic", serif;
  --side-w: 264px;
  --top-h: 62px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0 0 .6em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(14, 107, 80, .35); outline-offset: 2px; }
::selection { background: var(--brand-100); }
.num, .ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { display: inline-block; vertical-align: -4px; width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }
.flip-rtl { transform: scaleX(-1); }

/* ---------- الهيكل العام ---------- */
.app { min-height: 100vh; display: flex; }
.side {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w);
  background: linear-gradient(180deg, var(--brand-800), var(--brand-700) 40%, #0a5540);
  color: #e8f3ee; display: flex; flex-direction: column; z-index: 40;
  overflow-y: auto; overscroll-behavior: contain;
}
.side-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-logo { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; overflow: hidden; }
.side-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.side-title { font-weight: 700; font-size: 14px; line-height: 1.45; color: #fff; }
.side-sub { font-size: 12px; color: #a9cdbd; }
.side-nav { padding: 10px 10px 20px; display: flex; flex-direction: column; gap: 2px; }
.side-nav .sep { font-size: 11.5px; color: #8fbcaa; padding: 14px 12px 4px; letter-spacing: .2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #d9ebe3; font-weight: 500; font-size: 14.5px; text-decoration: none; position: relative;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.side-nav a.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--gold); }
.side-nav .count { margin-inline-start: auto; background: var(--gold); color: #fff; border-radius: 99px; font-size: 11.5px; padding: 0 8px; line-height: 20px; }
.side-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: #8fbcaa; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #cfe6dc; }

.main { flex: 1 1 auto; min-width: 0; margin-inline-start: var(--side-w); display: flex; flex-direction: column; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 22px;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-title { font-weight: 700; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-date { font-size: 12.5px; color: var(--muted); line-height: 1.35; text-align: end; }
.top-menu-btn { display: none; }
.top .club-switch { max-width: 240px; height: 38px; font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.user-chip .av { width: 30px; height: 30px; font-size: 13px; }
.user-chip .nm { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { padding: 22px; width: 100%; max-width: 1280px; margin: 0 auto; flex: 1 1 auto; }
.view:focus { outline: none; }
.tabbar { display: none; }
.drawer-backdrop { display: none; }

body.bare .side, body.bare .top, body.bare .tabbar { display: none !important; }
body.bare .main { margin: 0; }
body.bare .view { max-width: none; padding: 0; }

/* ---------- عناصر عامة ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; margin-bottom: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 15.5px; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: 6px; }
.card-body { padding: 16px 18px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f6f8f7; border-color: #cfd8d3; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-600); border-color: var(--gold-600); }
.btn-danger { background: #fff; border-color: #f1c7b9; color: var(--bad); }
.btn-danger:hover { background: var(--bad-50); }
.btn-danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(14,107,80,.07); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.b-ok { background: var(--ok-50); color: var(--ok); }
.b-bad { background: var(--bad-50); color: var(--bad); }
.b-warn { background: var(--warn-50); color: var(--warn); }
.b-info { background: var(--info-50); color: var(--info); }
.b-gold { background: var(--gold-50); color: var(--gold-600); }
.b-violet { background: var(--violet-50); color: var(--violet); }
.b-brand { background: var(--brand-50); color: var(--brand); }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; background: #f1f4f2; color: var(--ink-2); border: 1px solid var(--line); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand)); }
button.chip { cursor: pointer; }
button.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand); flex: none; font-size: 15px; }
.av.f { background: #b4582b; }
.av.m { background: #0e6b50; }
.av-lg { width: 64px; height: 64px; font-size: 24px; }

/* ---------- النماذج ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.fld .req { color: var(--bad); margin-inline-start: 3px; }
.fld .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.inp, .fld input:not([type=checkbox]):not([type=radio]), .fld select, .fld textarea, select.inp {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid #d3dcd7; border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s, box-shadow .15s; font-size: 15px;
}
.fld textarea, textarea.inp { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.inp:focus, .fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,107,80,.14); }
.fld input[type=date], .fld input[type=time], .fld input[type=month], .fld input[type=number], .fld input[type=tel], input.numfield { direction: ltr; text-align: right; }
.inp-sm { height: 36px !important; font-size: 13.5px !important; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check.box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.check.box:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 8px 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 99px; background: #cfd8d3; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-start .2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { inset-inline-start: 21px; }
.seg { display: inline-flex; background: #eef2ef; border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label, .seg button { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; border: 0; background: transparent; }
.seg input:checked + span, .seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input:focus-visible + span { outline: 3px solid rgba(14,107,80,.35); }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; background: #fff; }
fieldset.section > legend { padding: 0 8px; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--brand-700); }
.consent-text { background: #f7f9f8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); max-height: 180px; overflow: auto; white-space: pre-line; }
.searchbox { position: relative; flex: 1 1 220px; min-width: 0; }
.searchbox .ico { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox input { padding-inline-start: 40px !important; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { height: 42px; border: 1px solid #d3dcd7; border-radius: 10px; padding: 0 12px; background: #fff; min-width: 0; }
.filters .searchbox input { width: 100%; }

/* ---------- البطاقات الإحصائية ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow); text-decoration: none !important; color: inherit; }
.kpi .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.kpi .ic.gold { background: var(--gold-50); color: var(--gold-600); }
.kpi .ic.info { background: var(--info-50); color: var(--info); }
.kpi .ic.bad { background: var(--bad-50); color: var(--bad); }
.kpi .ic.violet { background: var(--violet-50); color: var(--violet); }
.kpi .lb { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .vl { font-size: 25px; font-weight: 700; line-height: 1.25; letter-spacing: -.3px; }
.kpi .vl small { font-size: 13px; color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.kpi .sb { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- القوائم والجداول ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; min-width: 0; }
.li:last-child { border-bottom: 0; }
a.li:hover, button.li:hover { background: #f8faf9; }
button.li { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-2); text-align: start; cursor: pointer; font: inherit; }
.li .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 12.5px; color: var(--muted); }
.li .end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty .ico { width: 42px; height: 42px; margin: 0 auto 10px; color: #b5c4bc; stroke-width: 1.4; }
.empty h3 { color: var(--ink-2); font-size: 15.5px; margin-bottom: 4px; }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 600; background: #f6f8f7; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.tbl td.small, .tbl td.wrap { white-space: normal; min-width: 170px; }
.tbl tbody tr:hover { background: #fafcfb; }
.tbl tr.clickable { cursor: pointer; }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; }
.tbl tfoot td { font-weight: 700; background: #f6f8f7; }

.bar { height: 8px; border-radius: 99px; background: #e8eeea; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #2a9d74); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold), #d9ac4f); }
.bar.lg { height: 12px; }
.ring { --p: 0; --c: var(--brand); width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e6ece8 0); flex: none; }
.ring > div { width: 86px; height: 86px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; line-height: 1.2; }
.ring b { font-size: 20px; }
.ring span { font-size: 11px; color: var(--muted); display: block; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.tabs .on { color: var(--brand); border-bottom-color: var(--brand); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 14px; margin-bottom: 14px; }
.alert .ico { margin-top: 2px; }
.alert-info { background: var(--info-50); border-color: #c9d8f7; color: #1b3f8f; }
.alert-warn { background: var(--warn-50); border-color: #f2d9a8; color: #7a4705; }
.alert-ok { background: var(--ok-50); border-color: #bfe4cb; color: #0f5e2c; }
.alert-bad { background: var(--bad-50); border-color: #f3c5b5; color: #8e2a0e; }
.alert .grow p:last-child { margin: 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- لوحة القيادة ---------- */
.hello { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding: 20px 22px; border-radius: 18px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #158a66 0%, var(--brand-700) 55%, var(--brand-800) 100%); position: relative; overflow: hidden; }
.hello::after { content: ""; position: absolute; inset: 0; background-image: url("../img/pattern.svg"); background-size: 120px; opacity: .09; pointer-events: none; }
.hello h1 { font-size: 21px; }
.hello .d { color: #cfe8dd; font-size: 13.5px; }
.hello .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.hello .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.hello .btn:hover { background: rgba(255,255,255,.22); }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.setup-step { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed #c8d5ce; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; text-decoration: none !important; background: #fff; }
.setup-step.done { border-style: solid; border-color: #bfe4cb; background: var(--ok-50); color: var(--ok); }
.setup-step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 13px; flex: none; }
.setup-step.done .n { background: var(--ok); color: #fff; }

.session-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.session-item:last-child { border-bottom: 0; }
.session-item .time { font-weight: 700; font-size: 13.5px; min-width: 92px; color: var(--brand-700); }
.color-strip { width: 5px; align-self: stretch; border-radius: 4px; background: var(--c, var(--brand)); flex: none; }

/* ---------- الأفواج ---------- */
.group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.group-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); color: inherit; text-decoration: none !important; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.group-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--c, var(--brand)); }
.group-card:hover { border-color: #c9d6cf; }
.group-card h3 { font-size: 16px; }
.group-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.group-card .sched { font-size: 12.5px; color: var(--muted); }
.group-card.archived { opacity: .65; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label input { position: absolute; opacity: 0; }
.swatches label span { width: 32px; height: 32px; border-radius: 50%; display: block; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches label input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.sched-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }

/* ---------- الحضور ---------- */
.att-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.date-nav { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.date-nav input { border: 0; height: 36px; background: transparent; direction: ltr; padding: 0 6px; font-weight: 600; }
.att-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.att-row:last-child { border-bottom: 0; }
.att-row .who { flex: 1 1 160px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.att-row .who .t { font-weight: 600; }
.att-btns { display: flex; gap: 6px; flex: none; }
.att-btn { min-width: 58px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); padding: 0 8px; }
.att-btn:hover { border-color: #b9c8c0; }
.att-btn.on.present { background: var(--ok); border-color: var(--ok); color: #fff; }
.att-btn.on.absent { background: var(--bad); border-color: var(--bad); color: #fff; }
.att-btn.on.late { background: var(--warn); border-color: var(--warn); color: #fff; }
.att-btn.on.excused { background: var(--info); border-color: var(--info); color: #fff; }
.att-note { flex-basis: 100%; }
.st-present { color: var(--ok); } .st-absent { color: var(--bad); } .st-late { color: var(--warn); } .st-excused { color: var(--info); }
.sticky-save { position: sticky; bottom: 12px; z-index: 20; margin-top: 16px; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); }
.sticky-save .msg { font-size: 13.5px; color: var(--muted); }
.sticky-save.dirty .msg { color: var(--warn); font-weight: 600; }

/* ---------- الحفظ ---------- */
.memo-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.memo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.memo-card .top-line { display: flex; align-items: center; gap: 10px; }
.memo-card .next { font-size: 13px; background: var(--gold-50); color: #6f4f12; border-radius: 9px; padding: 6px 10px; }
.memo-card .today { display: flex; flex-wrap: wrap; gap: 6px; }
.grade { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; border-radius: 7px; font-size: 12.5px; font-weight: 700; background: var(--line-2); }
.grade.g-ex { background: #d8f2e1; color: #0c5f2b; }
.grade.g-vg { background: #e1f0e8; color: #17694a; }
.grade.g-g { background: #eef3d9; color: #586b0b; }
.grade.g-ok { background: #fdf0d6; color: #8a5a06; }
.grade.g-re { background: #fde3da; color: #a1310f; }
.juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.juz { aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); background: #eef2ef; position: relative; overflow: hidden; }
.juz i { position: absolute; inset-inline: 0; bottom: 0; background: rgba(14,107,80,.28); }
.juz.full { background: var(--brand); color: #fff; }
.juz span { position: relative; }
.surah-prog { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.grade-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.grade-btns button { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.grade-btns button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.quick-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.range-grid { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }

/* ---------- الإعلانات والجدول ---------- */
.ann { padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.ann:last-child { border-bottom: 0; }
.ann h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ann .body { white-space: pre-line; color: var(--ink-2); font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }
.ann .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.ann.pinned { background: linear-gradient(90deg, rgba(184,137,43,.06), transparent 60%); }
.event { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.event:last-child { border-bottom: 0; }
.date-badge { width: 56px; flex: none; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.date-badge b { display: block; font-size: 20px; line-height: 1.5; }
.date-badge span { display: block; background: var(--brand); color: #fff; font-size: 11.5px; padding: 2px 0; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-col { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 120px; overflow: hidden; }
.day-col h4 { font-size: 13.5px; padding: 8px 10px; background: #f6f8f7; border-bottom: 1px solid var(--line); }
.day-col.today h4 { background: var(--brand); color: #fff; }
.slot { margin: 8px; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, var(--c, #0e6b50) 10%, #fff); border-inline-start: 4px solid var(--c, var(--brand)); font-size: 12.5px; }
.slot b { display: block; font-size: 13px; color: var(--ink); }

/* ---------- النوافذ ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(9, 26, 19, .48); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .4; } }
.dialog { background: #fff; border-radius: 18px; width: 100%; max-width: 620px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .18s ease-out; }
.dialog.lg { max-width: 860px; }
.dialog.sm { max-width: 440px; }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.dialog-head h2 { font-size: 17px; }
.dialog-head .x { margin-inline-start: auto; }
.dialog-body { padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); justify-content: flex-end; flex-wrap: wrap; }
.dialog-foot .start { margin-inline-end: auto; }
.toasts { position: fixed; z-index: 200; bottom: 20px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; max-width: 520px; padding: 12px 16px; border-radius: 12px; background: #13261e; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: up .2s ease-out; }
.toast.err { background: #8e2a0e; }
.toast.ok .ico { color: #6fe0a1; }
.menu { position: absolute; z-index: 120; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: start; color: var(--ink); font-size: 14px; text-decoration: none !important; }
.menu button:hover, .menu a:hover { background: #f3f6f4; }
.menu .danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.cred-box { background: var(--gold-50); border: 1px dashed var(--gold); border-radius: 12px; padding: 14px; font-size: 15px; }
.cred-box .v { font-weight: 700; font-size: 18px; letter-spacing: .5px; direction: ltr; display: inline-block; }

.loading-view { padding: 50px 0; display: grid; place-items: center; color: var(--muted); gap: 10px; }
.loader { width: 34px; height: 34px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.skel { background: linear-gradient(90deg, #edf1ee 25%, #f6f8f7 50%, #edf1ee 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- صفحات الدخول والعامة ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; background: radial-gradient(130% 120% at 100% 0%, #15926b 0%, var(--brand-700) 45%, var(--brand-800) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: url("../img/pattern.svg"); background-size: 150px; opacity: .1; pointer-events: none; }
.auth-art > * { position: relative; z-index: 1; }
.auth-art .emblem { width: 84px; height: 84px; border-radius: 22px; background: rgba(255,255,255,.12); display: grid; place-items: center; overflow: hidden; }
.auth-art .emblem img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.auth-art h1 { font-family: var(--font-quran); font-size: 38px; line-height: 1.45; margin-top: 26px; font-weight: 700; }
.auth-art .tag { color: #cfe8dd; font-size: 16px; margin-top: 8px; }
.auth-art .verse { font-family: var(--font-quran); font-size: 24px; line-height: 1.9; color: #f3e3b9; }
.auth-art .verse small { display: block; font-family: var(--font); font-size: 12.5px; color: #a9cdbd; }
.auth-art ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; color: #dcefe6; font-size: 14.5px; }
.auth-art li { display: flex; gap: 10px; align-items: center; }
.auth-art li .ico { color: #f3d58a; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 23px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 20px; }
.auth-card form { display: grid; gap: 14px; }
.auth-mobile-head { display: none; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 22px; font-size: 13.5px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 46px !important; }
.pw-wrap button { position: absolute; inset-inline-end: 4px; top: 4px; height: 36px; width: 38px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }

.public { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }
.public-head { display: flex; gap: 16px; align-items: center; padding: 22px; border-radius: 18px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, #158a66 0%, var(--brand-700) 55%, var(--brand-800) 100%); margin-bottom: 18px; position: relative; overflow: hidden; }
.public-head::after { content: ""; position: absolute; inset: 0; background-image: url("../img/pattern.svg"); background-size: 120px; opacity: .09; }
.public-head > * { position: relative; z-index: 1; }
.public-head .emblem { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.14); display: grid; place-items: center; overflow: hidden; flex: none; }
.public-head .emblem img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.public-head h1 { font-size: 20px; }
.public-head p { margin: 2px 0 0; color: #cfe8dd; font-size: 14px; }
.child-block { border: 1px dashed #c4d3cb; border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fbfcfb; }
.child-block .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; color: var(--brand-700); }
.prose h2 { font-size: 17px; margin: 22px 0 8px; color: var(--brand-700); }
.prose p, .prose li { color: var(--ink-2); line-height: 1.9; }
.prose ul { padding-inline-start: 22px; }

/* ---------- فضاء الولي ---------- */
.parent-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.parent-top .emblem { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; background: var(--brand-50); display: grid; place-items: center; flex: none; }
.parent-top .emblem img { width: 100%; height: 100%; object-fit: contain; }
.parent-view { max-width: 920px; margin: 0 auto; padding: 18px 16px 50px; }
.child-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none !important; }
.child-card:hover { border-color: #c9d6cf; }

/* ---------- الورقة المطبوعة ---------- */
.paper-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.paper-scroll { overflow-x: auto; padding-bottom: 6px; }
.paper { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 12mm 13mm; box-shadow: 0 2px 18px rgba(0,0,0,.09); color: #111; font-size: 12.5px; line-height: 1.55; }
.paper.landscape { width: 297mm; min-height: 210mm; }
.paper.auto { min-height: 0; }
.paper-head { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--brand); margin-bottom: 12px; }
.paper-head .logo { width: 60px; height: 60px; object-fit: contain; flex: none; }
.paper-head .logo-ph { width: 60px; height: 60px; flex: none; }
.paper-head .club { font-family: var(--font-quran); font-size: 19px; font-weight: 700; line-height: 1.4; color: var(--brand-800); }
.paper-head .info { font-size: 11px; color: #555; }
.paper-head .meta { margin-inline-start: auto; text-align: end; font-size: 11px; color: #555; flex: none; }
.paper h1 { font-size: 17px; text-align: center; margin: 4px 0 2px; }
.paper .ptitle-sub { text-align: center; color: #555; font-size: 12px; margin-bottom: 12px; }
.paper h2 { font-size: 13.5px; margin: 14px 0 6px; color: var(--brand-800); }
.ptbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ptbl th, .ptbl td { border: 1px solid #bfc9c4; padding: 4px 6px; text-align: start; vertical-align: middle; }
.ptbl th { background: #e9f1ed; font-weight: 700; }
.ptbl tfoot td { background: #f4f7f5; font-weight: 700; }
.ptbl tr { page-break-inside: avoid; break-inside: avoid; }
.ptbl.att td, .ptbl.att th { padding: 3px 2px; text-align: center; font-size: 10.5px; }
.ptbl.att td.nm, .ptbl.att th.nm { text-align: start; padding-inline: 5px; white-space: nowrap; }
.ptbl .c { text-align: center; }
.pkv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; font-size: 12px; margin-bottom: 8px; }
.pkv div { border-bottom: 1px dotted #c7cfcb; padding: 3px 0; display: flex; gap: 8px; }
.pkv b { color: #444; font-weight: 600; flex: none; }
.pstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.pstats div { border: 1px solid #cdd6d1; border-radius: 8px; padding: 8px; text-align: center; }
.pstats b { display: block; font-size: 17px; color: var(--brand-800); }
.pstats span { font-size: 11px; color: #555; }
.paper-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #cdd6d1; font-size: 10.5px; color: #666; display: flex; justify-content: space-between; gap: 10px; }
.sign-row { display: flex; justify-content: space-between; gap: 30px; margin-top: 26px; font-size: 12px; }
.sign-row div { flex: 1; text-align: center; }
.sign-row div span { display: block; margin-top: 46px; border-top: 1px dotted #888; padding-top: 4px; color: #555; }
.receipt { border: 1.5px solid #8aa597; border-radius: 10px; padding: 9mm 9mm 7mm; position: relative; margin-top: 3mm; }
.receipt + .cut { border-top: 1.5px dashed #999; margin: 9mm 0; position: relative; text-align: center; font-size: 10px; color: #888; }
.receipt .rh { display: flex; align-items: center; gap: 12px; border-bottom: 1.5px solid var(--brand); padding-bottom: 8px; margin-bottom: 10px; }
.receipt .rh img { width: 52px; height: 52px; object-fit: contain; }
.receipt .rno { margin-inline-start: auto; text-align: center; border: 1.5px solid var(--brand); border-radius: 8px; padding: 4px 12px; }
.receipt .rno b { display: block; font-size: 15px; direction: ltr; }
.receipt .amount-box { display: flex; align-items: center; gap: 14px; border: 1px solid #cdd6d1; border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: #f6faf8; }
.receipt .amount-box .fig { font-size: 21px; font-weight: 800; color: var(--brand-800); direction: ltr; white-space: nowrap; }
.receipt .copy-tag { position: absolute; top: -10px; inset-inline-start: 18px; background: #fff; padding: 0 8px; font-size: 10.5px; color: #555; font-weight: 700; }
.receipt .void-stamp { position: absolute; top: 40%; inset-inline: 0; text-align: center; font-size: 46px; font-weight: 900; color: rgba(192,59,22,.28); transform: rotate(-12deg); letter-spacing: 6px; pointer-events: none; }
.access-card { width: 90mm; border: 1.5px solid var(--brand); border-radius: 10px; padding: 7mm; margin: 0 auto; }
.form-line { border-bottom: 1px dotted #888; min-height: 22px; display: flex; align-items: flex-end; padding: 2px 4px; font-weight: 600; }
.pbox { display: inline-block; width: 12px; height: 12px; border: 1.3px solid #333; border-radius: 2px; vertical-align: -2px; margin-inline-end: 6px; text-align: center; line-height: 10px; font-size: 11px; }

#print-sheet { display: none; }

/* ---------- الطباعة ---------- */
@media print {
  @page { size: A4; margin: 11mm 12mm; }
  body.printing > *:not(#print-sheet) { display: none !important; }
  body.printing #print-sheet { display: block !important; }
  body { background: #fff !important; }
  #print-sheet .paper, #print-sheet .paper.landscape { box-shadow: none; margin: 0; padding: 0; width: auto; min-height: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print { display: none !important; }
}

/* ---------- الشاشات المتوسطة ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- الهاتف واللوحي ---------- */
@media (max-width: 960px) {
  :root { --side-w: 280px; }
  .side { transform: translateX(105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.drawer-open .side { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(9,26,19,.45); z-index: 35; }
  .main { margin: 0; padding-bottom: calc(var(--tab-h) + var(--safe-b)); }
  .top { padding: 0 12px; height: 58px; }
  .top-menu-btn { display: inline-flex; }
  .top-date, .top .club-switch, .user-chip .nm { display: none; }
  .view { padding: 16px; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; inset-inline: 0; bottom: 0;
    height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px rgba(0,0,0,.05);
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none !important; border: 0; background: none; cursor: pointer; position: relative; }
  .tabbar .ico { width: 23px; height: 23px; }
  .tabbar .active { color: var(--brand); }
  .tabbar .active::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar .count { position: absolute; top: 6px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; line-height: 16px; }
  .toasts { bottom: calc(var(--tab-h) + var(--safe-b) + 12px); }
  .sticky-save { bottom: calc(var(--tab-h) + var(--safe-b) + 10px); }
  body.bare .main { padding-bottom: 0; }
  .week { grid-template-columns: 1fr; }
  .day-col { min-height: 0; }
  .day-col:not(.has) { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-mobile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 22px; }
  .auth-mobile-head .emblem { width: 72px; height: 72px; border-radius: 20px; background: var(--brand); display: grid; place-items: center; overflow: hidden; color: #fff; }
  .auth-mobile-head .emblem img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
  .auth-mobile-head h1 { font-family: var(--font-quran); font-size: 24px; color: var(--brand-800); line-height: 1.5; }
  .auth-form { align-items: flex-start; padding-top: 34px; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 19px; }
  .page-head .actions { margin-inline-start: 0; width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .kpi .ic { width: 36px; height: 36px; border-radius: 10px; }
  .kpi .vl { font-size: 21px; }
  .hello { padding: 16px; border-radius: 16px; }
  .hello h1 { font-size: 18px; }
  .hello .actions { width: 100%; margin: 0; }
  .card-pad, .card-body { padding: 14px; }
  .card-head { padding: 12px 14px; }
  .li { padding: 12px 14px; }
  /* الجداول تتحول إلى بطاقات */
  .tbl.stack-m thead { display: none; }
  .tbl.stack-m, .tbl.stack-m tbody, .tbl.stack-m tr, .tbl.stack-m td { display: block; width: 100%; }
  .tbl.stack-m tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .tbl.stack-m td { white-space: normal; min-width: 0; border: 0; padding: 3px 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: end; }
  .tbl.stack-m td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; text-align: start; flex: none; }
  .tbl.stack-m td.main-cell { font-size: 15px; justify-content: flex-start; text-align: start; }
  .tbl.stack-m td.main-cell::before { display: none; }
  .tbl.stack-m td:empty { display: none; }
  .tbl.stack-m tfoot { display: block; }
  .tbl.stack-m .acts { justify-content: flex-start; }
  .overlay { padding: 0; align-items: flex-end; }
  .dialog, .dialog.lg, .dialog.sm { max-width: none; border-radius: 20px 20px 0 0; max-height: 94vh; animation: up .2s ease-out; }
  .dialog-body { padding: 16px; }
  .dialog-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .dialog-foot .btn { flex: 1 1 auto; }
  .dialog-foot .start { margin: 0; }
  .att-row { padding: 10px 12px; }
  .att-btns { width: 100%; }
  .att-btn { flex: 1; min-width: 0; height: 42px; }
  .juz-grid { grid-template-columns: repeat(6, 1fr); }
  .sched-row { grid-template-columns: 1fr 1fr; }
  .sched-row select { grid-column: 1 / -1; }
  .memo-cards, .group-cards { grid-template-columns: 1fr; }
  .paper-scroll { margin: 0 -16px; padding: 0 16px 6px; }
  .filters > * { flex: 1 1 140px; }
  .filters .searchbox { flex-basis: 100%; }
  .surah-prog { grid-template-columns: 96px 1fr auto; }
}
