:root {
  /* هوية فيد */
  --feed-purple: #61038d;
  --feed-indigo: #20149a;
  --feed-pink: #ef207a;
  --feed-sky: #6fb6ff;
  --feed-gradient: linear-gradient(120deg, var(--feed-indigo) 0%, #4a0b93 45%, var(--feed-purple) 100%);

  --bg: #f6f3fa;
  --card: #ffffff;
  --text: #2a1840;
  --muted: #76688a;
  --border: #e9e1f2;
  --primary: var(--feed-purple);
  --primary-dark: #4a026c;
  --warn: var(--feed-pink);
  --danger: #d93a3a;
  --good: #1f9d63;
  --radius: 12px;
  --soft: #f6f0fb;
  --soft-2: #eef1f8;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; color: var(--feed-purple); font-weight: 800; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); margin: .4rem 0; }

/* الشريط العلوي */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--feed-gradient); color: #fff;
  padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 5;
  box-shadow: 0 2px 12px rgba(50, 10, 110, .25);
}
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; }
.brand span { font-size: .9rem; opacity: .85; border-inline-start: 1px solid rgba(255, 255, 255, .4); padding-inline-start: .7rem; }
.topbar { flex-wrap: nowrap; }
.topbar nav { display: flex; gap: .3rem; flex-wrap: nowrap; flex: 1; min-width: 0; overflow: hidden; }
.topbar nav a, .topbar nav .nav-group { white-space: nowrap; flex: none; }
.who { flex: none; white-space: nowrap; }
.topbar nav a { padding: .35rem .9rem; border-radius: 999px; color: rgba(255, 255, 255, .85); }
.topbar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: #fff; color: var(--feed-purple); font-weight: 700; }
.who { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: rgba(255, 255, 255, .85); }
.topbar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .5); }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, .15); }

/* أزرار */
.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  background: var(--primary); color: #fff; border: 1px solid transparent;
  padding: .5rem 1rem; border-radius: 8px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn.ghost:hover { background: var(--soft); }
