/* متجر المكافآت المدرسي — تصميم RTL بدون مكتبات أو خطوط خارجية */
:root {
  --bg: #f4f7f3;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #12261c;
  --ink-2: #2e4339;
  --muted: #5f7168;
  --line: #e1e8e2;
  --line-2: #cfd9d1;
  --primary: #0f7a55;
  --primary-600: #0b6446;
  --primary-700: #084c35;
  --primary-50: #e7f4ed;
  --primary-100: #cfe9db;
  --gold: #e3a008;
  --gold-600: #b77f00;
  --gold-50: #fff6dc;
  --red: #c53030;
  --red-50: #fdecec;
  --amber: #b45309;
  --amber-50: #fff3e0;
  --blue: #1d4ed8;
  --blue-50: #e8effe;
  --violet: #6d28d9;
  --violet-50: #f1ebfe;
  --dark: #12261c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(18, 38, 28, .06);
  --shadow: 0 1px 2px rgba(18, 38, 28, .05), 0 8px 24px -12px rgba(18, 38, 28, .18);
  --shadow-lg: 0 24px 48px -20px rgba(18, 38, 28, .35);
  --font: "Segoe UI", "Noto Sans Arabic", "Noto Kufi Arabic", Tahoma, "Geeza Pro", "Arial", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--ink); background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--dark); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; color: #fff; }
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 780px; margin-inline: auto; }
.muted { color: var(--muted); }
.strong { font-weight: 700; color: var(--ink); }
.block { display: block; }
.center { text-align: center; }
.right { display: flex; justify-content: flex-start; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.upper { text-transform: uppercase; }
.inline { display: inline; margin: 0; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-between.wrap, .card-head.wrap { flex-wrap: wrap; }
.req { color: var(--red); }
.plus { color: var(--primary); }
.minus { color: var(--red); }
b.plus, b.minus, .chip, .ltr-num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.error-text { color: var(--red); }
.wrap-text { white-space: normal; word-break: break-word; max-width: 420px; }

/* ===== الأزرار ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s; white-space: nowrap; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(15, 122, 85, .7); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-gold { background: var(--gold); color: #2b1d00; box-shadow: 0 6px 16px -8px rgba(227, 160, 8, .8); }
.btn-gold:hover { background: #f0ae12; color: #2b1d00; }
.btn-outline { border-color: var(--line-2); background: var(--surface); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--primary-50); color: var(--primary-700); }
.btn-ghost.danger:hover, .danger:hover { background: var(--red-50); color: var(--red); }
.btn-danger-outline { border-color: #f1c4c4; color: var(--red); background: var(--surface); }
.btn-danger-outline:hover { background: var(--red-50); color: var(--red); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; }

/* ===== النماذج ===== */
label { font-weight: 700; font-size: 14px; color: var(--ink-2); }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 10px 12px; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
input[type="file"] { padding: 8px; min-height: 0; background: var(--surface-2); }
input[type="checkbox"] { width: auto; min-height: 0; }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[dir="ltr"] { text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 800; padding: 0 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 6px; cursor: pointer; }
.field-icon { position: relative; display: flex; align-items: center; flex: 1; min-width: 180px; }
.field-icon .icon { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.field-icon input { padding-inline-start: 38px; }
.password-field { display: flex; gap: 6px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 160px; }
.self-end { align-self: end; padding-bottom: 8px; }

.switch { display: flex; align-items: flex-start; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 46px; height: 26px; border-radius: 99px; background: var(--line-2); flex: none; transition: background .2s; margin-top: 1px; }
.switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start .2s; }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { inset-inline-start: 23px; }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--primary-100); outline-offset: 2px; }
.switch input:disabled + .switch-ui { opacity: .5; }
.switch small { font-weight: 400; }

