/* ==========================================================
   لوحة التحكم — نفس تصميم منصة Fast Web
   اللون الأساسي (--primary) بيتاخد من إعدادات المنصة
   ========================================================== */
@font-face {
  font-family: "Amin";
  src: url("../fonts/Amin-Regular.otf") format("opentype");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --primary: #970707;
  --primary-soft: color-mix(in srgb, var(--primary) 9%, #fff);
  --primary-line: color-mix(in srgb, var(--primary) 22%, #fff);
  --fg: #171717;
  --text: #1c2024;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --surface: #fff;
  --canvas: #fcfcfc;
  --raised: #f4f4f5;

  --green: #16a34a;  --green-soft: #dcfce7;
  --red: #dc2626;    --red-soft: #fee2e2;
  --purple: #9333ea; --purple-soft: #f3e8ff;
  --yellow: #ca8a04; --yellow-soft: #fef9c3;
  --orange: #c2410c; --orange-soft: #ffedd5;
  --blue: #2563eb;   --blue-soft: #dbeafe;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Open Sans", system-ui, Tahoma, sans-serif;
  --font-head: "Amin", var(--font);
  --topbar-h: 54px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--canvas); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; color: var(--fg); }
h1 { font-family: var(--font-head); font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--fg); }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.ic { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- الهيدر ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.tb-user { display: flex; align-items: center; gap: 10px; }
.tb-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.tb-who { display: flex; flex-direction: column; line-height: 1.2; margin-inline-end: 8px; }
.tb-who b { font-size: 14px; color: var(--fg); }
.tb-who small { font-size: 12px; color: var(--muted); text-align: right; }
.tb-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.tb-icon:hover { background: var(--raised); color: var(--fg); text-decoration: none; }
.tb-center { display: flex; justify-content: center; }
.tb-select { min-width: 170px; height: 34px; padding: 0 12px; border-radius: 8px; text-align: center; }
.tb-search { position: relative; width: 380px; max-width: 40vw; }
.tb-search .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.tb-search input[type=search] { width: 100%; height: 36px; padding-right: 36px; border-radius: 10px; }
.tb-brand { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.tb-brand img { height: 38px; }
.menu-btn { display: none; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--topbar-h)); background: linear-gradient(to left, #fff calc(var(--sidebar-w) - 1px), var(--line) calc(var(--sidebar-w) - 1px), var(--line) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  background: #fff; border-left: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding-bottom: 20px;
}
.sb-logo { display: flex; justify-content: center; padding: 14px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sb-logo img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-line); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); color: #52525b; font-size: 14px; }
.sidebar nav a .ic { color: #52525b; }
.sidebar nav a:hover { background: var(--raised); text-decoration: none; color: var(--fg); }
.sidebar nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar nav a.active .ic { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 24px; width: 100%; max-width: 1440px; }
.footbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--muted); }
.footbar .brand-name { color: var(--primary); font-style: italic; font-weight: 800; }
.footbar .sep { margin: 0 6px; color: var(--line-strong); }
.footbar nav { display: flex; gap: 18px; }
.footbar nav a { color: var(--muted); }