.btn.warn { background: var(--feed-pink); }
.btn.warn:hover { background: #d0156a; }
.btn.danger { background: transparent; color: var(--danger); border-color: #f3c9c9; }
.btn.danger:hover { background: #fdeeee; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.block { width: 100%; }
.link { font: inherit; background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0 .3rem; font-size: .85rem; }
.link.danger { color: var(--danger); }

/* بطاقات */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 480px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.meta { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.stat b { display: block; font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat.warn b { color: var(--warn); }
.stat span { color: var(--muted); font-size: .9rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1.5fr; gap: 1rem; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

.levels, .recent, .subjects, .notes { list-style: none; margin: 0; padding: 0; }
.levels li { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.recent li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.recent p { margin: .2rem 0 0; }
.subjects li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--border); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card.child { color: var(--text); display: block; transition: box-shadow .15s; }
.card.child:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(30, 50, 120, .1); }
.mini-stats { display: flex; gap: 1rem; margin-top: .6rem; color: var(--muted); }

/* شارات */
.pill { display: inline-block; background: var(--soft); color: var(--feed-purple); border-radius: 999px; padding: .05rem .6rem; font-size: .85rem; }
.badge { display: inline-block; border-radius: 6px; padding: 0 .45rem; font-size: .8rem; font-weight: 500; }
.badge.behavior { background: #f2e9ff; color: #7037c6; }
.badge.level { background: #e6efff; color: var(--feed-indigo); }
.badge.general { background: var(--soft-2); color: #4a5575; }
.badge.content { background: #fde8f1; color: #b0145a; }
.badge.excellent { background: #dcf6e9; color: #127a4a; }
.badge.good { background: #e6f7ee; color: var(--good); }
.badge.average { background: #fff3df; color: #a7610a; }
.badge.weak { background: #fde8e8; color: var(--danger); }

/* الملاحظات */
details.subject { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem; margin-bottom: .6rem; }
details.subject summary { cursor: pointer; font-weight: 700; padding: .2rem 0; }
.note { padding: .6rem 0; border-top: 1px dashed var(--border); }
.notes > .note:first-child { border-top: 0; }
.note-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.note p { margin: .3rem 0 0; white-space: pre-wrap; }

/* جداول */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card .table-wrap { border: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--soft); font-weight: 500; color: var(--muted); font-size: .9rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.row-actions { white-space: nowrap; text-align: end; }

/* نماذج */
label { display: block; margin-bottom: .7rem; font-size: .95rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem;
  font: inherit; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #e4cdf3; border-color: var(--primary); }
label.check { display: flex; align-items: center; gap: .4rem; }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: 8px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.filters { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 200px; margin: 0; }
form.inline { display: flex; gap: .5rem; margin-bottom: 1rem; }
form.inline input { margin: 0; }

.login { min-height: 85vh; display: grid; place-items: center; }
.login .card { width: 100%; max-width: 420px; padding: 0; overflow: hidden; box-shadow: 0 12px 40px rgba(60, 10, 120, .15); }
.login-hero {
  background: var(--feed-gradient); color: #fff; padding: 1.8rem 1.6rem 2.2rem;
  border-end-start-radius: 48px; position: relative;
}
.login-hero::after { content: '✦'; position: absolute; inset-inline-end: 1.4rem; top: 1.2rem; font-size: 1.8rem; opacity: .8; }
.login-hero img { height: 54px; display: block; margin-bottom: 1rem; }
.login-hero .tag {
  display: inline-block; border: 1px solid rgba(255, 255, 255, .5); border-radius: 999px;
  padding: .1rem .8rem; font-size: .8rem; background: rgba(255, 255, 255, .1);
}
.login-hero h1 { color: #fff; font-size: 1.45rem; margin: .7rem 0 0; line-height: 1.4; }
.login-hero em { font-style: normal; color: var(--feed-sky); }
.login form { text-align: start; padding: 1.4rem 1.6rem 1.6rem; }

dialog {
  border: 0; border-radius: var(--radius); padding: 1.4rem; width: min(520px, 94vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(40, 10, 80, .5); }
dialog .actions { display: flex; gap: .5rem; margin-top: 1rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--good); color: #fff; padding: .6rem 1.2rem; border-radius: 8px; z-index: 50;
}
.toast.error { background: var(--danger); }

@media (max-width: 600px) {
  .brand span { display: none; }
  .topbar { gap: .5rem; padding: .6rem .8rem; }
  .row, .checks { grid-template-columns: 1fr; }
  .filters select, .filters input { width: 100%; }
  .who span { display: none; }
}

.remarks { margin: .4rem 0 0; color: var(--feed-pink); font-weight: 500; }
#import-text { font-family: ui-monospace, monospace; font-size: .85rem; margin-bottom: .8rem; }
tr.bad td { background: #fdeef4; color: var(--danger); }

@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; top: 0; inset-inline: 0; border: 0; }
}

/* صورة التلميذ */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-grid; place-items: center; font-weight: 800; color: #fff;
  background: var(--feed-gradient); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(60, 10, 120, .2);
}
.avatar.sm { width: 32px; height: 32px; font-size: .9rem; }
.avatar.md { width: 56px; height: 56px; font-size: 1.4rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 2.4rem; border-width: 3px; }
.who-cell { display: flex; align-items: center; gap: .6rem; }
.student-head { display: flex; gap: 1.2rem; align-items: center; }
.photo-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.photo-btn {
  position: absolute; top: 64px; inset-inline-start: 0; margin: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); box-shadow: 0 1px 6px rgba(0, 0, 0, .2); font-size: 1rem;
}
.child-head { display: flex; gap: .8rem; align-items: center; }
.child-head h3 { margin-bottom: .2rem; }

/* معلومات التلميذ */
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.2rem; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }
.badge.pack { background: var(--feed-gradient); color: #fff; }
.checks.disabled { opacity: .4; pointer-events: none; }
label.check.pack { margin-bottom: .5rem; }

/* المالية */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stats.compact .stat { padding: .7rem; }
.stats.compact .stat b { font-size: 1.3rem; }
.stat.good b { color: var(--good); }
.owed { color: var(--feed-pink); white-space: nowrap; }

@media (max-width: 600px) {
  .student-head { flex-direction: column; align-items: flex-start; }
  dl.info { grid-template-columns: 1fr; gap: .1rem; }
  dl.info dd { margin-bottom: .5rem; }
}

/* الحالة */
.badge.status-studying { background: #e6f7ee; color: var(--good); }
.badge.status-waiting { background: #fff3df; color: #a7610a; }
.badge.status-left { background: var(--soft-2); color: #4a5575; }
.badge.status-stopped { background: #fde8e8; color: var(--danger); }
.badge.free { background: #e6efff; color: var(--feed-indigo); }
.free-note { background: #e6efff; color: var(--feed-indigo); padding: .5rem .8rem; border-radius: 8px; }
label.free-check { align-self: end; margin-bottom: 1.1rem; }
.center { text-align: center; }
.hp { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }

/* لوحة القيادة */
.alert-card { display: block; background: #fff8ec; border-color: #f6d9a8; color: #8a4f06; }
.alert-card:hover { text-decoration: none; background: #fff1d9; }
.card.share { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1rem; }
.card.share code { background: var(--soft); padding: .2rem .5rem; border-radius: 6px; font-size: .85rem; word-break: break-all; }

/* المهام */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { padding: .7rem 0; border-top: 1px dashed var(--border); }
.tasks > .task:first-child { border-top: 0; }
.task > b { display: block; margin-top: .3rem; }
.task p { margin: .2rem 0 0; white-space: pre-wrap; }

/* الحضور */
.att { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.att-row {
  width: 100%; display: flex; align-items: center; gap: .6rem; font: inherit; text-align: start; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 10px; padding: .5rem .7rem; color: var(--text);
}
.att-row > span:not(.avatar) { flex: 1; }
.att-row .att-state::after { content: 'حاضر'; color: var(--good); font-size: .85rem; }
.att-row.absent { border-color: var(--feed-pink); background: #fdeef4; }
.att-row.absent .att-state::after { content: 'غائب'; color: var(--feed-pink); }
.att-summary { font-weight: 700; color: var(--feed-purple); }

/* التسجيل */
.register { max-width: 720px; margin: 0 auto; }
.register .login-hero { border-radius: var(--radius) var(--radius) 0 0; border-end-start-radius: 48px; }
.register form.card { border-radius: 0 0 var(--radius) var(--radius); }
.child-block { position: relative; margin-bottom: 1rem; }
.child-block .remove-child { position: absolute; top: .2rem; inset-inline-end: .5rem; }

/* القائمة الفرعية */
.nav-group {
  font: inherit; background: none; border: 0; cursor: pointer;
  padding: .35rem .9rem; border-radius: 999px; color: rgba(255, 255, 255, .85); white-space: nowrap;
}
.nav-group:hover, .nav-group[aria-expanded=true] { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-group.active { background: #fff; color: var(--feed-purple); font-weight: 700; }
.nav-group .caret { font-size: .7rem; opacity: .8; }
.subnav {
  position: absolute; z-index: 20; min-width: 210px; display: flex; flex-direction: column; padding: .4rem;
  background: var(--card); border-radius: 12px; box-shadow: 0 12px 32px rgba(40, 10, 90, .25); border: 1px solid var(--border);
}
.subnav a { padding: .55rem .9rem; border-radius: 8px; color: var(--text); }
.subnav a:hover { background: var(--soft); text-decoration: none; }
.subnav a.active { background: var(--soft); color: var(--feed-purple); font-weight: 700; }

/* جدول الأوقات */
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.day { background: var(--soft); border: 1px solid var(--border); border-radius: 10px; padding: .6rem; }
.day.today { border-color: var(--feed-purple); box-shadow: 0 0 0 2px #e4cdf3; }
.day h4 { margin: 0 0 .5rem; color: var(--feed-purple); font-size: 1rem; }
.slot { background: var(--card); border-radius: 8px; padding: .5rem .6rem; margin-bottom: .5rem; border-inline-start: 4px solid var(--feed-purple); box-shadow: 0 1px 3px rgba(60, 10, 120, .08); }
.slot-time { font-weight: 700; color: var(--feed-indigo); font-size: .9rem; }
.slot-child { color: var(--feed-pink); font-size: .85rem; font-weight: 500; }
.slot-actions { margin-top: .3rem; }

/* واتساب */
.btn.wa, .wa-btn { background: #25d366; color: #fff; display: inline-flex; align-items: center; gap: .35rem; }
.btn.wa:hover { background: #1ebe5b; text-decoration: none; }
.btn.wa.sent { background: #e6f7ee; color: var(--good); }
.wa-btn { padding: .15rem .35rem; border-radius: 6px; line-height: 0; }
.wa-btn:hover { background: #1ebe5b; }
.phone-line { display: inline-flex; align-items: center; gap: .4rem; }
.wa-groups .btn { margin: .2rem 0; }
.recipients { list-style: none; margin: 0; padding: 0; }
.recipients li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.recipients .owed { margin-inline-start: .4rem; }
.b-progress { font-weight: 700; color: var(--feed-purple); }

/* ساعات المعلمين */
tr.planned td { color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--soft); }
tfoot th { background: var(--soft); color: var(--feed-purple); font-weight: 700; }
input[type=month] { width: auto; }

/* ===== الرئيسية والمالية ===== */
:root { --profit: #2a78d6; --loss: #d03b3b; }
.in { color: var(--good); }
.out { color: var(--loss); }
.net { display: inline-block; font-weight: 700; font-size: .9rem; border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; }
.net.up { background: #e8f1fc; color: #1d5fae; }
.net.down { background: #fbe9e9; color: #a82828; }
.net.zero { background: var(--soft-2); color: var(--muted); }
.stat.profit b { color: var(--profit); }
.stat.loss b { color: var(--loss); }

.activity-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.card.activity h3 { margin: 0; }
.io { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .6rem; }
.io > div > b { display: block; font-size: 1.25rem; margin-bottom: .3rem; }
.line { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; padding: .15rem 0; }
.line.total { border-top: 1px solid var(--border); margin-top: .4rem; padding-top: .5rem; font-weight: 700; }
.card .line b { font-size: inherit; }

.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1.2rem 0 .6rem; }
.home-tile {
  display: flex; flex-direction: column; gap: .3rem; padding: 1.3rem; border-radius: 16px; color: #fff;
  background: var(--feed-gradient); box-shadow: 0 8px 24px rgba(60, 10, 120, .2); transition: transform .15s;
}
.home-tile:hover { text-decoration: none; transform: translateY(-2px); }
.home-tile .ico { font-size: 2.2rem; }
.home-tile b { font-size: 1.15rem; }
.home-tile small { opacity: .85; }
.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.alert-card ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; }

.class-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; align-items: center; }
.chip-wrap { display: inline-flex; align-items: center; }
.chip { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: .3rem .8rem; color: var(--text); }
.chip.on { background: var(--feed-purple); color: #fff; border-color: var(--feed-purple); }
.card.course { color: var(--text); display: block; }
.card.course:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(30, 50, 120, .1); }
.card.course h3 { margin: 0; }
.grid2.even { grid-template-columns: 1fr 1fr; }
.grid2 h4 { margin: 0 0 .4rem; color: var(--feed-purple); }
table.fin td { vertical-align: top; }

/* مخطط الصافي الشهري: عمود لكل شهر حول خط الصفر */
.netchart { display: flex; gap: 4px; align-items: stretch; height: 200px; padding: .5rem 0 1.6rem; margin-bottom: 1rem; }
.nc-col { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 18px; outline: none; }
.nc-half { flex: 1; display: flex; justify-content: center; }
.nc-half.up { align-items: flex-end; border-bottom: 1px solid #c9c3d3; }
.nc-half.down { align-items: flex-start; }
.nc-bar { width: min(60%, 28px); }
.nc-bar.pos { background: var(--profit); border-radius: 4px 4px 0 0; }
.nc-bar.neg { background: var(--loss); border-radius: 0 0 4px 4px; }
.nc-label { position: absolute; bottom: -1.5rem; inset-inline: 0; text-align: center; font-size: .75rem; color: var(--muted); }
.nc-tip {
  display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  background: #2a1840; color: #fff; font-size: .8rem; padding: .4rem .6rem; border-radius: 6px; pointer-events: none;
}
.nc-col:hover .nc-tip, .nc-col:focus .nc-tip { display: block; }
.nc-col:hover .nc-half { background: var(--soft); }

@media (max-width: 600px) {
  .io, .grid2.even { grid-template-columns: 1fr; }
  .nc-label { font-size: .6rem; }
}
.activity-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.line > span:last-child, .stat b, .io b { white-space: nowrap; }
div.phone-line { display: flex; }

/* القائمة: سطر واحد، وإن لم يتّسع تصبح قائمة عمودية قابلة للطيّ */
.menu-toggle {
  display: inline-flex; align-items: center; gap: .5rem; font: inherit; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; padding: .35rem .8rem;
}
.menu-toggle:hover { background: rgba(255, 255, 255, .2); }
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; position: relative; transition: .2s; }
.burger::before, .burger::after { content: ''; position: absolute; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.menu-toggle[aria-expanded=true] .burger { background: transparent; }
.menu-toggle[aria-expanded=true] .burger::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded=true] .burger::after { top: 0; transform: rotate(-45deg); }
.topbar.compact nav { display: none; }
.topbar.compact .menu-toggle { margin-inline-end: auto; }
.topbar.compact #who-name { display: none; }
.vmenu {
  position: absolute; top: 100%; inset-inline-start: 0; z-index: 30; margin: 6px 8px 0;
  width: min(340px, calc(100vw - 16px)); max-height: calc(100vh - 90px); overflow-y: auto;
  background: var(--card); border-radius: 14px; box-shadow: 0 16px 40px rgba(40, 10, 90, .3); border: 1px solid var(--border); padding: .5rem;
}
.vmenu a, .vmenu summary { display: block; padding: .6rem .9rem; border-radius: 8px; color: var(--text); cursor: pointer; }
.vmenu a:hover, .vmenu summary:hover { background: var(--soft); text-decoration: none; }
.vmenu a.active { background: var(--soft); color: var(--feed-purple); font-weight: 700; }
.vmenu summary { font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.vmenu summary::-webkit-details-marker { display: none; }
.vmenu summary::after { content: '▾'; transition: transform .2s; }
.vmenu details[open] > summary::after { transform: rotate(180deg); }
.vmenu details[open] > summary { color: var(--feed-purple); }
.vmenu details > a { padding-inline-start: 1.8rem; font-size: .95rem; }
.vmenu .vmenu-user { padding: .5rem .9rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); margin-top: .3rem; }

/* ===== إدارة المركز ===== */
.bell { position: relative; font-size: 1.15rem; text-decoration: none; line-height: 1; }
.bell:hover { text-decoration: none; }
#bell-count, #mail-count {
  position: absolute; top: -6px; inset-inline-end: -8px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--feed-pink); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .2rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; color: var(--text); }
.kpi:hover { text-decoration: none; border-color: var(--feed-purple); }
.kpi b { font-size: 1.35rem; font-weight: 800; color: var(--feed-purple); white-space: nowrap; }
.kpi b.in { color: var(--good); }
.kpi b.out { color: var(--loss); }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi small { display: block; font-size: .75rem; }
.alerts-box { border-color: #f6d9a8; }
.alert-line { display: block; padding: .35rem .5rem; border-radius: 6px; color: var(--text); }
.alert-line:hover { background: #fff8ec; text-decoration: none; }
.alert-line.urgent { color: #a82828; font-weight: 700; }
.home-tile.alt { background: linear-gradient(120deg, #3a1d6e, #7a2a8c); }

.programs { display: flex; flex-wrap: wrap; gap: .3rem; }
.prog-tag { background: var(--soft); color: var(--feed-purple); border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; white-space: nowrap; }
.prog-tag:hover { text-decoration: none; background: #e4cdf3; }
.prog-tag.off { background: var(--soft-2); color: var(--muted); text-decoration: line-through; }

.debts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: .8rem; }
.card.debt { margin: 0; border-inline-start: 4px solid #e9e1f2; }
.card.debt.high { border-inline-start-color: var(--loss); }
.card.debt.medium { border-inline-start-color: var(--warn); }
.debt-total { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.debt-total b { font-size: 1.2rem; }
.debt-items { list-style: none; margin: .5rem 0 0; padding: 0; }
.debt-items li { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; padding: .2rem 0; border-top: 1px dashed var(--border); }

.receipt-link { font-size: .8rem; white-space: nowrap; }
.receipt { max-width: 640px; margin: 0 auto; background: var(--card); border: 2px solid var(--feed-purple); border-radius: 14px; padding: 1.5rem; }
.receipt-head { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid #f1e8f8; padding-bottom: 1rem; }
.receipt-head img { height: 48px; }
.receipt-head h2 { margin: 0; }
.receipt-head p { margin: 0; }
.receipt-no { margin-inline-start: auto; text-align: center; color: var(--muted); font-size: .85rem; }
.receipt-no b { display: block; font-size: 1.6rem; color: var(--feed-purple); }
.receipt-body { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.2rem; margin: 1.2rem 0; }
.receipt-body dt { color: var(--muted); }
.receipt-body dd { margin: 0; }
.receipt-amount { font-size: 1.3rem; background: var(--soft); border-radius: 10px; padding: .8rem 1rem; text-align: center; }
.receipt-amount b { color: var(--feed-purple); font-size: 1.6rem; }
.receipt-sign { margin-top: 2.5rem; display: flex; justify-content: flex-end; }
.receipt-sign span { border-top: 1px solid #999; padding-top: .3rem; min-width: 180px; text-align: center; color: var(--muted); }
@media print {
  .no-print { display: none !important; }
  .receipt { border-color: #333; }
}

.fee-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
ul.help li { margin-bottom: .4rem; }
.card.course.cancelled { opacity: .55; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; align-items: start; }
.board-col { background: var(--soft); border: 1px solid var(--border); border-radius: 12px; padding: .7rem; }
.board-col h4 { margin: 0 0 .6rem; color: var(--feed-purple); }
.task-card { background: var(--card); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .6rem; border-inline-start: 4px solid var(--feed-purple); box-shadow: 0 1px 3px rgba(60, 10, 120, .08); }
.task-card.problem { border-inline-start-color: var(--loss); }
.task-card.late { background: #fdf3f3; }
.task-card b { display: block; margin: .3rem 0 .1rem; }
.task-card p { margin: .2rem 0; white-space: pre-wrap; }
.task-actions { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .3rem; }
.pre { white-space: pre-wrap; margin: .2rem 0 .6rem; }
.meeting h4 { margin: .8rem 0 .3rem; color: var(--feed-purple); }
.decisions { list-style: none; margin: 0 0 .6rem; padding: 0; }
.decisions li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .4rem 0; border-top: 1px dashed var(--border); }
.decisions li > span:nth-child(2) { flex: 1; }
a.card.alert { display: block; color: var(--text); border-inline-start: 5px solid var(--border); }
a.card.alert:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(30, 50, 120, .1); }
a.card.alert.urgent { border-inline-start-color: var(--loss); background: var(--soft); }
a.card.alert.warning { border-inline-start-color: var(--warn); }
a.card.alert.info { border-inline-start-color: var(--profit); }
a.card.alert ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; color: var(--muted); font-size: .9rem; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.home-tiles { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ===== بطاقة التقييم الشهرية (A4، كالبطاقة الورقية) ===== */
.rc-wrap { display: grid; gap: 1.2rem; }
.rc-sheet {
  --pu: #4C2786; --pk: #EFC3E4; --line: #1a1a1a;
  background: #fff; color: #141414; max-width: 210mm; width: 100%; margin: 0 auto; padding: 12mm 11mm 8mm;
  box-shadow: 0 10px 40px -18px rgba(60, 20, 110, .45); display: flex; flex-direction: column;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 7mm; }
.rc-title { display: flex; align-items: center; gap: .7rem; color: var(--pu); }
.rc-title h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; color: var(--pu); }
.rc-title small { display: block; color: #8a72b0; font-size: .8rem; margin-top: 2px; }
.rc-logo { height: 42px; width: auto; }
.rc-id { display: grid; grid-template-columns: 1fr 1fr auto; border: 1.4px solid var(--line); margin-bottom: 6mm; }
.rc-id > div { padding: .55rem .8rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.rc-id > div + div { border-inline-start: 1.4px solid var(--line); }
.rc-id span { font-weight: 500; color: #444; }
.rc-ph { padding: 4px !important; }
.rc-ph img, .rc-ph i { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; display: block; background: var(--pk); }
.rc-box { border: 1.4px solid var(--line); margin-bottom: 6mm; break-inside: avoid; }
.rc-box > h2 { margin: 0; background: var(--pk); color: var(--pu); font-size: .95rem; text-align: center; padding: .4rem; border-bottom: 1.4px solid var(--line); }
.rc-in { padding: .6rem 1rem .8rem; line-height: 1.85; }
.rc-sheet p { margin: 0 0 4px; white-space: pre-line; }
.rc-dl { border-bottom: 1.2px dotted #9a9a9a; height: 24px; }
.rc-sheet table { width: 100%; border-collapse: collapse; background: #fff; }
.rc-sheet thead th { font-weight: 500; font-size: .85rem; padding: .5rem; border-bottom: 1.4px solid var(--line); color: #333; background: #fff; }
.rc-sheet thead th + th, .rc-sheet td, .rc-sheet tbody th + td { border-inline-start: 1.4px solid var(--line); }
.rc-sheet tbody tr + tr > * { border-top: 1.4px solid var(--line); }
.rc-sheet tbody th { width: 20%; color: var(--pu); padding: .6rem; text-align: center; }
.rc-sheet td { vertical-align: top; padding: .6rem .8rem; font-size: .9rem; line-height: 1.8; }
.rc-sheet td:nth-child(2) { width: 52%; }
.rc-sheet tbody tr { height: 26mm; break-inside: avoid; }
.rc-tag { margin-bottom: 4px; color: #444; }
.rc-bd { display: inline-block; padding: 0 .65rem; border-radius: 999px; font-weight: 700; font-size: .82rem; color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
.rc-foot { margin-top: auto; padding-top: 6mm; display: flex; justify-content: center; align-items: center; gap: 1.5rem; color: var(--pu); font-size: .85rem; }
.rc-foot img { height: 28px; width: auto; }
@media (max-width: 600px) {
  .rc-sheet { padding: 1rem; }
  .rc-title h1 { font-size: 1.15rem; }
  .rc-id { grid-template-columns: 1fr auto; }
  .rc-id > div:nth-child(2) { grid-column: 1; grid-row: 2; border-inline-start: 0; border-top: 1.4px solid var(--line); }
  .rc-id .rc-ph { grid-row: 1 / span 2; grid-column: 2; }
  .rc-sheet td, .rc-sheet tbody th { padding: .45rem; font-size: .82rem; }
}
@media print {
  @page { size: A4; margin: 10mm; }
  .rc-wrap { display: block; }
  .rc-sheet { box-shadow: none; max-width: none; padding: 0; min-height: 275mm; page-break-after: always; break-after: page; }
  .rc-sheet:last-child { page-break-after: auto; break-after: auto; }
}

/* مستويات المعلم في كل مادة */
.subject-levels { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; padding: .25rem 0; border-bottom: 1px dashed var(--border); }
.lv-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.chip-check { display: inline-flex; align-items: center; gap: .2rem; font-size: .8rem; background: var(--soft); border-radius: 999px; padding: .1rem .5rem; cursor: pointer; }
.chip-check input { margin: 0; }


/* ===== الوضع الليلي (حسب إعداد الهاتف) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #15101d;
    --card: #211a2c;
    --text: #ece5f6;
    --muted: #a99cbd;
    --border: #3a2e4b;
    --soft: #2a2137;
    --soft-2: #262b38;
    --feed-purple: #b77ae6;
    --primary: #8a3cc4;
    --primary-dark: #6f2aa6;
    --good: #3cc488;
    --profit: #6aa8ef;
    --loss: #f07070;
    --danger: #f07070;
  }
  .net.up { background: #1d2c40; color: #8cbcf5; }
  .net.down { background: #3a1f24; color: #f3a3a3; }
  .alert-card, .alert-line:hover { background: #33281a; color: #f2c98a; border-color: #5a4320; }
  input:focus, select:focus, textarea:focus { outline-color: #5b3a7a; }
  .badge { filter: brightness(.92); }
}
@media print {
  :root { --bg: #fff; --card: #fff; --text: #2a1840; --muted: #76688a; --border: #e9e1f2; --soft: #f6f0fb; --feed-purple: #61038d; color-scheme: light; }
}

/* ===== الرسائل ===== */
.who { gap: .9rem; }
.threads { display: grid; gap: .6rem; }
.card.thread { display: block; color: var(--text); border-inline-start: 4px solid var(--border); }
.card.thread:hover { text-decoration: none; border-color: var(--feed-purple); }
.card.thread.unread { border-inline-start-color: var(--feed-pink); }
.card.thread.closed { opacity: .7; }
.card.thread p { margin: .3rem 0 0; }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--feed-pink); color: #fff; font-size: .8rem; font-weight: 700; }
.chat { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; }
.bubble { max-width: min(85%, 560px); background: var(--card); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: .5rem .8rem; align-self: flex-end; }
.bubble.mine { align-self: flex-start; background: var(--soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.bubble p { margin: .2rem 0 0; white-space: pre-line; }
.who-line { font-size: .78rem; color: var(--muted); }

/* ===== إدخال البطاقات ونظرة القسم ===== */
.cv-row { padding: .7rem .9rem; }
.cv-name { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.cv-row label { margin-bottom: .4rem; }
.cv-row .row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sticky-save { position: sticky; bottom: 0; padding: .7rem 0; background: linear-gradient(transparent, var(--bg) 35%); }
table.overview th, table.overview td { text-align: center; vertical-align: top; }
table.overview tbody th { text-align: start; white-space: nowrap; background: var(--card); color: var(--text); }
table.overview td.na { color: var(--muted); }
.tiny { font-size: .7rem; }

/* رفع صورة التلميذ */
.photo-wrap.uploading { position: relative; }
.photo-wrap.uploading::after {
  content: 'جاري الرفع…'; position: absolute; inset: auto 0 -1.4rem; text-align: center;
  font-size: .75rem; color: var(--feed-purple); font-weight: 700;
}
.photo-wrap.uploading .avatar { opacity: .6; }

/* رفع صور بالجملة */
.bp-list { display: grid; gap: .6rem; margin: .8rem 0; }
.bp-item { display: flex; align-items: center; gap: .7rem; padding: .5rem; border: 1px solid var(--border, #ddd); border-radius: 10px; }
.bp-item.done { opacity: .7; }
.bp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.bp-body .muted { text-align: right;  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-sel { width: 100%; }
.status-quick { width: auto; padding: .15rem 1.6rem .15rem .5rem; font-size: .85rem; border-radius: 999px; font-weight: 600; }
.status-quick.status-waiting { background: #fff4d6; }
.status-quick.status-left, .status-quick.status-stopped { background: #fde2e2; }
.status-quick.status-studying { background: #e3f6e8; }
.pill.small { font-size: .75rem; padding: .05rem .45rem; }

/* Google */
.google-box { margin-top: .8rem; }
.google-box .or { display: flex; align-items: center; gap: .6rem; color: var(--muted, #888); margin: .4rem 0 .8rem; }
.google-box .or::before, .google-box .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
#google-btn { display: flex; justify-content: center; min-height: 44px; }
.gl-picked { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.gl-results { display: grid; gap: .3rem; margin-bottom: .5rem; }
.gl-result { text-align: start; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; cursor: pointer; font: inherit; color: inherit; }
.gl-result .add { float: left; color: var(--primary, #4C2786); font-weight: 600; }
.gl-new summary { cursor: pointer; color: var(--primary, #4C2786); margin: .4rem 0; }
.vmenu a.top { font-weight: 700; }
.nav-sub { font-weight: 700; color: var(--feed-purple); padding: .7rem .9rem .3rem; margin-top: .3rem; border-top: 1px solid var(--border); font-size: .95rem; }
.vmenu details .nav-sub { padding-inline-start: .9rem; }
.cat-row { display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: .6rem; padding: .35rem 0; }
.cat-bar { background: var(--soft); border-radius: 999px; height: .55rem; overflow: hidden; }
.cat-bar i { display: block; height: 100%; background: var(--feed-purple); border-radius: 999px; }
.adj-note { margin-top: .25rem; color: var(--feed-purple); }
.adj-note s { margin-inline-start: .3rem; }

/* لوحة مالية نشاط */
.fin-board { display: block; }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fb-head h3 { margin: 0; }
.fb-head input[type=month] { width: auto; min-width: 11rem; }
.fb-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.fb-kpi { border: 1px solid var(--border); border-radius: 14px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; background: var(--card); border-inline-start: 5px solid var(--border); }
.fb-kpi span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.fb-kpi b { font-size: 1.55rem; font-weight: 800; white-space: nowrap; }
.fb-kpi small { color: var(--muted); font-size: .78rem; }
.fb-kpi.in { border-inline-start-color: #1f9d55; } .fb-kpi.in b { color: #1f9d55; }
.fb-kpi.out { border-inline-start-color: #e11d74; } .fb-kpi.out b { color: #e11d74; }
.fb-kpi.net { border-inline-start-color: var(--feed-purple); background: var(--soft); } .fb-kpi.net b { color: var(--feed-purple); }
.fb-kpi.net.neg { border-inline-start-color: #dc2626; } .fb-kpi.net.neg b { color: #dc2626; }
.fb-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.fb-panel { border: 1px solid var(--border); border-radius: 14px; padding: .9rem 1rem; }
.fb-panel h4 { margin: 0 0 .6rem; font-size: .95rem; color: var(--feed-purple); }
.fb-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.fb-row:last-child { border-bottom: 0; }
.fb-row b { white-space: nowrap; font-weight: 700; }
.fb-row.in b { color: #1f9d55; } .fb-row.out b { color: #e11d74; } .fb-row.muted { color: var(--muted); }
.fb-row.total { border-top: 2px solid var(--border); border-bottom: 0; margin-top: .3rem; padding-top: .6rem; font-weight: 700; }
.fb-progress { height: .45rem; background: var(--soft); border-radius: 999px; overflow: hidden; margin: .1rem 0 .2rem; }
.fb-progress i { display: block; height: 100%; background: #1f9d55; border-radius: 999px; }
.fb-year { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .7rem; }
.fb-year summary { cursor: pointer; color: var(--feed-purple); font-weight: 700; }
@media (max-width: 700px) {
  .fb-kpis { gap: .4rem; }
  .fb-cols { grid-template-columns: 1fr; }
  .fb-kpi { padding: .6rem .5rem; border-inline-start-width: 4px; text-align: center; align-items: center; }
  .fb-kpi b { font-size: 1.05rem; }
  .fb-kpi span { font-size: .78rem; }
  .fb-kpi small { font-size: .68rem; }
}
.seg { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.debt { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.debt:last-child { border-bottom: 0; }
.debt.done { opacity: .65; }
.debt-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.debt-amt { text-align: left; white-space: nowrap; }
.debt-amt b { font-size: 1.1rem; margin-inline-end: .3rem; }
.debt-actions { margin-top: .3rem; display: flex; gap: .6rem; align-items: center; }

/* =====================================================================
   تصميم فيد 2026: قائمة جانبية بيضاء، بطاقات ناعمة، شريط سفلي في الهاتف
   ===================================================================== */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1d1433;
  --muted: #7b7393;
  --border: #ebe8f3;
  --soft: #f3effb;
  --soft-2: #eef2fb;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(29, 20, 51, .04);
  --shadow: 0 1px 2px rgba(29, 20, 51, .04), 0 8px 24px rgba(42, 24, 92, .06);
  --shadow-lg: 0 18px 50px rgba(42, 24, 92, .14);
  --ring: 0 0 0 4px rgba(124, 58, 237, .14);
  --side-w: 268px;
  --hero: linear-gradient(125deg, #3b1fb3 0%, #5b21b6 45%, #7c3aed 75%, #a855f7 100%);
}
body { font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif; font-size: 15.5px; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--text); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
.stat b, .fb-kpi b, .kpi b { font-family: 'Tajawal', 'IBM Plex Sans Arabic', sans-serif; }

/* بطاقات */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; }
.card h3 { display: flex; align-items: center; gap: .45rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.section-head h3 { margin: 0; }

/* أرقام المؤشرات */
.stats { gap: 1rem; }
.stat {
  border-radius: var(--radius); box-shadow: var(--shadow); text-align: start; padding: 1.05rem 1.15rem;
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: .25rem; position: relative; overflow: hidden;
}
.stat::after { content: ''; position: absolute; inset-inline-end: -26px; top: -26px; width: 84px; height: 84px; border-radius: 50%; background: var(--soft); opacity: .9; }
.stat.good::after { background: #e7f8ef; } .stat.warn::after { background: #fde8f1; } .stat.profit::after { background: #e8f0fe; } .stat.loss::after { background: #fdeaea; }
.stat > * { position: relative; z-index: 1; }
.stat span { font-size: .85rem; font-weight: 500; }
.stat b { font-size: 1.75rem; line-height: 1.15; }
.stats.compact .stat { padding: .8rem .95rem; }

/* أزرار وحقول */
.btn { border-radius: 12px; font-weight: 600; padding: .55rem 1.05rem; box-shadow: 0 6px 16px rgba(97, 3, 141, .18); transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(97, 3, 141, .22); }
.btn.ghost, .btn.danger { box-shadow: none; background: var(--card); }
.btn.ghost:hover, .btn.danger:hover { transform: none; box-shadow: none; }
.btn.small { border-radius: 10px; padding: .3rem .7rem; }
input, select, textarea { border-radius: 12px !important; border: 1px solid var(--border) !important; background: var(--card); padding: .6rem .8rem !important; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none !important; border-color: #a78bfa !important; box-shadow: var(--ring); }
label.check input, input[type=checkbox], input[type=radio] { padding: 0 !important; box-shadow: none; }

/* جداول */
.table-wrap { border: 1px solid var(--border); border-radius: 16px; overflow: auto; background: var(--card); box-shadow: var(--shadow-sm); }
.card .table-wrap { box-shadow: none; }
th { background: #faf9fd; font-weight: 600; font-size: .82rem; color: var(--muted); letter-spacing: .01em; }
th, td { border-bottom-color: #f0eef6; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #faf8ff; }
tbody tr:last-child td { border-bottom: 0; }

.pill { background: var(--soft); border-radius: 999px; font-weight: 500; padding: .1rem .65rem; }
.badge { border-radius: 999px; padding: .05rem .55rem; font-weight: 600; }
.chip { border-radius: 999px; }
.chip.on { background: var(--feed-purple); color: #fff; border-color: transparent; }
dialog { border-radius: 22px !important; box-shadow: var(--shadow-lg) !important; border: 0 !important; }
.toast { border-radius: 14px !important; box-shadow: var(--shadow-lg); }

/* ---------- الهيكل: شريط علوي + قائمة جانبية ---------- */
body.shell .topbar #nav, body.shell .topbar .menu-toggle, body.shell .subnav { display: none !important; }
.vmenu .i, .tabbar .i { width: 20px; height: 20px; flex: none; }
.vmenu .side-brand { display: none; }
.vmenu .side-links { display: flex; flex-direction: column; gap: 2px; }
.vmenu a.top, .vmenu summary { display: flex; align-items: center; gap: .7rem; font-weight: 600; border-radius: 12px; padding: .62rem .8rem; color: #4a4262; }
.vmenu summary::after { margin-inline-start: auto; font-size: .7rem; opacity: .6; }
.vmenu details > a, .vmenu details > .nav-sub { margin-inline-start: 1.55rem; padding-inline-start: .9rem !important; border-inline-start: 2px solid var(--border); border-radius: 0 10px 10px 0; }
.vmenu details > a { font-size: .9rem; padding-block: .42rem; color: var(--muted); font-weight: 500; }
.vmenu details > a.active { color: var(--feed-purple); border-inline-start-color: var(--feed-purple); background: var(--soft); font-weight: 700; }
.vmenu details > .nav-sub { border-top: 0; margin-top: 0; padding-top: .55rem; font-size: .78rem; text-transform: none; color: #9a92b3; letter-spacing: .02em; }
.vmenu a.top.active { background: var(--feed-purple); color: #fff; box-shadow: 0 8px 18px rgba(97, 3, 141, .25); }
.vmenu details[open] > summary { color: var(--feed-purple); background: var(--soft); }
.vmenu .vmenu-user { display: flex; align-items: center; gap: .65rem; margin-top: auto; padding: .8rem; border: 1px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text); }
.vmenu .vmenu-user div { min-width: 0; flex: 1; line-height: 1.25; }
.vmenu .vmenu-user b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmenu .vmenu-user small { color: var(--muted); font-size: .78rem; }
.side-out { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 10px; }
.side-out:hover { background: var(--soft); color: var(--danger); }

@media (min-width: 1024px) {
  body.shell { padding-inline-start: var(--side-w); }
  body.shell .vmenu, body.shell .vmenu[hidden] {
    display: flex !important; flex-direction: column; gap: .8rem;
    position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); max-height: none;
    background: var(--card); border: 0; border-inline-end: 1px solid var(--border); border-radius: 0;
    box-shadow: none; padding: 1.1rem .9rem 1rem; overflow-y: auto; z-index: 6; margin: 0;
  }
  body.shell .vmenu .side-brand { display: block; padding: .3rem .6rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
  body.shell .vmenu .side-brand img { height: 34px; }
  body.shell .topbar {
    background: rgba(244, 245, 251, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    color: var(--text); box-shadow: none; border-bottom: 1px solid var(--border); padding: .65rem 1.6rem; justify-content: flex-end;
  }
  body.shell .topbar .brand { display: none; }
  body.shell .who { color: var(--text); }
  body.shell .topbar .btn.ghost { color: var(--feed-purple); border-color: var(--border); background: var(--card); }
  body.shell .bell { background: var(--card); border: 1px solid var(--border); border-radius: 12px; width: 38px; height: 38px; display: inline-grid; place-items: center; }
  body.shell .container { max-width: 1240px; padding: 1.6rem 1.8rem 3rem; }
  .tabbar { display: none !important; }
}

/* ---------- الهاتف واللوحة: شريط سفلي وقائمة منبثقة من الأسفل ---------- */
@media (max-width: 1023px) {
  body.shell { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.shell .topbar { padding: .55rem 1rem; }
  body.shell .topbar #who-name { display: none; }
  body.shell .topbar #logout { display: none; }
  .tabbar {
    position: fixed; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 6px;
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem .1rem; border-radius: 16px;
    color: #8a83a3; font: inherit; font-size: .7rem; font-weight: 600; background: none; border: 0; cursor: pointer;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .on { color: var(--feed-purple); background: var(--soft); }
  body.shell .vmenu {
    position: fixed !important; inset-inline: 0 !important; bottom: 0 !important; top: auto !important; width: auto !important;
    max-height: 78vh; overflow-y: auto; z-index: 40; margin: 0 !important;
    border-radius: 24px 24px 0 0 !important; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -18px 50px rgba(29, 20, 51, .22) !important; border: 0 !important; display: flex; flex-direction: column; gap: .7rem;
    animation: sheet-up .22s ease-out;
  }
  body.shell .vmenu::before { content: ''; width: 44px; height: 5px; border-radius: 99px; background: #ddd8ea; align-self: center; margin-bottom: .2rem; }
  body.sheet-open::after { content: ''; position: fixed; inset: 0; background: rgba(20, 12, 40, .35); z-index: 35; }
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- لافتة الترحيب ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 1.5rem 1.6rem; margin-bottom: 1.2rem;
  background: var(--hero); color: #fff; box-shadow: 0 18px 40px rgba(76, 29, 149, .28);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero::before { width: 220px; height: 220px; inset-inline-end: -60px; top: -90px; }
.hero::after { width: 140px; height: 140px; inset-inline-end: 140px; bottom: -80px; background: rgba(255, 255, 255, .07); }
.hero > * { position: relative; z-index: 1; }
.hero small { opacity: .85; font-size: .82rem; }
.hero h2 { color: #fff; margin: .2rem 0 .3rem; font-size: 1.55rem; }
.hero p { margin: 0; opacity: .9; max-width: 46ch; font-size: .95rem; }
.hero .hero-art { font-size: 3.4rem; line-height: 1; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .18)); }
.hero .hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.hero .btn { background: #fff; color: var(--feed-purple); box-shadow: none; }
.hero .btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .3); }
.hero input[type=month] { background: rgba(255, 255, 255, .95); }
@media (max-width: 600px) { .hero { padding: 1.2rem; } .hero h2 { font-size: 1.25rem; } .hero .hero-art { font-size: 2.4rem; } }

/* بلاطات الرئيسية */
.home-tile { border-radius: 20px !important; box-shadow: var(--shadow); }

/* الوضع الداكن للعناصر الجديدة */
@media (prefers-color-scheme: dark) {
  :root { --bg: #120d1b; --card: #1d1628; --text: #efe9f8; --muted: #a69cbd; --border: #2f2640; --soft: #281f36; --shadow: 0 1px 2px rgba(0,0,0,.3); }
  th { background: #221a2e; }
  tbody tr:hover { background: #231b30; }
  .tabbar { background: rgba(29, 22, 40, .94); }
  body.shell .topbar { background: rgba(18, 13, 27, .8); }
  .vmenu a.top, .vmenu summary { color: #cfc6e2; }
  .stat.good::after, .stat.warn::after, .stat.profit::after, .stat.loss::after { background: var(--soft); }
}
@media print {
  body.shell { padding: 0 !important; }
  .vmenu, .tabbar, .topbar { display: none !important; }
}
/* المؤشرات في الرئيسية: بطاقات ناعمة، عمودان في الهاتف */
.kpi { border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.kpi::after { content: ''; position: absolute; inset-inline-end: -24px; top: -24px; width: 76px; height: 76px; border-radius: 50%; background: var(--soft); }
.kpi > * { position: relative; z-index: 1; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border); }
.kpi b { font-family: 'Tajawal', sans-serif; font-size: 1.5rem; }
@media (max-width: 600px) {
  .kpis, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: .6rem; }
  .kpi, .stat { padding: .8rem .85rem; }
  .kpi b, .stat b { font-size: 1.2rem; }
}
.brand .logo-dark { display: none; }
body.shell .topbar {
  background: rgba(244, 245, 251, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--text); box-shadow: none; border-bottom: 1px solid var(--border);
}
body.shell .brand .logo-light { display: none; }
body.shell .brand .logo-dark { display: block; height: 28px; }
body.shell .brand span { display: none; }
body.shell .who { color: var(--text); margin-inline-start: auto; }
body.shell .bell { background: var(--card); border: 1px solid var(--border); border-radius: 12px; width: 38px; height: 38px; display: inline-grid; place-items: center; position: relative; }
@media (min-width: 1024px) {
  body.shell #who-name, body.shell .topbar #logout { display: none; }
}
.vmenu details > a, .vmenu details > .nav-sub { border-radius: 0 !important; }
.vmenu details > a.active { border-radius: 0 10px 10px 0 !important; }
[dir=rtl] .vmenu details > a.active { border-radius: 10px 0 0 10px !important; }
@media (prefers-color-scheme: dark) {
  body.shell .topbar { background: rgba(18, 13, 27, .82); }
  body.shell .brand .logo-dark { display: none; }
  body.shell .brand .logo-light { display: block; height: 28px; }
}
.pill { white-space: nowrap; }

/* ---------- القوائم المنسدلة ومنتقي الشهر ---------- */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-size: 16px !important; background-position: left .8rem center !important;
  padding-left: 2.4rem !important; font-weight: 500;
}
select:hover { border-color: #c4b5fd !important; }
[dir=ltr] select { background-position: right .8rem center !important; padding-right: 2.4rem !important; }
.mpick { position: relative; display: inline-flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 3px; box-shadow: var(--shadow-sm); }
.mpick button { font: inherit; border: 0; background: none; cursor: pointer; color: var(--text); }
.mp-step { width: 34px; height: 34px; border-radius: 10px; font-size: 1.5rem; line-height: 1; color: var(--feed-purple) !important; font-weight: 700; }
.mp-step:hover, .mp-label:hover { background: var(--soft); }
.mp-label { min-width: 8.5rem; height: 34px; padding: 0 .8rem; border-radius: 10px; font-weight: 700 !important; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.mp-label::before { content: ''; width: 16px; height: 16px; background: currentColor; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center/contain no-repeat; }
.mp-pop { position: fixed; z-index: 1000; width: 268px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: .7rem; color: var(--text); }
.mp-year { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.mp-year button { width: 32px; height: 32px; border-radius: 10px; color: var(--feed-purple); font-size: 1.1rem; font-weight: 700; }
.mp-year button:hover { background: var(--soft); }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mp-grid button { padding: .5rem .2rem; border-radius: 10px; font-size: .88rem; font-weight: 500; }
.mp-grid button:hover { background: var(--soft); }
.mp-grid button.now { box-shadow: inset 0 0 0 1px #c4b5fd; }
.mp-grid button.on { background: var(--feed-purple); color: #fff; font-weight: 700; }
.hero .mpick { background: rgba(255, 255, 255, .96); border-color: transparent; }
.page-head .mpick, .filters .mpick { flex: none; }
label .mpick { display: flex; margin-top: .3rem; }
label .mp-label { flex: 1; justify-content: flex-start; }
.mp-pop button { font: inherit; border: 0; background: none; cursor: pointer; color: var(--text); }
.mp-pop .mp-year button { color: var(--feed-purple); }
.mp-pop .mp-grid button.on { background: var(--feed-purple); color: #fff; }
.mp-step, .mp-year button { display: inline-grid; place-items: center; }
.mp-step svg, .mp-year svg { pointer-events: none; }
.lv-chipset { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.lv-chip { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 .55rem; border-radius: 8px; background: var(--soft); color: var(--feed-purple); font-weight: 700; font-size: .82rem; white-space: nowrap; }
.lv-chip.all { background: #e7f8ef; color: #1f7a4d; }
.chip-check.lg { font-size: .9rem; padding: .35rem .8rem; font-weight: 600; } .chip-check:has(input:checked) { background: var(--feed-purple); color: #fff; }
.sal-split { display: grid; gap: .5rem; margin-bottom: 1rem; }
.sal-bar { position: relative; display: flex; justify-content: space-between; gap: 1rem; padding: .65rem .9rem; border-radius: 12px; background: var(--card); border: 1px solid var(--border); overflow: hidden; font-weight: 600; }
.sal-bar > * { position: relative; z-index: 1; }
.sal-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--soft); z-index: 0; }
/* لوحة المشرف */
.seg.on-dark { margin: 0; }
.seg.on-dark .chip { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.seg.on-dark .chip.on { background: #fff; color: var(--feed-purple); }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: .3rem; vertical-align: middle; }
.legend i.ex { background: repeating-linear-gradient(45deg, #fda4af 0 3px, #fecdd3 3px 6px); }
.bchart { display: grid; grid-template-columns: repeat(12, 1fr); gap: .45rem; height: 260px; align-items: end; padding-top: 1rem; }
.bcol { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; outline: none; }
.bcol.future { opacity: .35; }
.bbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; min-height: 0; }
.bstack { width: 46%; height: 100%; display: flex; flex-direction: column-reverse; }
.bstack i { display: block; width: 100%; }
.bstack i:last-child { border-radius: 6px 6px 0 0; }
.bex { width: 30%; border-radius: 6px 6px 0 0; background: repeating-linear-gradient(45deg, #fda4af 0 3px, #fecdd3 3px 6px); }
.bnet { font-size: .7rem; font-weight: 700; color: var(--good); font-family: 'Tajawal', sans-serif; }
.bnet.neg { color: var(--danger); }
.blab { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.btip { display: none; position: absolute; bottom: 100%; z-index: 5; background: #1d1433; color: #fff; padding: .45rem .6rem; border-radius: 10px; font-size: .75rem; white-space: nowrap; line-height: 1.5; }
.bcol:hover .btip, .bcol:focus .btip { display: block; }
.tiny { font-size: .72rem; }
@media (max-width: 700px) { .bchart { gap: .2rem; height: 200px; } .blab { font-size: .62rem; } .bnet { display: none; } }
.fin td, .fin th { white-space: nowrap; }

/* ---------- بطاقات أشهر الخلاص ---------- */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .7rem; margin-bottom: .8rem; }
.mcard { border: 1px solid var(--border); border-radius: 16px; padding: .75rem .9rem; background: var(--card); border-inline-start: 4px solid var(--border); }
.mcard.ok { border-inline-start-color: #22c55e; }
.mcard.due { border-inline-start-color: #ef4444; }
.mcard.part { border-inline-start-color: #f59e0b; }
.mcard header { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.mcard header > b { font-size: 1rem; white-space: nowrap; }
.mc-edit { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .25rem; font: inherit; font-size: .8rem; font-weight: 600; color: var(--feed-purple);
  background: var(--soft); border: 0; border-radius: 999px; padding: .25rem .65rem; cursor: pointer; white-space: nowrap; }
.mc-edit:hover { background: #ede4fb; }
.mc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; background: #faf9fd; border-radius: 12px; padding: .5rem .6rem; }
.mc-nums div { display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.mc-nums small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.mc-nums b { font-family: 'Tajawal', sans-serif; font-size: 1.02rem; white-space: nowrap; }
.mc-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.mc-tag { font-size: .75rem; background: var(--soft-2); color: #475569; border-radius: 999px; padding: .12rem .6rem; }
.mc-tag.adj { background: #f3e8ff; color: var(--feed-purple); font-weight: 600; }
.mc-tag s { opacity: .6; margin-inline-start: .2rem; }
.mc-pays { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .25rem; }
.mc-pays li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-size: .82rem; padding-top: .3rem; border-top: 1px dashed var(--border); }
.mc-acts { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.mc-acts .link.danger { font-size: .9rem; padding: 0 .2rem; }
@media (prefers-color-scheme: dark) { .mc-nums { background: #241c31; } .mc-tag { background: #262b38; color: #cbd5e1; } }

/* ---------- الجداول في الهاتف تتحوّل إلى بطاقات ---------- */
@media (max-width: 640px) {
  .table-wrap:not(.as-table) { border: 0; background: none; box-shadow: none; overflow: visible; }
  .table-wrap:not(.as-table) table, .table-wrap:not(.as-table) tbody, .table-wrap:not(.as-table) tfoot, .table-wrap:not(.as-table) tr, .table-wrap:not(.as-table) td, .table-wrap:not(.as-table) th { display: block; width: 100%; }
  .table-wrap:not(.as-table) thead { display: none; }
  .table-wrap:not(.as-table) tr { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: .55rem .85rem; margin-bottom: .6rem; box-shadow: var(--shadow-sm); }
  .table-wrap:not(.as-table) tfoot tr { background: var(--soft); }
  .table-wrap:not(.as-table) td, .table-wrap:not(.as-table) tfoot th { border: 0; padding: .3rem 0; text-align: end; white-space: normal; overflow-wrap: anywhere; min-height: 1.9rem; }
  .table-wrap:not(.as-table) td::before, .table-wrap:not(.as-table) tfoot th::before { content: attr(data-label); float: inline-start; margin-inline-end: 1rem; color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.9; }
  .table-wrap:not(.as-table) td:first-child, .table-wrap:not(.as-table) tfoot th:first-child { text-align: start; font-size: 1rem; padding-bottom: .45rem; margin-bottom: .2rem; border-bottom: 1px dashed var(--border); }
  .table-wrap:not(.as-table) td:first-child::before, .table-wrap:not(.as-table) tfoot th:first-child::before, .table-wrap:not(.as-table) td[data-label=""]::before { display: none; }
  .table-wrap:not(.as-table) td:empty { display: none; }
  .table-wrap:not(.as-table) td.row-actions { text-align: start; padding-top: .45rem; }
  .table-wrap:not(.as-table) tbody tr:hover { background: var(--card); }
  .fin td, .fin th { white-space: normal; }
}
.fee-hint { display: block; margin-top: .3rem; color: var(--feed-purple); font-size: .8rem; font-weight: 500; }
.mc-tag.plus { background: #e7f8ef; color: #166534; font-weight: 600; } .mc-tag .link.danger { padding: 0 .15rem; font-size: .8rem; }

/* ---------- مبدّل العرض: جدول / بطاقات ---------- */
.view-toggle { display: inline-flex; margin-inline-start: auto; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.view-toggle button { display: inline-flex; align-items: center; gap: .35rem; border: 0; background: none; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: .38rem .8rem; border-radius: 9px; cursor: pointer; transition: background .15s, color .15s; }
.view-toggle button:hover { color: var(--feed-purple); }
.view-toggle button.on { background: var(--card); color: var(--feed-purple); box-shadow: 0 1px 3px rgba(42, 24, 92, .14); }
@media (max-width: 640px) {
  .filters .view-toggle { width: 100%; margin: 0; }
  .view-toggle button { flex: 1; justify-content: center; }
}

/* الجدول الحقيقي: يبقى جدولًا حتى في الهاتف (تمرير أفقي) */
.table-wrap.as-table { -webkit-overflow-scrolling: touch; }
.table-wrap.as-table table { min-width: 760px; }
.table-wrap.as-table td { vertical-align: middle; }
.table-wrap.as-table td:first-child { white-space: nowrap; }
.table-wrap.as-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--soft) 45%, var(--card)); }

/* ---------- بطاقات التلاميذ ---------- */
.scards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.scard {
  --accent: hsl(var(--lv) 70% 55%);
  position: relative; display: flex; flex-direction: column; gap: .85rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 1.1rem 1.1rem 1rem; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.scard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 64px; background: linear-gradient(to left, hsl(var(--lv) 85% 96%), transparent 85%); pointer-events: none; }
.scard::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--accent); }
.scard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: hsl(var(--lv) 60% 85%); }
.scard > * { position: relative; }
.sc-head { display: flex; align-items: center; gap: .8rem; color: inherit; }
.sc-head:hover { text-decoration: none; }
.sc-head:hover h3 { color: var(--feed-purple); }
.sc-head .avatar { flex: none; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px hsl(var(--lv) 70% 85%); }
.sc-id { min-width: 0; text-align: start; }
.sc-id h3 { margin: 0 0 .25rem; font-size: 1.05rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.sc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.sc-level { font-size: .78rem; font-weight: 700; color: hsl(var(--lv) 65% 35%); background: hsl(var(--lv) 80% 94%); border-radius: 999px; padding: .08rem .65rem; }
.sc-subjects { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 1.6rem; }
.sc-subjects .pill.small { font-size: .76rem; padding: .05rem .55rem; }
.sc-parent { display: flex; align-items: center; gap: .6rem; background: var(--soft-2); border-radius: 14px; padding: .55rem .7rem; }
.sc-parent .sc-ico { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: var(--card); border-radius: 50%; font-size: .9rem; }
.sc-parent > div { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: start; line-height: 1.35; }
.sc-parent b { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-parent span[dir=ltr] { text-align: end; align-self: flex-start; }
.sc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sc-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .5rem .3rem; text-align: center; gap: .05rem; }
.sc-stat + .sc-stat { border-inline-start: 1px solid var(--border); }
.sc-stat b { font-family: 'Tajawal', sans-serif; font-size: 1.12rem; line-height: 1.2; white-space: nowrap; }
.sc-stat span { font-size: .72rem; color: var(--muted); }
.sc-stat.owe { background: #fdeef4; } .sc-stat.owe b { color: #be185d; }
.sc-stat.ok { background: #e9f8f0; } .sc-stat.ok b { color: var(--good); }
.sc-stat.warn b { color: #c2410c; }
.sc-actions { display: flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .7rem; border-top: 1px dashed var(--border); }
.sc-actions .danger { margin-inline-start: auto; }
@media (max-width: 640px) {
  .scards { grid-template-columns: 1fr; gap: .75rem; }
  .scard { padding: .95rem .95rem .85rem; border-radius: 18px; }
}
@media (prefers-color-scheme: dark) {
  .scard::before { background: linear-gradient(to left, hsl(var(--lv) 40% 20% / .55), transparent 85%); }
  .scard:hover { border-color: hsl(var(--lv) 35% 35%); }
  .sc-level { color: hsl(var(--lv) 80% 78%); background: hsl(var(--lv) 35% 22%); }
  .sc-head .avatar { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px hsl(var(--lv) 35% 35%); }
  .sc-stat.owe { background: #3a1a2b; } .sc-stat.owe b { color: #f9a8d4; }
  .sc-stat.ok { background: #16301f; }
  .sc-parent { background: #2a2137; }
  .sc-parent .sc-ico { background: #1c1626; }
  .view-toggle button.on { box-shadow: none; }
}
.nowrap { white-space: nowrap; }
.sc-since { margin-top: .3rem; font-size: .76rem; color: var(--muted); }

/* ---------- المنتجات ---------- */
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.prod { display: grid; grid-template-columns: auto 1fr; gap: .8rem 1rem; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 1.1rem; box-shadow: var(--shadow-sm); }
.prod.off { opacity: .6; }
.prod-ico { width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.6rem; border-radius: 16px; background: linear-gradient(135deg, #d1fae5, #ecfdf5); }
.prod-main { text-align: start; min-width: 0; }
.prod-main h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.prod-price { font-family: 'Tajawal', sans-serif; font-weight: 800; font-size: 1.15rem; color: #047857; }
.prod-stats { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.prod-stats > div { display: flex; flex-direction: column; align-items: center; padding: .5rem; }
.prod-stats > div + div { border-inline-start: 1px solid var(--border); }
.prod-stats b { font-family: 'Tajawal', sans-serif; font-size: 1.1rem; white-space: nowrap; }
.prod-stats span { font-size: .74rem; color: var(--muted); }
.prod-acts { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; }
.prod-acts .danger { margin-inline-start: auto; }
.ps-total { margin: .2rem 0 .6rem; padding: .6rem .8rem; border-radius: 12px; background: #ecfdf5; color: #065f46; }
.ps-total b { font-size: 1.15rem; }
@media (prefers-color-scheme: dark) {
  .prod-ico { background: #12382b; } .prod-price { color: #6ee7b7; } .ps-total { background: #12382b; color: #a7f3d0; }
}

/* ---------- القوائم المنسدلة بتصميم التطبيقة ---------- */
.sel-wrap { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
label .sel-wrap, dialog .sel-wrap, .row .sel-wrap { display: block; }
.sel-wrap > select { width: 100%; }
.filters .sel-wrap { min-width: 200px; }
.filters .sel-wrap > select { min-width: 0; }
.sel-hit { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
label .sel-hit { top: .25rem; }
.sel-wrap > select:disabled + .sel-hit { cursor: not-allowed; }

.sel-pop { position: fixed; z-index: 3000; background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; font-size: .95rem; }
.sel-pop.drop { border-radius: 16px; padding: .35rem; animation: sel-in .12s ease-out; }
.sel-list { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.sel-opt { display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; text-align: start; font: inherit; color: inherit; background: none; border: 0; border-radius: 11px; padding: .55rem .75rem; cursor: pointer; line-height: 1.45; }
.sel-opt span { flex: 1; }
.sel-opt:hover { background: var(--soft); }
.sel-opt.on { background: var(--soft); color: var(--feed-purple); font-weight: 700; }
.sel-opt svg { flex: none; color: var(--feed-purple); }
.sel-opt:disabled { opacity: .45; cursor: default; }
.sel-group { font-size: .74rem; font-weight: 700; color: var(--muted); padding: .55rem .75rem .2rem; letter-spacing: .01em; }
.sel-search { margin: .1rem 0 .35rem !important; padding: .5rem .75rem !important; font-size: .9rem; }

/* الهاتف: لوحة من الأسفل */
.sel-bg { position: fixed; inset: 0; z-index: 2999; background: rgba(20, 12, 40, .42); animation: sel-fade .15s ease-out; }
.sel-pop.sheet { inset: auto 0 0 0; max-height: min(72vh, 560px); border-radius: 24px 24px 0 0; border-bottom: 0; padding: .35rem .75rem calc(.8rem + env(safe-area-inset-bottom)); animation: sel-up .2s cubic-bezier(.2, .8, .2, 1); }
.sel-grip { width: 42px; height: 5px; border-radius: 99px; background: var(--border); margin: .35rem auto .5rem; flex: none; }
.sel-title { font-weight: 700; font-size: 1rem; padding: 0 .4rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .4rem; flex: none; }
.sel-pop.sheet .sel-opt { padding: .8rem .85rem; font-size: 1rem; border-radius: 14px; }
body.sel-open { overflow: hidden; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sel-up { from { transform: translateY(100%); } }
@keyframes sel-fade { from { opacity: 0; } }
@media (max-width: 640px) { .filters .sel-wrap { width: 100%; min-width: 0; } }
@media (prefers-color-scheme: dark) { .sel-bg { background: rgba(0, 0, 0, .55); } }

/* ---------- الإجراءات السريعة في ملف التلميذ ---------- */
.qa { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .6rem; margin-top: 1rem; width: 100%; }
.qa-btn {
  --c: #6d28d9; --bg: #f3e8ff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem;
  min-height: 92px; padding: .8rem .4rem .7rem; border-radius: 18px; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text); font: inherit; text-align: center; text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s; -webkit-tap-highlight-color: transparent;
}
.qa-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 30%, var(--border)); }
.qa-btn:active { transform: scale(.97); }
.qa-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.qa-ico { position: relative; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--bg); color: var(--c); }
.qa-ico i { position: absolute; top: -5px; inset-inline-end: -5px; width: 19px; height: 19px; border-radius: 50%; background: var(--c); color: #fff; font-style: normal; font-weight: 800; font-size: .85rem; line-height: 19px; box-shadow: 0 0 0 2px var(--card); }
.qa-label { font-size: .84rem; font-weight: 600; line-height: 1.3; color: var(--text); }
.qa-btn.tone-purple { --c: #6d28d9; --bg: #f3e8ff; }
.qa-btn.tone-pink { --c: #db2777; --bg: #fde8f1; }
.qa-btn.tone-green { --c: #16a34a; --bg: #e3f7ea; }
.qa-btn.tone-sky { --c: #0284c7; --bg: #e0f2fe; }
.qa-btn.tone-blue { --c: #4338ca; --bg: #e8ecfe; }
.qa-btn.tone-gray { --c: #475569; --bg: #eef1f6; }
@media (max-width: 640px) {
  .qa { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .qa.qa-2, .qa.qa-4 { grid-template-columns: repeat(2, 1fr); }
  .qa-btn { min-height: 84px; padding: .7rem .3rem .6rem; border-radius: 16px; }
  .qa-ico { width: 42px; height: 42px; border-radius: 14px; }
  .qa-label { font-size: .78rem; }
}
@media (min-width: 900px) { .qa.qa-6 { grid-template-columns: repeat(6, 1fr); } }
@media (prefers-color-scheme: dark) {
  .qa-btn.tone-purple { --c: #c4b5fd; --bg: #2e2147; } .qa-btn.tone-pink { --c: #f9a8d4; --bg: #3a1a2b; }
  .qa-btn.tone-green { --c: #86efac; --bg: #16301f; } .qa-btn.tone-sky { --c: #7dd3fc; --bg: #12303f; }
  .qa-btn.tone-blue { --c: #a5b4fc; --bg: #222645; } .qa-btn.tone-gray { --c: #cbd5e1; --bg: #262b38; }
  .qa-ico i { color: #15101d; }
}
.page-head:has(> .qa) { flex-wrap: wrap; } .page-head > .qa { flex: 1 0 100%; }

/* ---------- معلومات التلميذ ---------- */
.info-card .section-head { margin-bottom: .9rem; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.info-item { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .85rem; border-radius: 16px; background: var(--soft-2); border: 1px solid transparent; min-width: 0; }
.info-item.wide { grid-column: 1 / -1; }
.info-item.strong { background: linear-gradient(135deg, #f3e8ff, #fdf4ff); border-color: #ead9fb; }
.info-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--feed-purple); box-shadow: var(--shadow-sm); }
.info-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .1rem; text-align: start; }
.info-label { font-size: .76rem; font-weight: 600; color: var(--muted); }
.info-value { font-size: .97rem; font-weight: 600; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
.info-item.strong .info-value { font-family: 'Tajawal', sans-serif; font-size: 1.15rem; font-weight: 800; color: var(--feed-purple); }
.info-value.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.info-chip { display: inline-flex; align-items: center; padding: .2rem .7rem; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: .82rem; font-weight: 600; color: var(--feed-purple); }
.info-value.chips .badge.pack { padding: .2rem .75rem; border-radius: 999px; font-size: .82rem; }
.info-empty { color: var(--muted); font-weight: 400; font-size: .9rem; opacity: .8; }
.info-sub { font-size: .8rem; color: var(--muted); }
.info-sub a { color: var(--feed-purple); font-weight: 600; }
@media (max-width: 640px) {
  .info-grid { grid-template-columns: 1fr; gap: .45rem; }
  .info-item { gap: .65rem; padding: .6rem .7rem; border-radius: 14px; align-items: center; }
  .info-item.wide { align-items: flex-start; }
  .info-ico { width: 34px; height: 34px; border-radius: 11px; }
  .info-value { font-size: .93rem; }
}
@media (prefers-color-scheme: dark) {
  .info-item { background: #261e33; }
  .info-item.strong { background: linear-gradient(135deg, #2e2147, #2a1d3a); border-color: #3e2d5a; }
  .info-ico { background: #1c1626; }
  .info-chip { background: #1c1626; }
}

/* ---------- زر الخلاص في القوائم ---------- */
.pay-btn { display: inline-flex; align-items: center; gap: .4rem; border: 0; border-radius: 14px; padding: .4rem .7rem; font: inherit; cursor: pointer; min-width: 104px; transition: transform .12s, box-shadow .12s; -webkit-tap-highlight-color: transparent; }
.pay-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42, 24, 92, .12); }
.pay-btn:active { transform: scale(.97); }
.pb-ico { font-size: 1rem; }
.pb-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.pb-txt b { font-family: 'Tajawal', sans-serif; font-size: .95rem; white-space: nowrap; }
.pb-txt i { font-style: normal; font-size: .7rem; font-weight: 600; opacity: .85; }
.pay-btn.ok { background: #e7f8ef; color: #15803d; }
.pay-btn.due { background: #fde8f1; color: #be185d; }
.pay-btn.free, .pay-btn.none { background: var(--soft-2); color: #64748b; }
.sc-actions .pay-btn { margin-inline-start: auto; }

/* ---------- لوحة الخلاص ---------- */
.pay-bg { position: fixed; inset: 0; z-index: 2500; background: rgba(20, 12, 40, .45); animation: sel-fade .15s ease-out; }
.pay-sheet { position: fixed; z-index: 2501; background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain;
  inset: auto 0 0 0; max-height: 92vh; border-radius: 26px 26px 0 0; padding: .4rem 1rem calc(1rem + env(safe-area-inset-bottom)); animation: sel-up .22s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 700px) {
  .pay-sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 470px; max-height: 88vh; border-radius: 24px; padding: 1rem 1.3rem 1.2rem; animation: sel-in .15s ease-out; }
  .ps-grip { display: none; }
}
.ps-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--border); margin: .35rem auto .7rem; }
.ps-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .8rem; }
.ps-who { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: start; }
.ps-who b { font-size: 1.08rem; } .ps-who span { font-size: .82rem; color: var(--muted); }
.ps-x { border: 0; background: var(--soft-2); color: var(--muted); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: .95rem; }
.ps-kpis { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-bottom: .8rem; }
.ps-kpis > div { display: flex; flex-direction: column; align-items: center; padding: .5rem .2rem; }
.ps-kpis > div + div { border-inline-start: 1px solid var(--border); }
.ps-kpis b { font-family: 'Tajawal', sans-serif; font-size: 1.12rem; } .ps-kpis small { font-size: .72rem; color: var(--muted); }
.ps-kpis .in { color: var(--good); } .ps-kpis .owed { color: #be185d; }
.ps-hint { font-size: .8rem; color: var(--muted); margin: 0 0 .4rem; }
.ps-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .4rem; margin-bottom: .9rem; }
.ps-m { position: relative; display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .45rem .2rem .4rem; border-radius: 13px; border: 2px solid transparent; font: inherit; cursor: pointer; transition: transform .1s; }
.ps-m span { font-size: .78rem; font-weight: 600; } .ps-m b { font-family: 'Tajawal', sans-serif; font-size: .88rem; white-space: nowrap; }
.ps-m i { font-style: normal; font-size: .64rem; font-weight: 700; opacity: .8; }
.ps-m.ok { background: #e7f8ef; color: #15803d; cursor: default; opacity: .75; }
.ps-m.due { background: #fde8f1; color: #be185d; }
.ps-m.part { background: #fff3df; color: #b45309; }
.ps-m.fut { background: var(--soft-2); color: #64748b; border-style: dashed; border-color: var(--border); }
.ps-m.sel { border-color: var(--feed-purple); border-style: solid; box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.ps-m.sel::after { content: '✓'; position: absolute; top: -7px; inset-inline-end: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--feed-purple); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.ps-m:active:not(:disabled) { transform: scale(.96); }
.ps-form { background: var(--soft); border-radius: 18px; padding: .8rem .85rem .9rem; }
.ps-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.ps-row label { margin-bottom: .5rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.ps-row input[name=amount] { font-family: 'Tajawal', sans-serif; font-size: 1.2rem; font-weight: 800; color: var(--text); }
.ps-split { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .8rem; color: var(--muted); margin: 0 0 .5rem; }
.ps-split:empty { display: none; }
.ps-more { margin-bottom: .7rem; font-size: .85rem; } .ps-more summary { cursor: pointer; color: var(--feed-purple); font-weight: 600; margin-bottom: .4rem; }
.ps-go { font-size: 1rem; padding: .8rem; border-radius: 14px; }
.ps-go:disabled { opacity: .5; }
.ps-links { display: flex; justify-content: center; margin-top: .8rem; font-size: .88rem; font-weight: 600; }
.ps-done { text-align: center; padding: .6rem 0 .3rem; }
.ps-check { width: 66px; height: 66px; margin: 0 auto .6rem; border-radius: 50%; background: #e7f8ef; color: #15803d; display: grid; place-items: center; font-size: 2rem; font-weight: 800; animation: sel-in .3s ease-out; }
.ps-done h3 { justify-content: center; margin-bottom: .3rem; }
.ps-note { background: #eef6ff; color: #1e40af; border-radius: 12px; padding: .5rem .7rem; font-size: .85rem; font-weight: 600; }
.ps-note.warn { background: #fff3df; color: #92400e; }
.ps-acts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .8rem 0 .6rem; }
.ps-acts .btn { justify-content: center; text-align: center; }
.ps-acts .btn:only-child { grid-column: 1 / -1; }

/* ---------- تبويبات الملف ---------- */
.file-tabs { position: sticky; top: 0; z-index: 4; display: flex; gap: 3px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 4px; margin: 1rem 0; box-shadow: var(--shadow-sm); overflow-x: auto; scrollbar-width: none; }
.file-tabs button { flex: 1; white-space: nowrap; border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); padding: .55rem .8rem; border-radius: 12px; cursor: pointer; }
.file-tabs button:hover { color: var(--feed-purple); }
.file-tabs button.on { background: var(--feed-purple); color: #fff; }
@media (max-width: 960px) { .file-tabs { top: 56px; } }
.tab-panel { display: none; } .tab-panel.on { display: block; animation: sel-fade .15s ease-out; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.ov-card { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: start; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: .85rem 1rem; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow-sm); text-decoration: none !important; transition: transform .12s, box-shadow .12s; min-width: 0; }
.ov-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ov-card small { font-size: .76rem; color: var(--muted); font-weight: 600; }
.ov-card b { font-family: 'Tajawal', sans-serif; font-size: 1.2rem; }
.ov-card b.ov-text { font-family: inherit; font-size: .92rem; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-card span { font-size: .78rem; color: var(--feed-purple); font-weight: 600; margin-top: auto; }
.ov-pay.ok { background: #e7f8ef; border-color: #c8eed8; } .ov-pay.ok b { color: #15803d; }
.ov-pay.due { background: #fde8f1; border-color: #f8cfe0; } .ov-pay.due b { color: #be185d; }
.info-acts { display: flex; gap: .6rem; flex-wrap: wrap; margin: -.3rem 0 1rem; }
.info-acts .danger.ghost { background: none; color: var(--danger); border: 1px solid #f3c4c4; margin-inline-start: auto; }
@media (max-width: 640px) { .ov-grid { grid-template-columns: 1fr 1fr; } .file-tabs button { font-size: .84rem; padding: .5rem .55rem; } }

/* ---------- الوصولات ---------- */
.receipt-lines { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .92rem; }
.receipt-lines th, .receipt-lines td { border: 1px solid #ddd; padding: .4rem .6rem; text-align: start; }
.receipt-lines th { background: #f6f2fb; }
.rcpts { display: flex; flex-direction: column; gap: .5rem; }
.rcpt { display: flex; align-items: center; gap: .8rem; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: .7rem .9rem; color: inherit; text-decoration: none !important; box-shadow: var(--shadow-sm); }
.rcpt:hover { border-color: #d8c6f3; }
.rcpt-no { display: flex; flex-direction: column; align-items: center; background: var(--soft); border-radius: 12px; padding: .3rem .55rem; font-size: .8rem; color: var(--feed-purple); }
.rcpt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .rcpt-main small { color: var(--muted); font-size: .8rem; }
.rcpt-amt { font-family: 'Tajawal', sans-serif; font-size: 1.1rem; color: var(--good); white-space: nowrap; }
.new-receipt { display: flex; align-items: center; gap: .8rem; background: linear-gradient(135deg, #e7f8ef, #f0fdf6); border: 1px solid #bfe9d0; border-radius: 18px; padding: .8rem 1rem; margin-bottom: 1rem; color: #14532d; text-decoration: none !important; }
.new-receipt .nr-ico { font-size: 1.6rem; } .new-receipt > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; } .new-receipt small { color: #3f6f52; }
.new-receipt .nr-go { font-weight: 700; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .pay-btn.ok, .ps-m.ok, .ov-pay.ok { background: #16301f; color: #86efac; } .ov-pay.ok b { color: #86efac; }
  .pay-btn.due, .ps-m.due, .ov-pay.due { background: #3a1a2b; color: #f9a8d4; } .ov-pay.due b { color: #f9a8d4; }
  .ps-m.part { background: #3a2a12; color: #fcd34d; } .ps-check { background: #16301f; color: #86efac; }
  .ps-note { background: #1c2a44; color: #bfdbfe; } .ps-note.warn { background: #3a2a12; color: #fde68a; }
  .ov-pay.ok, .ov-pay.due { border-color: transparent; }
  .new-receipt { background: #16301f; border-color: #24543a; color: #bbf7d0; } .new-receipt small { color: #86efac; }
}
@media print { .pay-sheet, .pay-bg, .file-tabs { display: none !important; } }
/* رأس الملف أقصر في الهاتف: الصورة بجنب الاسم */
@media (max-width: 640px) {
  .page-head .student-head { flex-direction: row; align-items: center; gap: .9rem; }
  .student-head .avatar.lg { width: 76px; height: 76px; font-size: 1.8rem; }
  .student-head h2 { font-size: 1.3rem; margin-bottom: .3rem; }
  .student-head .photo-wrap #photo-del { display: none; }
  .student-head .meta { gap: .35rem; font-size: .85rem; }
  .tab-panel .qa { margin-top: 0; margin-bottom: .8rem; }
}
.tab-panel > .qa { margin-top: 0; margin-bottom: 1rem; }
.mc-reg { margin-top: .55rem; padding: .55rem .65rem; border: 1.5px dashed #d9c7f2; border-radius: 12px; background: #faf6ff; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.mc-reg > span { font-size: .84rem; font-weight: 700; color: var(--feed-purple); } .mc-reg small { font-weight: 500; color: var(--muted); }
.mc-reg-opts { display: flex; flex-wrap: wrap; gap: .3rem; margin-inline-start: auto; }
.mc-reg-opts button { border: 1px solid #d9c7f2; background: var(--card); color: var(--feed-purple); font: inherit; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: .2rem .7rem; cursor: pointer; }
.mc-reg-opts button:hover { background: var(--feed-purple); color: #fff; }
.mc-reg-opts button.ex { color: var(--muted); border-color: var(--border); }
@media (prefers-color-scheme: dark) { .mc-reg { background: #241c31; border-color: #4a3866; } .mc-reg-opts button { border-color: #4a3866; } }
/* زر الخلاص: نفس الحجم دائمًا */
.pay-btn { width: 124px; height: 50px; min-width: 0; padding: 0 .55rem; gap: .5rem; justify-content: flex-start; border-radius: 14px; flex: none; }
.pay-btn .pb-ico { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .7); font-size: 0; }
.pay-btn .pb-txt { min-width: 0; flex: 1; }
.pay-btn .pb-txt b, .pay-btn .pb-txt i { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-btn .pb-txt b { font-size: 1rem; line-height: 1.2; }
.pay-btn .pb-txt i { font-size: .7rem; line-height: 1.2; }
@media (prefers-color-scheme: dark) { .pay-btn .pb-ico { background: rgba(255, 255, 255, .08); } }
.mc-tag.opt { background: #fff7e6; color: #9a6400; border: 1px dashed #f3d08a; }
.ps-reg { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; background: #faf6ff; border: 1.5px dashed #d9c7f2; border-radius: 14px; padding: .55rem .75rem; margin: 0 0 .7rem; font-size: .88rem; font-weight: 600; color: var(--feed-purple); cursor: pointer; }
.ps-reg input { width: 18px; height: 18px; margin: 0; accent-color: var(--feed-purple); }
.ps-reg small { color: var(--muted); font-weight: 500; }
@media (prefers-color-scheme: dark) { .mc-tag.opt { background: #3a2a12; color: #fcd34d; border-color: #6b4e1a; } .ps-reg { background: #241c31; border-color: #4a3866; } }
.mc-pedit { font-size: .85rem; padding: 0 .2rem; text-decoration: none !important; }
.mc-edited { font-size: .68rem; font-weight: 700; color: #9a6400; background: #fff3df; border-radius: 999px; padding: 0 .45rem; }
@media (prefers-color-scheme: dark) { .mc-edited { background: #3a2a12; color: #fcd34d; } }
.pf-sum { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; background: #fde8f1; color: #9d174d; border-radius: 14px; padding: .65rem .9rem; margin-bottom: .8rem; font-size: .9rem; }
.pf-sum b { font-family: 'Tajawal', sans-serif; font-size: 1.05rem; }
@media (prefers-color-scheme: dark) { .pf-sum { background: #3a1a2b; color: #f9a8d4; } }
.fee-from { background: #fff7e6; border: 1px dashed #f3d08a; border-radius: 14px; padding: .6rem .8rem .2rem; margin-bottom: .7rem; }
.fee-from label { margin-bottom: .3rem; font-weight: 600; color: #8a5a00; }
@media (prefers-color-scheme: dark) { .fee-from { background: #2e2412; border-color: #6b4e1a; } .fee-from label { color: #fcd34d; } }
.home-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.home-link { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.1rem .6rem; background: var(--card); border: 1px solid var(--border); border-radius: 18px; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow-sm); }
.home-link span { font-size: 1.7rem; } .home-link b { font-size: .92rem; }
.home-link:hover { border-color: #d8c6f3; transform: translateY(-2px); }

/* ---------- الصلاحيات ---------- */
.perm-card { margin-bottom: 1rem; }
.perm-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.perm-head > div:first-child { display: flex; flex-direction: column; text-align: start; }
.perm-presets { display: flex; gap: .3rem; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .4rem; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem .75rem; border-radius: 12px; background: var(--soft-2); margin: 0; cursor: pointer; font-size: .9rem; }
.switch { position: relative; flex: none; width: 42px; height: 24px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #cbd5e1; transition: background .15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--feed-purple); }
.switch input:checked + i::after { transform: translateX(-18px); }
[dir=ltr] .switch input:checked + i::after { transform: translateX(18px); }
.perm-foot { margin-top: .7rem; display: flex; justify-content: flex-end; }
/* ---------- المحاسبة ---------- */
.acc-form { display: grid; grid-template-columns: 1.2fr 1.6fr .8fr 1fr auto auto; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.acc-form input, .acc-form select { margin: 0; }
.acc-form label.btn { margin: 0; }
@media (max-width: 760px) { .acc-form { grid-template-columns: 1fr 1fr; } }
.docs { display: flex; flex-direction: column; gap: .35rem; }
.docs.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem; }
.doc { display: inline-flex; align-items: center; gap: .3rem; background: var(--soft); border-radius: 999px; padding: .15rem .65rem; font-size: .82rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row { display: flex; align-items: center; gap: .6rem; }
.attach { cursor: pointer; font-size: 1rem; }

/* ---------- الصندوق اليومي ---------- */
.cash-today { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.ct-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.ct-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.ct-grid > div { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .7rem; border-radius: 14px; background: var(--soft-2); }
.ct-grid small { font-size: .74rem; color: var(--muted); font-weight: 600; }
.ct-grid b { font-family: 'Tajawal', sans-serif; font-size: 1.2rem; white-space: nowrap; }
.ct-grid i { font-style: normal; font-size: .7rem; color: var(--muted); }
.ct-grid .in b { color: var(--good); } .ct-grid .out b { color: #be185d; }
.ct-grid .bal { background: linear-gradient(135deg, #f3e8ff, #fdf4ff); } .ct-grid .bal b { color: var(--feed-purple); }
@media (max-width: 640px) { .ct-grid { grid-template-columns: 1fr 1fr; } }
.cash-acts { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.count-box { border-radius: 14px; padding: .65rem .9rem; margin-bottom: 1rem; background: var(--soft-2); font-size: .9rem; }
.count-box.ok { background: #e7f8ef; color: #14532d; } .count-box.bad { background: #fde8f1; color: #9d174d; }
.warn-box { background: #fff3df; color: #8a5a00; }
.owner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.owner-grid > div { display: flex; flex-direction: column; padding: .6rem .75rem; border-radius: 14px; background: var(--soft-2); }
.owner-grid small { font-size: .74rem; color: var(--muted); font-weight: 600; }
.owner-grid b { font-family: 'Tajawal', sans-serif; font-size: 1.15rem; }
.owner-grid .ok { background: #e7f8ef; } .owner-grid .ok b { color: var(--good); }
.owner-grid .neg { background: #fde8f1; } .owner-grid .neg b { color: #be185d; }
@media (prefers-color-scheme: dark) {
  .ct-grid .bal { background: #2e2147; } .count-box.ok, .owner-grid .ok { background: #16301f; color: #bbf7d0; }
  .count-box.bad, .owner-grid .neg { background: #3a1a2b; color: #f9a8d4; } .warn-box { background: #3a2a12; color: #fde68a; }
}
.new-parent { margin: -.3rem 0 .8rem; border: 1.5px dashed #d9c7f2; border-radius: 14px; padding: .55rem .8rem; background: #faf6ff; }
.new-parent summary { cursor: pointer; font-weight: 700; color: var(--feed-purple); font-size: .9rem; }
.new-parent[open] summary { margin-bottom: .6rem; }
@media (prefers-color-scheme: dark) { .new-parent { background: #241c31; border-color: #4a3866; } }
.parent-head { display: flex; align-items: center; gap: 1rem; }
.pkids { display: flex; flex-direction: column; gap: .5rem; }
.pkid { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 16px; background: var(--card); color: inherit; text-decoration: none !important; }
.pkid:hover { border-color: #d8c6f3; }
.pk-main { flex: 1; display: flex; flex-direction: column; min-width: 0; } .pk-main small { color: var(--muted); }
.pk-bal { font-family: 'Tajawal', sans-serif; font-weight: 800; border-radius: 12px; padding: .3rem .7rem; white-space: nowrap; }
.pk-bal.due { background: #fde8f1; color: #be185d; } .pk-bal.ok { background: #e7f8ef; color: #15803d; }
@media (prefers-color-scheme: dark) { .pk-bal.due { background: #3a1a2b; color: #f9a8d4; } .pk-bal.ok { background: #16301f; color: #86efac; } }
/* عناوين أقسام القائمة: واضحة وبخط عريض */
.nav-sub, #vmenu .nav-sub, #subnav .nav-sub { font-weight: 800 !important; color: var(--text) !important; opacity: 1 !important; font-size: .82rem; letter-spacing: 0; }
/* ---------- خلاص المدرّسين ---------- */
.pr-bar { height: 8px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.pr-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.pr-hours { display: flex; justify-content: space-between; font-size: .84rem; margin-top: -.4rem; }
.pr-warn { display: inline-block; margin-top: .25rem; font-size: .74rem; font-weight: 700; color: #b45309; background: #fff3df; border-radius: 99px; padding: .05rem .55rem; }
.pr-card .sc-actions .wa-btn { margin-inline-start: auto; }
.pauses .levels li { align-items: center; }
@media (prefers-color-scheme: dark) { .pr-warn { background: #3a2a12; color: #fcd34d; } }
/* ---------- غيابات المدرّسين ---------- */
.ta-day { display: flex; align-items: center; gap: .4rem; margin-bottom: .8rem; flex-wrap: wrap; }
.ta-day input { width: auto; margin: 0; }
.ta-day [data-step] { font-size: 1.2rem; font-weight: 800; width: 40px; padding: .3rem 0; }
.ta-sum { margin: 0 0 .7rem; }
.ta-list { display: flex; flex-direction: column; gap: .5rem; }
.ta-row { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: .7rem .85rem; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s; }
.ta-row:hover { border-color: #d8c6f3; }
.ta-time { display: flex; flex-direction: column; align-items: center; min-width: 54px; font-family: 'Tajawal', sans-serif; font-weight: 800; color: var(--feed-purple); }
.ta-time small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.ta-main { flex: 1; display: flex; flex-direction: column; min-width: 0; } .ta-main small { color: var(--muted); font-size: .8rem; }
.ta-state { flex: none; border-radius: 999px; padding: .3rem .8rem; font-weight: 700; font-size: .85rem; background: #e7f8ef; color: #15803d; }
.ta-row.absent { background: #fff5f8; border-color: #f8cfe0; }
.ta-row.absent .ta-state { background: #fde8f1; color: #be185d; }
@media (prefers-color-scheme: dark) { .ta-state { background: #16301f; color: #86efac; } .ta-row.absent { background: #2a1520; border-color: #5a2a40; } .ta-row.absent .ta-state { background: #3a1a2b; color: #f9a8d4; } }

/* ---------- لوحة المشرف: التبويبات والرسوم ---------- */
.board-tabs { position: sticky; top: 0; z-index: 4; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; padding: .35rem; margin: 0 0 1.1rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); }
.board-tabs::-webkit-scrollbar { display: none; }
.board-tabs a { position: relative; flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .95rem; border-radius: 13px; font-weight: 700; font-size: .9rem; color: var(--muted); white-space: nowrap; text-decoration: none !important; }
.board-tabs a span { font-size: 1.05rem; }
.board-tabs a:hover { color: var(--feed-purple); background: var(--soft); }
.board-tabs a.on { background: var(--feed-purple); color: #fff; box-shadow: 0 6px 16px rgba(97, 3, 141, .25); }
.bt-badge { min-width: 20px; height: 20px; border-radius: 99px; background: #db2777; color: #fff; font-size: .72rem; display: inline-grid; place-items: center; padding: 0 .35rem; }
.board-tabs a.on .bt-badge { background: #fff; color: #db2777; }
@media (max-width: 960px) { .board-tabs { top: 56px; } }
.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.board-grid .card { margin: 0; }
.hbars { display: flex; flex-direction: column; gap: .55rem; }
.hb-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: .6rem; font-size: .88rem; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 12px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 99px; background: var(--feed-purple); }
.hb-v { font-family: 'Tajawal', sans-serif; white-space: nowrap; min-width: 2.5rem; text-align: end; }
.wk-chart { display: flex; align-items: flex-end; gap: .6rem; height: 210px; padding: .5rem 0 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.wk-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 0; height: 100%; }
.wk-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.wk-bars i { width: 38%; max-width: 30px; border-radius: 8px 8px 3px 3px; min-height: 2px; }
.wk-bars i.in { background: linear-gradient(180deg, #4ade80, #16a34a); } .wk-bars i.out { background: linear-gradient(180deg, #f472b6, #db2777); }
.wk-bars.stack { flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 0; }
.wk-bars.stack i { width: 52%; max-width: 40px; border-radius: 0; } .wk-bars.stack i:last-child { border-radius: 8px 8px 0 0; }
.wk-col b { font-size: .8rem; } .wk-col small { font-size: .7rem; color: var(--muted); white-space: nowrap; } .wk-col span { font-family: 'Tajawal', sans-serif; font-size: .8rem; font-weight: 800; }
.legend { display: inline-flex; gap: .8rem; font-size: .8rem; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: .3rem; }
.pkid .wa-btn { flex: none; }

/* ===== معاملات يوم (الصندوق) ===== */
.day-tx .section-head input[type=date] { width: auto; min-width: 150px; padding: .4rem .6rem; }
.tx-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .8rem; }
.tx-sum > div { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .75rem; border-radius: 14px; background: var(--soft-2); min-width: 0; }
.tx-sum small { font-size: .74rem; color: var(--muted); font-weight: 600; }
.tx-sum b { font-family: 'Tajawal', sans-serif; font-size: 1.2rem; white-space: nowrap; }
.tx-sum i { font-style: normal; font-size: .7rem; color: var(--muted); }
.tx-sum .in b { color: var(--good); } .tx-sum .out b { color: #be185d; }
@media (max-width: 640px) { .tx-sum { grid-template-columns: 1fr 1fr; } .tx-sum > div:last-child { grid-column: 1 / -1; } }
.tx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.tx { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 14px; background: var(--soft-2); border-inline-start: 3px solid transparent; }
.tx.in { border-inline-start-color: var(--good); } .tx.out { border-inline-start-color: #ec4899; }
.tx.move { background: #fff8ec; }
.tx-ico { width: 2.2rem; height: 2.2rem; border-radius: 12px; background: var(--card); display: grid; place-items: center; font-size: 1.05rem; }
.tx-main { display: flex; flex-direction: column; min-width: 0; }
.tx-main b { color: var(--text); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main b a { color: inherit; text-decoration: none; } .tx-main b a:hover { color: var(--feed-purple); }
.tx-main small { font-size: .74rem; color: var(--muted); }
.tx-amt { font-family: 'Tajawal', sans-serif; font-weight: 800; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.tx-amt.in { color: var(--good); } .tx-amt.out { color: #be185d; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--soft-2); }
.tx-end { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.tx-end time { font-size: .72rem; color: var(--muted); direction: ltr; font-variant-numeric: tabular-nums; }
.round-opt { display: flex; gap: .7rem; align-items: flex-start; background: var(--soft-2); border-radius: 16px; padding: .75rem .9rem; margin: 0 0 1rem; cursor: pointer; }
.round-opt input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--feed-purple); flex: none; }
.round-opt span { display: flex; flex-direction: column; gap: .15rem; }
.round-opt small { color: var(--muted); font-size: .78rem; }
.waiting-card { max-width: 520px; margin: 2rem auto; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 2rem 1.4rem; box-shadow: var(--shadow-sm); }
.waiting-card .wt-ico { font-size: 3rem; width: 5rem; height: 5rem; margin: 0 auto .6rem; display: grid; place-items: center; border-radius: 50%; background: #fff3df; }
.waiting-card p { color: var(--muted); line-height: 1.8; }
.wt-kids { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .4rem; }
.wt-kids li { display: flex; align-items: center; gap: .6rem; background: var(--soft-2); border-radius: 14px; padding: .5rem .7rem; }
.wt-kids li b { flex: 1; text-align: start; }
.reg-price { background: #e7f8ef; color: #14532d; border-radius: 12px; padding: .5rem .75rem; margin: .4rem 0; }
.from-prog { background: #f5efff; border-radius: 14px; padding: .6rem .75rem; }

/* ===== لوحة المهام (Kanban) ===== */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: .9rem; align-items: start; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x proximity; }
@media (max-width: 760px) { .kanban { grid-template-columns: repeat(3, 84%); margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; } }
.kb-col { background: var(--soft-2); border-radius: 20px; padding: .7rem; scroll-snap-align: start; border: 2px dashed transparent; transition: border-color .15s, background .15s; min-height: 140px; }
.kb-col.over { border-color: var(--feed-purple); background: #f3ecff; }
.kb-col > header { display: flex; align-items: center; justify-content: space-between; padding: .2rem .35rem .6rem; }
.kb-col > header b { display: flex; align-items: center; gap: .45rem; }
.kb-col > header b::before { content: ''; width: .6rem; height: .6rem; border-radius: 50%; background: #94a3b8; }
.col-doing > header b::before { background: #f59e0b; } .col-done > header b::before { background: var(--good); }
.kb-count { background: var(--card); border-radius: 999px; padding: .05rem .55rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.kb-list { display: flex; flex-direction: column; gap: .55rem; min-height: 40px; }
.kb-card { border: 0; outline: 0; background: var(--card); border-radius: 16px; padding: .7rem .8rem; box-shadow: 0 1px 2px rgba(30, 10, 60, .06), 0 2px 8px rgba(30, 10, 60, .05); border-inline-start: 4px solid #cbd5e1; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; transition: transform .12s, box-shadow .12s; }
.kb-card[data-drag] { cursor: grab; }
.kb-card:hover { box-shadow: 0 4px 16px rgba(30, 10, 60, .1); }
.kb-card.prio-high { border-inline-start-color: #f59e0b; } .kb-card.prio-urgent { border-inline-start-color: #e11d48; }
.kb-card.problem { background: linear-gradient(180deg, #fff5f7, var(--card) 60%); }
.kb-card.is-done h4 { text-decoration: line-through; color: var(--muted); }
.kb-card h4 { margin: .35rem 0 .45rem; font-size: .95rem; line-height: 1.5; }
.kb-card.ghost-src { display: none; }
.kb-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(-2deg) scale(1.03); box-shadow: 0 18px 40px rgba(30, 10, 60, .25); }
.kb-ph { border-radius: 16px; border: 2px dashed var(--feed-purple); background: #f5efff; }
body.kb-dragging { cursor: grabbing; user-select: none; }
.kb-tags { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.kb-tag { font-size: .7rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: var(--soft-2); color: var(--muted); }
.kb-tag.prio.normal { background: #eef2f7; color: #475569; } .kb-tag.prio.high { background: #fff3df; color: #b45309; } .kb-tag.prio.urgent { background: #ffe4ea; color: #be123c; }
.kb-tag.problem { background: #ffe4ea; color: #be123c; }
.kb-check { display: flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--muted); margin-bottom: .4rem; }
.kb-check i { flex: 1; height: 5px; border-radius: 9px; background: var(--soft-2); overflow: hidden; } .kb-check i b { display: block; height: 100%; background: var(--feed-purple); border-radius: 9px; }
.kb-check.full { color: var(--good); } .kb-check.full i b { background: var(--good); }
.kb-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.kb-due { font-size: .75rem; color: var(--muted); } .kb-due.late { color: #be123c; font-weight: 700; }
.kb-add { width: 100%; margin-top: .55rem; border: 0; background: transparent; color: var(--muted); padding: .55rem; border-radius: 12px; font: inherit; cursor: pointer; }
.kb-add:hover { background: var(--card); color: var(--feed-purple); }
.prio-pick { display: flex; gap: .4rem; margin: .3rem 0 .8rem; }
.prio-pick .pp { flex: 1; } .prio-pick input { position: absolute; opacity: 0; }
.prio-pick span { display: block; text-align: center; padding: .5rem; border-radius: 12px; background: var(--soft-2); font-weight: 700; cursor: pointer; border: 2px solid transparent; }
.prio-pick .high span { color: #b45309; } .prio-pick .urgent span { color: #be123c; }
.prio-pick input:checked + span { border-color: currentColor; background: var(--card); }
.prio-pick .normal input:checked + span { color: var(--feed-purple); }
.cl-box { background: var(--soft-2); border-radius: 16px; padding: .7rem .8rem; margin-bottom: .8rem; }
.cl-head { display: flex; justify-content: space-between; align-items: center; }
.cl-bar { height: 6px; border-radius: 9px; background: var(--card); margin: .45rem 0; overflow: hidden; } .cl-bar b { display: block; height: 100%; width: 0; background: var(--good); transition: width .2s; }
.cl-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.cl-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--card); border-radius: 10px; padding: .35rem .55rem; }
.cl-list label { display: flex; align-items: center; gap: .5rem; flex: 1; margin: 0; cursor: pointer; }
.cl-list input { width: 1.05rem; height: 1.05rem; accent-color: var(--good); flex: none; }
.cl-list li.done span { text-decoration: line-through; color: var(--muted); }
.cl-new { display: flex; gap: .4rem; } .cl-new input { flex: 1; }
.prio-pick .pp { position: relative; margin: 0; }

/* ===== قائمة الأولياء: بطاقات ===== */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .8rem; }
.pcard { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: .9rem; display: flex; flex-direction: column; gap: .65rem; box-shadow: var(--shadow-sm); }
.pc-head { display: flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; }
.pc-head h3 { margin: 0; font-size: 1rem; }
.pc-head:hover h3 { color: var(--feed-purple); }
.pc-phones { display: flex; flex-direction: column; gap: .35rem; }
.pc-phone { display: flex; align-items: center; gap: .5rem; background: var(--soft-2); border-radius: 12px; padding: .35rem .55rem; }
.pc-phone > span { flex: 1; font-weight: 700; font-variant-numeric: tabular-nums; unicode-bidi: isolate; text-align: start; }
.pc-call { width: 2rem; height: 2rem; border-radius: 10px; display: grid; place-items: center; background: #e8f0ff; text-decoration: none; }
.pc-kids { display: flex; flex-wrap: wrap; gap: .35rem; }
.pk-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; background: #f3ecff; color: var(--feed-purple); font-size: .82rem; font-weight: 700; text-decoration: none; }
.pk-chip i { font-style: normal; font-weight: 500; font-size: .72rem; color: var(--muted); }
.pk-chip.prog { background: #fff1e6; color: #b45309; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--border); padding-top: .55rem; }
.pc-foot > span:last-child { display: flex; gap: .35rem; }