/* ===== البطاقات والشبكات ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card .pad, .card-head.pad { padding: 16px 20px 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-title { font-size: 17px; display: flex; align-items: center; gap: 8px; margin: 0; }
.grid-2, .grid-3, .grid-2-1, .grid-1-2 { display: grid; gap: 14px; }
.gap-lg { gap: 20px; margin-bottom: 20px; }
.span-2 { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1 { grid-template-columns: 2fr 1fr; }
  .grid-1-2 { grid-template-columns: minmax(280px, 1fr) 2fr; align-items: start; }
}

/* ===== الشارات ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-lg { font-size: 14px; padding: 4px 14px; }
.badge-green { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.badge-red { background: var(--red-50); color: var(--red); border-color: #f5cccc; }
.badge-amber { background: var(--amber-50); color: var(--amber); border-color: #f8dcb5; }
.badge-blue { background: var(--blue-50); color: var(--blue); border-color: #cddbfb; }
.badge-violet { background: var(--violet-50); color: var(--violet); border-color: #ddd0fb; }
.badge-gray { background: #f1f3f2; color: var(--muted); }

/* ===== التنبيهات ===== */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.admin-main .flash-stack { max-width: none; padding-inline: 24px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-weight: 600; }
.alert > .icon { margin-top: 3px; }
.alert > div { flex: 1; }
.alert-success { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.alert-error { background: var(--red-50); border-color: #f5cccc; color: #9b2222; }
.alert-info { background: var(--blue-50); border-color: #cddbfb; color: #1e3a8a; }
.alert-warning { background: var(--amber-50); border-color: #f8dcb5; color: #8a3f06; }
.alert a { color: inherit; text-decoration: underline; }
.alert-close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; opacity: .6; }
.alert-close:hover { opacity: 1; }
.admin-content > .alert { margin-bottom: 16px; }

/* ===== الشريط العلوي ===== */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-700)); color: #fff; flex: none; box-shadow: 0 6px 14px -6px rgba(15, 122, 85, .7); }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-logo { height: 42px; width: auto; max-width: 120px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--primary); font-size: 12.5px; }
.topnav { display: flex; align-items: center; gap: 8px; }
.points-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 14px; border-radius: 99px; background: var(--gold-50); border: 1px solid #f6dc95; color: #6b4a00; font-weight: 800; }
.points-pill:hover { color: #6b4a00; background: #ffefc2; }
.points-pill .icon { color: var(--gold); width: 20px; height: 20px; }
.points-pill small { font-weight: 600; font-size: 12px; }
.points-pill.big { font-size: 20px; padding: 8px 18px; }
@media (max-width: 640px) { .hide-sm { display: none; } .brand-text small { display: none; } .topnav .btn-primary { font-size: 13px; padding: 0 12px; } }

.page { min-height: 60vh; padding-bottom: 48px; }

/* ===== البانر ===== */
.banner-wrap { padding-top: 16px; position: relative; }
.banner-wrap .container { position: relative; }
.banner-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; border-radius: 20px; scrollbar-width: none; }
.banner-track::-webkit-scrollbar { display: none; }
.banner { position: relative; flex: 0 0 100%; scroll-snap-align: start; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 5; min-height: 150px;
  background: linear-gradient(120deg, var(--primary-700), var(--primary) 55%, #13a072); color: #fff; display: block; }
.banner:hover { color: #fff; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-caption { position: absolute; inset-inline: 0; bottom: 0; padding: 40px 24px 18px; background: linear-gradient(to top, rgba(0, 0, 0, .6), transparent); display: flex; flex-direction: column; gap: 2px; }
.banner-text-only { aspect-ratio: auto; min-height: 190px; }
.banner-text-only .banner-caption { inset: 0; justify-content: center; background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .14) 0 18%, transparent 19%), radial-gradient(circle at 85% 90%, rgba(227, 160, 8, .35) 0 22%, transparent 23%); padding: 24px 32px; }
.banner-caption strong { font-size: clamp(18px, 3vw, 30px); font-weight: 800; }
.banner-caption span { opacity: .92; font-size: clamp(13px, 1.6vw, 17px); }
.banner-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.banner-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; background: var(--line-2); cursor: pointer; padding: 0; transition: width .2s, background .2s; }
.banner-dots button.is-active { width: 22px; background: var(--primary); }
.banner-close { position: absolute; top: 10px; inset-inline-end: 26px; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; z-index: 2; }
.banner-close:hover { background: rgba(0, 0, 0, .7); }
@media (max-width: 640px) { .banner { aspect-ratio: 16 / 8; } }

/* ===== الواجهة الرئيسية ===== */
.hero { margin-top: 16px; }
.hero-inner { position: relative; overflow: hidden; border-radius: 24px; padding: 40px 32px; color: #fff; display: grid; gap: 24px; align-items: center;
  background: radial-gradient(circle at 0% 0%, rgba(255, 255, 255, .12) 0 1.5px, transparent 2px) 0 0 / 22px 22px, linear-gradient(125deg, var(--primary-700) 0%, var(--primary) 60%, #17a776 100%); }
.hero h1 { font-size: clamp(26px, 4vw, 42px); margin-bottom: 10px; }
.hero p { color: #d8f2e5; font-size: 17px; max-width: 560px; }
.hero-balance { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); padding: 10px 16px; border-radius: 14px; }
.hero-balance strong { font-size: 22px; color: #ffe08a; }
.hero-art { position: relative; height: 160px; display: none; }
.hero-art .coin { position: absolute; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe28a, var(--gold) 60%, var(--gold-600)); color: #7a5200; box-shadow: 0 12px 24px -10px rgba(0, 0, 0, .45), inset 0 -4px 0 rgba(0, 0, 0, .12); }
.hero-art .c1 { width: 110px; height: 110px; inset-inline-end: 40px; top: 10px; }
.hero-art .c1 .icon { width: 56px; height: 56px; }
.hero-art .c2 { width: 78px; height: 78px; inset-inline-end: 150px; top: 70px; background: radial-gradient(circle at 35% 30%, #fff, #e9f7f0 60%, #bfe5d2); color: var(--primary); }
.hero-art .c2 .icon { width: 36px; height: 36px; }
.hero-art .c3 { width: 54px; height: 54px; inset-inline-end: 10px; top: 110px; }
.hero-art .c3 .icon { width: 26px; height: 26px; }
@media (min-width: 860px) { .hero-inner { grid-template-columns: 1.6fr 1fr; padding: 48px; } .hero-art { display: block; } }

.catalog { margin-top: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 20px; }
.filters select { width: auto; min-width: 160px; }
.filters.compact { background: transparent; border: 0; padding: 0; margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; margin: 0; }
.product-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.product-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; color: var(--ink); transition: transform .18s, box-shadow .18s, border-color .18s; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary-100); color: var(--ink); }
.product-media { position: relative; aspect-ratio: 1; background: linear-gradient(145deg, var(--primary-50), #f7fbf8); display: grid; place-items: center; }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-icon { width: 64px !important; height: 64px !important; color: var(--primary-100); }
.ribbon { position: absolute; top: 12px; inset-inline-start: 12px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; }
.product-body { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.eyebrow { font-size: 12px; font-weight: 800; color: var(--primary); letter-spacing: .02em; }
.eyebrow.light { color: #bfe9d4; }
.product-name { font-size: 16px; }
.product-desc { color: var(--muted); font-size: 13.5px; }
.product-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 16px; gap: 8px; }
.price { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; color: #6b4a00; }
.price .icon { color: var(--gold); width: 20px; height: 20px; }
.price small { font-weight: 600; font-size: 12px; color: var(--muted); }
.price-lg { font-size: 26px; }
.price-lg .icon { width: 28px; height: 28px; }
.stock { font-size: 12.5px; font-weight: 700; }
.stock.ok { color: var(--primary); }
.stock.out { color: var(--red); }
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .product-body { padding: 10px 12px 4px; }
  .product-name { font-size: 14.5px; }
  .product-desc { display: none; }
  .product-foot { flex-direction: column; align-items: flex-start; padding: 6px 12px 12px; gap: 2px; }
  .price { font-size: 15px; }
  .hero-inner { padding: 28px 20px; }
}
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty .icon { width: 48px; height: 48px; color: var(--line-2); margin-bottom: 8px; }
.empty.sm { padding: 24px; border: 0; }
.empty.sm .icon { width: 34px; height: 34px; }

/* صفحة المنتج */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin: 20px 0 14px; font-weight: 700; color: var(--ink-2); }
.product-detail { display: grid; gap: 20px; }
@media (min-width: 860px) { .product-detail { grid-template-columns: 1fr 1fr; align-items: start; } }
.product-hero { aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: linear-gradient(145deg, var(--primary-50), #fff); border: 1px solid var(--line); display: grid; place-items: center; }
.product-hero img { width: 100%; height: 100%; object-fit: cover; }
.product-title { font-size: 28px; }
.product-text { color: var(--ink-2); }
.balance-row, .total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--primary-50); color: var(--primary-700); }
.total-row { background: var(--surface-2); color: var(--ink); font-size: 18px; border: 1px solid var(--line); }
.qty { display: flex; gap: 8px; align-items: center; }
.qty input { width: 90px; text-align: center; font-weight: 800; font-size: 18px; }

/* ===== لوحة الطالب ===== */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 16px 0 6px; scrollbar-width: thin; }
.subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; color: var(--ink-2); font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.subnav a:hover { background: var(--surface); border-color: var(--line); }
.subnav a.is-active { background: var(--dark); color: #fff; }
.welcome { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin: 16px 0 20px; }
.welcome h1 { font-size: 28px; margin: 0; }
.page-title { font-size: 26px; margin: 18px 0 16px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 20px; }
.stat { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); box-shadow: var(--shadow-sm); overflow: hidden; }
a.stat:hover { border-color: var(--primary-100); color: var(--ink); box-shadow: var(--shadow); }
.stat-icon { position: absolute; top: 16px; inset-inline-end: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13.5px; font-weight: 700; padding-inline-end: 48px; }
.stat-value { font-size: 30px; font-weight: 900; line-height: 1.2; margin-top: 6px; }
.stat-sub { color: var(--muted); font-size: 12.5px; }
.stat-gold { background: linear-gradient(140deg, #fffaf0, var(--gold-50)); border-color: #f6dc95; }
.stat-gold .stat-icon { background: var(--gold); color: #fff; }
.stat-gold .stat-value { color: #7a5200; }
.stat-amber .stat-icon { background: var(--amber-50); color: var(--amber); }
.stat-red .stat-icon { background: var(--red-50); color: var(--red); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; color: var(--ink); }
a.list-row:hover { color: var(--ink); background: var(--surface-2); }
.list-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.list-row .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.list.compact .list-row { padding: 9px 2px; }
.with-thumb { display: flex !important; flex-direction: row !important; align-items: center; gap: 12px; }
.with-thumb > span:last-child { display: flex; flex-direction: column; }
.thumb { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; color: var(--primary); flex: none; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 88px; height: 88px; }
.thumb.contain img { object-fit: contain; padding: 4px; background: #fff; }
.summary { margin: 14px 0 0; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.summary > div { display: flex; justify-content: space-between; padding: 4px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; }
.summary .total { font-size: 18px; font-weight: 900; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.summary .total dt { color: var(--ink); }
.kv { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.kv.small { font-size: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.timeline { list-style: none; display: flex; padding: 0; margin: 0 0 18px; gap: 4px; counter-reset: s; }
.timeline li { flex: 1; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); position: relative; padding-top: 26px; }
.timeline li::before { content: ""; position: absolute; top: 8px; inset-inline: 0; height: 4px; background: var(--line); border-radius: 4px; }
.timeline .dot { position: absolute; top: 2px; inset-inline-start: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--line-2); z-index: 1; border: 3px solid var(--surface); }
.timeline li.done { color: var(--primary-700); }
.timeline li.done::before, .timeline li.done .dot { background: var(--primary); }

/* ===== الجداول ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 800; background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfdfb; }
.table-sm td, .table-sm th { padding: 8px 12px; }
.table .actions, .actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

/* ===== المعلم ===== */
.teacher-hero { margin-top: 20px; border-radius: 24px; padding: 28px; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #0d3b66, #0f7a55); }
.teacher-hero h1 { font-size: 28px; margin: 0 0 4px; }
.teacher-hero p { color: #d6ebf5; margin: 0; }
.hero-stat { background: rgba(255, 255, 255, .14); border-radius: 16px; padding: 14px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero-stat strong { font-size: 30px; line-height: 1.2; }
.hero-stat span { font-size: 13px; color: #d6ebf5; }
.teacher-layout { display: grid; gap: 20px; margin-top: 20px; }
@media (min-width: 1000px) { .teacher-layout { grid-template-columns: 1fr 320px; align-items: start; } }
.student-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.student-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: var(--surface); }
.student-card .btn { grid-column: 1 / -1; }
.student-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.student-info > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.student-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-700); font-weight: 900; flex: none; }
.student-points { text-align: center; line-height: 1.1; }
.student-points b { display: block; font-size: 20px; color: #7a5200; }
.student-points small { font-size: 11.5px; color: var(--muted); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 6px 14px; font: inherit; font-weight: 800; cursor: pointer; }
.chip.plus { color: var(--primary); }
.chip.minus { color: var(--red); }
.chip:hover { border-color: currentColor; }

/* ===== النوافذ المنبثقة ===== */
.modal { border: 0; border-radius: 20px; padding: 22px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
.modal::backdrop { background: rgba(10, 25, 18, .5); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 18px; margin: 0; }
.modal-actions { display: flex; gap: 8px; }

/* ===== الفوتر والرعاة ===== */
.sponsors { background: var(--surface); border-top: 1px solid var(--line); padding: 28px 0; }
.sponsors-title { text-align: center; font-size: 15px; font-weight: 800; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 18px; }
.sponsors-title .icon { color: #e05a6b; }
.sponsors-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.sponsor { display: grid; place-items: center; height: 72px; min-width: 140px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line); background: #fff; transition: border-color .2s, box-shadow .2s; }
a.sponsor:hover { border-color: var(--primary-100); box-shadow: var(--shadow); }
.sponsor img { max-height: 50px; max-width: 150px; width: auto; object-fit: contain; filter: grayscale(1); opacity: .75; transition: filter .25s, opacity .25s; }
.sponsor:hover img { filter: none; opacity: 1; }
.sponsor-name { font-weight: 800; color: var(--ink-2); }
.site-footer { background: var(--dark); color: #cfe0d6; padding: 36px 0; }
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; } }
.footer-brand strong { display: block; color: #fff; font-size: 18px; margin-bottom: 4px; }
.footer-brand p { color: #9fb8aa; font-size: 13.5px; }
.footer-logo { height: 46px; width: auto; margin-bottom: 10px; }
.footer-contact h3 { color: #fff; font-size: 15px; }
.footer-contact a { display: flex; align-items: center; gap: 8px; color: #cfe0d6; margin-bottom: 8px; }
.footer-contact a:hover { color: #fff; }
.footer-image img { max-height: 90px; width: auto; margin-inline-start: auto; }

/* ===== صفحات الدخول ===== */
.auth-body { min-height: 100vh; background: radial-gradient(circle at 100% 0%, rgba(15, 122, 85, .14), transparent 40%), radial-gradient(circle at 0% 100%, rgba(227, 160, 8, .14), transparent 40%), var(--bg); }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 16px; }
.auth-shell > .flash-stack { width: 100%; max-width: 440px; margin: 0; padding: 0; }
.auth-shell.is-wide > .flash-stack { max-width: 760px; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; }
.auth-brand:hover { color: var(--ink); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 30px 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 23px; text-align: center; }
.auth-card > p.muted { text-align: center; }
.auth-icon { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.auth-icon.is-dark { background: var(--dark); color: #fff; }
.auth-icon .icon { width: 28px; height: 28px; }
.auth-points { list-style: none; padding: 0; margin: 18px 0 0; display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.auth-points li { display: flex; align-items: center; gap: 6px; }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 13.5px; }
.auth-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.otp-input { font-family: var(--mono); font-size: 30px; letter-spacing: 12px; text-align: center !important; font-weight: 800; min-height: 64px; }
.otp-input.sm { font-size: 20px; letter-spacing: 6px; min-height: 46px; max-width: 200px; }
.error-code { font-size: 64px; font-weight: 900; color: var(--primary-100); line-height: 1; margin-bottom: 8px; }
.help { margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.help summary { cursor: pointer; font-weight: 700; }
.setup-card { max-width: 760px; }
.setup-card form { margin-top: 16px; }
.checks summary { cursor: pointer; font-weight: 700; }
.checks ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.checks li { display: flex; gap: 6px; align-items: center; }
.checks .ok { color: var(--primary); }
.checks .bad { color: var(--red); font-weight: 700; }
.checks .warn { color: var(--amber); }
.code-box { font-family: var(--mono); font-size: 12px; background: var(--surface-2); }

/* ===== لوحة الإدارة ===== */
.admin-body { background: var(--bg); }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 256px; background: var(--dark); color: #cfe0d6; display: flex; flex-direction: column; z-index: 50; transition: transform .25s; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand:hover { color: #fff; }
.sidebar-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sidebar-brand strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand small { color: #8fb3a0; font-size: 12px; }
.sidebar-nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #cfe0d6; font-weight: 600; }
.sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-link.is-active { background: var(--primary); color: #fff; }
.sidebar-link .count { margin-inline-start: auto; background: var(--gold); color: #2b1d00; font-size: 11.5px; border-radius: 99px; padding: 0 8px; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-backdrop { display: none; }
.admin-main { margin-inline-start: 256px; min-height: 100vh; display: flex; flex-direction: column; }
.admin-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); min-height: 64px; }
.admin-title { font-size: 19px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user .who { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.nav-toggle { display: none; }
.admin-content { padding: 22px 24px 48px; }
.admin-content > .card, .admin-content > form.card { margin-bottom: 20px; }
.quick-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.narrow-form { max-width: 820px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--primary-700); border-bottom-color: var(--primary); }
.tabs a b { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.tabs .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tabs .dot.on { background: #22c55e; }
.tabs .dot.off { background: var(--line-2); }
.toggle-card { margin-bottom: 20px; border-inline-start: 4px solid var(--primary); }
.inline-edit { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-edit input { flex: 1; min-width: 140px; min-height: 38px; padding: 6px 10px; }
.upload-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.upload-row > div { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.upload-row.col { flex-direction: column; align-items: stretch; }
.banner-preview { width: 100%; height: 150px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); border: 1px dashed var(--primary-100); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.banner-thumb { width: 120px; aspect-ratio: 16 / 5; border-radius: 8px; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; color: var(--primary); flex: none; }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-list { list-style: none; margin: 0; padding: 4px 0; }
.media-list li { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); }
.mfa-option { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mfa-option h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; margin: 0; }
.steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; }
.qr { background: #fff; display: block; width: fit-content; padding: 8px; border-radius: 12px; border: 1px solid var(--line); margin-top: 8px; }
.qr svg { display: block; width: 200px; height: 200px; }
.secret { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.secret code { font-size: 15px; letter-spacing: 1px; padding: 6px 10px; }
.recovery-card { border: 2px solid var(--gold); background: var(--gold-50); margin-bottom: 20px; }
.codes { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.codes li { font-family: var(--mono); font-weight: 800; background: #fff; border: 1px dashed #e8c766; border-radius: 10px; padding: 8px; text-align: center; letter-spacing: 1px; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(100%); }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 25, 18, .45); z-index: 40; }
  .admin-main { margin-inline-start: 0; }
  .nav-toggle { display: inline-flex; }
  .admin-top { padding: 10px 16px; }
  .admin-content { padding: 16px 16px 40px; }
  .admin-main .flash-stack { padding-inline: 16px; }
  .admin-user .who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .site-footer, .sponsors, .sidebar, .admin-top, .subnav, .btn { display: none !important; }
  .admin-main { margin: 0; }
}