/* ---------- عناوين الصفحات ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-head p a { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.count-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; font-size: 14px; color: var(--muted); }
.count-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.count-chip b { color: var(--fg); }

/* ---------- الأزرار والمدخلات ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; color: var(--fg);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); background: var(--primary); }
.btn.ghost { background: #fff; }
.btn.danger, .link.danger { color: var(--red); }
.btn.block { width: 100%; height: 44px; }
.btn.square { width: 36px; padding: 0; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link:disabled { color: var(--line-strong); cursor: default; }

.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn .ic { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--raised); text-decoration: none; }
.icon-btn.view { color: var(--green); }
.icon-btn.people { color: var(--purple); }
.icon-btn.edit { color: var(--primary); }
.icon-btn.del { color: var(--red); }
.icon-btn.file { color: var(--yellow); }

input[type=text], input[type=search], input[type=number], input[type=email], input[type=tel], input[type=url],
input[type=password], input[type=datetime-local], input:not([type]), select, textarea {
  font: inherit; font-size: 14px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; color: var(--text); min-width: 0;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; width: 100%; line-height: 1.6; }
select { padding-left: 28px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: #a1a1aa; }
input[type=color] { width: 60px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: middle; }

/* ---------- الفلاتر ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.filters input[type=search] { flex: 0 1 380px; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat right 12px center; }
.filters select { min-width: 150px; max-width: 220px; }
.filters .spacer { flex: 1; }

.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin-bottom: 16px; flex-wrap: wrap; }
.seg a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-size: 14px; }
.seg a:hover { text-decoration: none; background: var(--raised); }
.seg a.active { background: var(--primary); color: #fff; font-weight: 600; }
.seg a .n { font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--raised); color: var(--muted); }
.seg a.active .n { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- كروت وجداول ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head p { margin: 0; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: center; font-weight: 500; color: var(--muted); padding: 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fff; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfcfd; }
.table .id { color: var(--muted); width: 1%; }
.table .empty { color: var(--muted); padding: 48px; }
.table .start { text-align: right; }
.table.compact td { padding: 10px 6px; text-align: right; }
.card .table th { background: transparent; }
.row-actions { white-space: nowrap; }
.row-actions > * { margin-inline-start: 4px; vertical-align: middle; }
.row-actions form { display: inline; }
.row-actions .text-act { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); display: inline-flex; align-items: center; gap: 4px; }
.row-actions .text-act:hover { background: var(--raised); text-decoration: none; }
.row-actions .text-act .ic { width: 14px; height: 14px; color: var(--muted); }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; display: inline-block; background: var(--raised); vertical-align: middle; }
.thumb.empty { border: 1px dashed var(--line); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: #fff; color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--green-soft); border-color: #bbf7d0; color: var(--green); }
.badge.bad { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.badge.warn { background: var(--orange-soft); border-color: #fed7aa; color: var(--orange); }
.badge.muted { background: var(--raised); color: var(--muted); }
.badge.info { background: #fff; color: var(--text); }
.badge.soft-red { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.badge.soft-yellow { background: var(--yellow-soft); border-color: #fde68a; color: var(--yellow); }

.switch { display: inline-block; width: 32px; height: 18px; border-radius: 99px; background: #e4e4e7; position: relative; vertical-align: middle; transition: background .15s; }
.switch i { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: right .15s; }
.switch.on { background: var(--primary); }
.switch.on i { right: 16px; }

.phone { display: inline-flex; align-items: center; gap: 4px; direction: ltr; }
.phone .ic { width: 13px; height: 13px; color: var(--green); }
.code-chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }

.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert.success { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.alert.error { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }

.pager { display: flex; gap: 4px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 14px; }
.pager a:hover { background: var(--raised); text-decoration: none; }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager span { border: 0; background: none; }

/* ---------- الفورم ---------- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; color: var(--fg); }
.field input, .field select { width: 100%; }
.field .help { color: var(--muted); font-size: 12px; }
.field .err { color: var(--red); font-size: 12px; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--red); }
.field-bool { justify-content: flex-end; }
.req { color: var(--red); font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.image-field { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.image-field img { width: 80px; height: 56px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.image-field input[type=url] { flex: 1 1 260px; }
.image-field input[type=file] { font-size: 13px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--canvas); padding: 14px 0; margin: 0; border: 0; z-index: 5; }
fieldset.card { margin: 0 0 16px; }
fieldset legend { font-weight: 700; padding: 0 8px; font-size: 15px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.inline-form select { flex: 1 1 260px; }
.inline-form input[type=text] { flex: 1 1 200px; }
.inline-form input[type=number] { width: 160px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
label.inline input { width: 100px !important; }
.generate h2 { margin-bottom: 14px; }
.bulk-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.copy { cursor: copy; }

/* ---------- الرئيسية ---------- */
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 24px; border-radius: var(--r-lg); background: var(--primary-soft); border: 1px solid var(--primary-line); margin-bottom: 24px; }
.welcome h1 { font-size: 26px; }
.welcome p { margin: 6px 0 0; color: var(--muted); }
.welcome p b { color: var(--fg); }
.welcome .btn { height: 40px; border-radius: var(--r-md); border-color: transparent; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.welcome .btn .ic { color: var(--primary); }

.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-family: var(--font-head); font-size: 18px; }
.section-title .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.section-title .ico .ic { width: 16px; height: 16px; }
.sub-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 24px 0 12px; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.pulse { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.money-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }

.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text); position: relative; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi strong { font-size: 22px; font-weight: 800; line-height: 1.3; color: var(--fg); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-sub { font-size: 12px; color: var(--muted); }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--text); min-height: 140px; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.stat strong { font-size: 22px; font-weight: 800; color: var(--fg); line-height: 1.2; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.trend { font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.trend .ic { width: 13px; height: 13px; }

.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; align-items: center; gap: 14px; color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--line-strong); }
.tile strong { display: block; font-size: 20px; font-weight: 800; color: var(--fg); line-height: 1.2; }
.tile span { font-size: 13px; color: var(--muted); display: block; }
.tile small.hint { font-size: 11px; color: #a1a1aa; }
.tile.big { padding: 20px 22px; }
.tile.big strong { font-size: 24px; }
.tile.big .ico-box { width: 46px; height: 46px; }

.ico-box { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ico-box .ic { width: 19px; height: 19px; }
.t-red { background: var(--primary-soft); color: var(--primary); }
.t-green { background: var(--green-soft); color: var(--green); }
.t-purple { background: var(--purple-soft); color: var(--purple); }
.t-yellow { background: var(--yellow-soft); color: var(--yellow); }
.t-gray { background: var(--raised); color: var(--muted); }
.t-blue { background: var(--blue-soft); color: var(--blue); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.two-col .card { margin-bottom: 0; }
.two-col > div > .card + .card { margin-top: 16px; }

.legend { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.l-reg, .bar.reg { background: #d4d4d8; }
.l-rev, .bar.rev { background: var(--primary); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar { width: 42%; min-height: 2px; border-radius: 4px 4px 0 0; }
.bar-col small { font-size: 11px; color: var(--muted); }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 1fr 110px 40px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rank li:last-child { border: 0; }
.rank li a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 6px; background: var(--raised); border-radius: 3px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.rank b { text-align: left; font-variant-numeric: tabular-nums; }

/* ---------- ملف الطالب ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); border: 2px solid var(--primary-line); display: grid; place-items: center; font-size: 24px; font-weight: 800; flex-shrink: 0; font-family: var(--font-head); }
.who { flex: 1; min-width: 240px; }
.who h1 { font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.meta b { color: var(--fg); }
.wallet-box { display: flex; flex-direction: column; padding: 0 20px; border-inline-start: 1px solid var(--line); }
.wallet-box small { color: var(--muted); font-size: 12px; }
.wallet-box strong { font-size: 22px; color: var(--fg); }
.profile-head .actions form { display: inline; }

.tab-bar { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin-bottom: 16px; overflow-x: auto; width: fit-content; max-width: 100%; }
.tab-bar button, .tab-bar a { background: none; border: 0; border-radius: 9px; padding: 8px 14px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab-bar button:hover, .tab-bar a:hover { background: var(--raised); text-decoration: none; }
.tab-bar button.active, .tab-bar a.active { background: var(--primary); color: #fff; font-weight: 600; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; margin: 0 0 16px; }
.info-grid dt { font-size: 12px; color: var(--muted); }
.info-grid dd { margin: 3px 0 0; font-weight: 600; color: var(--fg); }

/* ---------- محتوى الكورس ---------- */
.lecture { padding: 0; }
.lecture summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.lecture summary::-webkit-details-marker { display: none; }
.lec-num { width: 28px; height: 28px; border-radius: 8px; background: var(--raised); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; color: var(--muted); }
.lecture[open] .lec-num { background: var(--primary); color: #fff; }
.lec-title { font-weight: 700; color: var(--fg); }
.lec-meta { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.lec-body { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.lec-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.lec-actions a { font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); }
.lec-actions a:hover { background: var(--raised); text-decoration: none; }
.content-list { list-style: none; margin: 0; padding: 0; }
.content-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.content-list li:last-child { border: 0; }
.content-list li.off { opacity: .5; }
.kind { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--raised); color: var(--muted); min-width: 52px; text-align: center; }
.k-videos { background: var(--primary-soft); color: var(--primary); }
.k-exam { background: var(--purple-soft); color: var(--purple); }
.k-file_texts { background: var(--yellow-soft); color: var(--yellow); }
.empty-state { text-align: center; padding: 40px; color: var(--muted); }

/* ---------- الأسئلة والامتحانات ---------- */
.q-list .q-card, .q-card.in-exam { margin-bottom: 10px; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.q-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.q-card-head .row-actions { margin-inline-start: auto; }
.q-text { font-weight: 600; color: var(--fg); line-height: 1.7; }
.q-img { max-width: 100%; max-height: 220px; border-radius: var(--r-sm); margin-top: 8px; border: 1px solid var(--line); display: block; }
.q-img.sm { max-height: 60px; display: inline-block; margin: 0 6px; }
.choices { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.choices.inline { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choices li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px; }
.choices li.correct { background: var(--green-soft); border-color: #bbf7d0; }
.choices li.selected:not(.correct) { background: var(--primary-soft); border-color: var(--primary-line); }
.choices .mark { width: 16px; font-weight: 800; color: var(--green); }
.choices li.selected:not(.correct) .mark { color: var(--primary); }
.pick-list { max-height: 520px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.pick-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.pick-item:hover { background: var(--canvas); }
.pick-item:last-child { border: 0; }
.answers-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.answer-row { display: grid; grid-template-columns: auto 2fr 1.2fr 1.5fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.correct-toggle { padding: 0 10px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-md); }
.correct-toggle:has(input:checked) { background: var(--green-soft); border-color: #bbf7d0; color: var(--green); font-weight: 600; }
.review { border-inline-start: 4px solid var(--line); }
.review.right { border-inline-start-color: var(--green); }
.review.wrong { border-inline-start-color: var(--primary); }
.review.pending { border-inline-start-color: var(--yellow); }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.review-score { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.review-score input { width: 90px; height: 34px; }
.essay { margin-top: 10px; padding: 12px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-sm); }
.score-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.score-pill b { font-size: 18px; }

/* ---------- الحضور ---------- */
.scan-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.scan-box input { flex: 1 1 300px; height: 48px; font-size: 16px; }
.scan-result { margin-top: 12px; padding: 12px 16px; border-radius: var(--r-md); font-weight: 600; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.att-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: #fff; }
.att-item:has(input:checked) { background: var(--green-soft); border-color: #bbf7d0; }
.att-item small { display: block; color: var(--muted); font-size: 11px; }
#qr-reader { max-width: 380px; margin-top: 12px; }

/* ---------- المنتدى ---------- */
.post { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 12px; }
.post.pinned { border-color: var(--primary-line); background: linear-gradient(var(--primary-soft), #fff 60px); }
.post.hidden-post { opacity: .55; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post-head .row-actions { margin-inline-start: auto; }
.post-author { font-weight: 700; color: var(--fg); }
.post-body { line-height: 1.8; white-space: pre-wrap; }
.post img.post-img { max-width: 100%; max-height: 360px; border-radius: var(--r-md); margin-top: 10px; }
.comments { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.comment { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; background: var(--canvas); border-radius: var(--r-md); font-size: 13px; }
.comment.teacher { background: var(--primary-soft); }
.comment .row-actions { margin-inline-start: auto; }
.reply-form { display: flex; gap: 8px; margin-top: 8px; }
.reply-form input { flex: 1; }

/* ---------- الدخول (نفس صفحة دخول المنصة) ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; background: #f7f7f7; }
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; max-width: 1110px; margin: 0 auto; padding: 40px 24px; width: 100%; }
.login-hero .brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; color: var(--fg); margin-bottom: 26px; }
.login-hero .brand .ico-box { background: #2d6a4f; color: #fff; }
.login-hero h1 { font-size: 52px; line-height: 1.25; margin-bottom: 18px; }
.login-hero p { color: var(--muted); font-size: 16px; line-height: 1.8; max-width: 380px; margin: 0 0 38px; }
.login-stats { display: flex; gap: 28px; background: #fff; border-radius: var(--r-lg); padding: 18px 28px; width: fit-content; }
.login-stats div { text-align: center; }
.login-stats div + div { border-right: 1px solid var(--line); padding-right: 28px; }
.login-stats b { display: block; font-size: 24px; color: #2d6a4f; }
.login-stats small { color: var(--muted); }
.login-card { background: #fff; padding: 32px; border-radius: 20px; box-shadow: 0 20px 50px -12px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 16px; }
.login-card h2 { font-family: var(--font-head); font-size: 24px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); margin: -10px 0 6px; }
.login-card .field input { height: 50px; }
.login-card .btn.primary { background: #2d6a4f; border-color: #2d6a4f; height: 44px; border-radius: var(--r-md); font-weight: 700; }
.with-icon { position: relative; }
.with-icon .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.login-foot { display: flex; justify-content: center; gap: 28px; padding: 18px; font-size: 13px; }
.login-foot a { color: var(--muted); }

/* ---------- موبايل ---------- */
.nav-backdrop { display: none; }
@media (max-width: 1200px) {
  .pulse { grid-template-columns: repeat(3, 1fr); }
  .overview { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; }
  .tb-who { display: none; }
  .tb-search { width: 100%; max-width: none; }
  .menu-btn { display: inline-grid; }
  .tb-brand img { height: 30px; }
  .shell { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; top: var(--topbar-h); right: 0; width: 250px; z-index: 40; transform: translateX(100%); transition: transform .2s; height: calc(100vh - var(--topbar-h)); }
  body.nav-open .sidebar { transform: none; box-shadow: -10px 0 40px rgba(0,0,0,.15); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0; background: rgba(0,0,0,.25); z-index: 35; }
  .content { padding: 16px 12px; }
  .two-col, .kpis, .money-row { grid-template-columns: 1fr; }
  .wallet-box { border: 0; padding: 0; }
  .login-wrap { grid-template-columns: 1fr; gap: 28px; }
  .login-hero h1 { font-size: 34px; }
  .answer-row { grid-template-columns: auto 1fr; }
  .tb-center { display: none; }
}
@media (max-width: 560px) {
  .pulse, .overview { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.login-card input:focus { border-color: #2d6a4f; box-shadow: 0 0 0 3px #2d6a4f22; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- الإعدادات ---------- */
.settings-card h2 { margin: 6px 0 14px; }
.settings-card h2:not(:first-of-type) { margin-top: 26px; }
.upload-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.upload-box .lbl { font-weight: 600; font-size: 14px; color: var(--fg); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 140px; padding: 16px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--canvas); cursor: pointer; color: var(--muted); text-align: center; }
.drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.drop img { max-height: 90px; max-width: 220px; border-radius: var(--r-sm); object-fit: contain; }
.drop .ic { width: 28px; height: 28px; }
.drop small { font-size: 11px; }
.switch-list { display: flex; flex-direction: column; gap: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.switch-row b { display: block; font-size: 14px; color: var(--fg); }
.switch-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
input.sw { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; border-radius: 99px; background: #e4e4e7; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
input.sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: right .15s; }
input.sw:checked { background: var(--primary); }
input.sw:checked::after { right: 21px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.chip-check { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-size: 14px; }
.chip-check:has(input:checked) { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.api-block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.api-block:first-of-type { padding-top: 0; }
.api-block h2 { margin: 0 !important; }
.api-block p { margin: 4px 0 12px; font-size: 13px; }
.other-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.center { text-align: center; }

/* ---------- التقويم ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.cal-head { padding: 10px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--canvas); }
.cal-day { min-height: 112px; padding: 6px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-left: 0; }
.cal-day.out { background: var(--canvas); }
.cal-num { font-size: 13px; font-weight: 600; color: var(--muted); width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-ev { display: block; font-size: 11px; padding: 3px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
input[type=date] { font: inherit; font-size: 14px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
@media (max-width: 960px) { .cal-day { min-height: 70px; } .cal-ev { font-size: 0; padding: 0; height: 6px; } }

/* ---------- رسوم الرئيسية ---------- */
.chart { width: 100%; height: 230px; display: block; }
.chart .grid { stroke: #ececf0; stroke-dasharray: 3 3; }
.chart .axis { font-size: 10px; fill: #a1a1aa; font-family: var(--font); }
.center-legend { justify-content: center; margin: 4px 0 8px; flex-wrap: wrap; }
.donut { width: 160px; height: 160px; border-radius: 50%; margin: 16px auto 12px; position: relative; }
.donut span { position: absolute; inset: 26px; background: #fff; border-radius: 50%; }
.mini-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 4px; }
.mini-stats div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; text-align: center; }
.mini-stats strong { display: block; font-size: 22px; color: var(--fg); }
.mini-stats span { font-size: 12px; color: var(--muted); }
.lavatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; margin-left: 8px; vertical-align: middle; flex-shrink: 0; }
.feed td { padding: 9px 4px !important; }
.feed td:last-child { text-align: left; }
.ellipsis { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li { grid-template-columns: minmax(0, 1fr) 46% 40px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name a { color: var(--text); }
@media (max-width: 1200px) { .mini-stats { grid-template-columns: repeat(3, 1fr); } }
.star { font-size: 18px; color: #e4e4e7; }
.star.on { color: #eab308; }
.count-link { color: var(--primary); font-weight: 600; white-space: nowrap; }
.thumb.round { border-radius: 50%; }
.activity { display: inline-block; width: 60px; height: 5px; border-radius: 3px; background: var(--raised); vertical-align: middle; overflow: hidden; } .activity i { display: block; height: 100%; background: var(--primary); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 8px; }
.checklist .ic { color: var(--green); width: 16px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.guide { display: flex; gap: 14px; align-items: flex-start; margin: 0; }
.guide h2 { font-size: 15px; margin-bottom: 4px; }
.guide p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.settings-card .grid-form { margin-bottom: 16px; }
.color-row input[type=color] { width: 56px !important; height: 40px; flex: 0 0 auto; }
.bundle-sum { margin-top: 16px; padding: 14px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-md); } .pick-item .thumb { width: 44px; height: 30px; }
.preview-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; } @media (max-width: 960px) { .preview-layout { grid-template-columns: 1fr; } }
