/* أترجة فاطمة الوقيان — التنسيق العام (أزرق الشعار + ذهبي) — يدعم الاتجاه من اليمين لليسار */
:root {
  --g950: #0f1f47;
  --g900: #152b5e;
  --g800: #1d3b7c;
  --g700: #26499a;
  --g600: #3160bd;
  --g200: #c8d3ee;
  --g100: #e0e6f6;
  --g50:  #f2f5fc;
  --au700: #7a5a10;
  --au600: #a37c1f;
  --au500: #c9a23c;
  --au300: #e9d18f;
  --au100: #faf3df;
  --ink: #17232b;
  --muted: #5a6872;
  --line: #e1e5e8;
  --bg: #f3f5f7;
  --card: #ffffff;
  --red: #b3261e;
  --red50: #fbeceb;
  --amber: #8f5a00;
  --amber50: #fdf3df;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 31, 71, .05), 0 10px 28px rgba(15, 31, 71, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--g700); }
h1, h2, h3 { line-height: 1.25; margin: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--g950);
  border-bottom: 3px solid var(--au500);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; margin-inline-end: auto; min-width: 0; }
.brand-badge {
  width: 46px; height: 46px; border-radius: 50%; background: #fff; flex: none;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--au500);
}
.brand-badge img { width: 34px; height: 34px; object-fit: contain; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--au300); font-size: 12px; font-weight: 600;  }
.nav { display: flex; gap: 4px; }
.nav a {
  color: #d5ddf0; text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--au500); color: var(--g950); }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #e6ebf7; margin-inline-end: 4px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--g700); color: var(--au300); font-weight: 700; font-size: 12px; border: 1px solid rgba(243,207,134,.5);
}
.user-name { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- hero band ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--g800) 0%, var(--g900) 70%);
  color: #fff;
  padding: 28px clamp(16px, 4vw, 40px) 76px;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border: 2px solid rgba(201,162,60,.35); border-bottom: none;
  border-radius: 50% 50% 0 0 / 70% 70% 0 0; pointer-events: none;
}
.hero::before { width: 170px; height: 210px; left: 7%; top: 22px; }
.hero::after  { width: 120px; height: 150px; left: calc(7% + 25px); top: 60px; border-color: rgba(201,162,60,.22); }
.hero-inner { max-width: 1100px; margin: 0 auto; position: relative; z-index: 1; }
.eyebrow { color: var(--au300); font-size: 12px; font-weight: 700;  }
.hero h1 { font-size: clamp(22px, 3.2vw, 30px); font-weight: 800; margin-top: 6px; }
.hero p { margin: 6px 0 0; color: #d5ddf0; max-width: 640px; }

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: -52px auto 40px; padding: 0 clamp(16px, 4vw, 40px); position: relative; z-index: 2; }
.container.narrow { max-width: 820px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; color: var(--g900); }
.card-title::before { content: ""; width: 6px; height: 20px; border-radius: 4px; background: var(--au500); }
.card-sub { color: var(--muted); font-size: 13.5px; margin: -8px 0 14px; }
.section-label {
  font-size: 12px; font-weight: 800;  color: var(--au700);
  margin: 26px 0 10px; display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; margin-bottom: 0; }
.row > .btn { flex: 0 0 auto; }
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 11px 12px; border: 1px solid #d5d1c3; border-radius: 10px; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
select { appearance: none; padding-left: 36px; padding-right: 12px;
  background-image: linear-gradient(45deg, transparent 50%, var(--g700) 50%), linear-gradient(135deg, var(--g700) 50%, transparent 50%);
  background-position: 13px 52%, 18px 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--g600); box-shadow: 0 0 0 3px rgba(49,96,189,.15); }
select:disabled, input:disabled { background-color: #f3f1ea; color: #8a948e; }
.form-msg { min-height: 20px; color: var(--red); font-weight: 600; font-size: 13.5px; margin: 0 0 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 14.5px; line-height: 1;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s, color .2s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--au300); outline-offset: 2px; }
.btn-primary { background: var(--g800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--g900); }
.btn-gold { background: var(--au500); color: #2a1a00; }
.btn-gold:hover:not(:disabled) { background: #d6b250; }
.btn-outline { background: #fff; color: var(--g800); border-color: var(--g200); }
.btn-outline:hover:not(:disabled) { background: var(--g50); }
.btn-danger { background: #fff; color: var(--red); border-color: #efc4c0; }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 6px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--muted);
  background: transparent; border: none; padding: 9px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--g800); background: var(--g50); }
.tab.active { background: var(--g800); color: #fff; box-shadow: inset 0 -3px 0 var(--au500); }
.tab:focus-visible { outline: 3px solid var(--au300); }
.subtabs { display: inline-flex; gap: 4px; background: var(--g50); padding: 4px; border-radius: 999px; }
.subtabs .tab { padding: 7px 14px; font-size: 13px; }
.panel { display: none; }
.panel.active { display: block; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th {
  text-align: start; font-size: 13px; font-weight: 800; 
  color: var(--g900); background: var(--g50); padding: 11px 14px; border-bottom: 1px solid var(--g100); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #efece3; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: center; width: 1%; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 22px; }

/* ---------- badges & notes ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--g100); color: var(--g800); }
.badge-bad { background: var(--red50); color: var(--red); }
.badge-late { background: var(--amber50); color: var(--amber); }
.badge-gold { background: var(--au100); color: var(--au700); }
.muted { color: var(--muted); }
.note {
  border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin-bottom: 14px;
  background: var(--au100); color: var(--au700); border: 1px solid #ecd9a9;
}
.note.error { background: var(--red50); color: var(--red); border-color: #f0c9c5; }
.note.ok { background: var(--g50); color: var(--g800); border-color: var(--g100); }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  flex: 1 1 120px; background: var(--g50); border: 1px solid var(--g100); border-radius: 12px; padding: 10px 14px;
}
.stat b { display: block; font-size: 22px; color: var(--g800); line-height: 1.1; }
.stat span { font-size: 12px; font-weight: 700; color: var(--muted);  }
.stat.bad b { color: var(--red); } .stat.bad { background: var(--red50); border-color: #f3d4d0; }
.stat.late b { color: var(--amber); } .stat.late { background: var(--amber50); border-color: #f1dfb8; }
.updated { font-size: 12px; color: var(--muted); }

/* ---------- students (attendance) ---------- */
.students { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.student {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px;
  background: #fff; border-bottom: 1px solid #efece3; transition: background .2s;
}
.student:last-child { border-bottom: none; }
.student.is-absent { background: #fdf3f2; }
.student.is-late { background: #fffaf0; }
.student-name { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.student-name .n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--au100); color: var(--au700);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--g50); border-radius: 999px; flex: none; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--g700); color: #fff; }
.seg label.abs input:checked + span { background: var(--red); }
.seg label.late input:checked + span { background: var(--au500); color: #2a1a00; }
.seg input:focus-visible + span { outline: 2px solid var(--au500); outline-offset: 1px; }
@media (max-width: 560px) { .student { flex-direction: column; align-items: flex-start; } .seg { width: 100%; } .seg label { flex: 1; text-align: center; } }

.rating { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.rating label { position: relative; }
.rating input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.rating span {
  display: grid; place-items: center; height: 42px; border-radius: 10px; border: 1px solid #d9d4c3;
  font-weight: 800; color: var(--muted); background: #fff; transition: all .15s;
}
.rating label:hover span { border-color: var(--au500); color: var(--au700); }
.rating input:checked + span { background: var(--au500); border-color: var(--au500); color: #2a1a00; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(201,162,60,.35); }
.rating input:focus-visible + span { outline: 2px solid var(--g600); outline-offset: 2px; }
.rating-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
@media (max-width: 480px) { .rating { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- list rows (admin) ---------- */
.list { border: 1px solid var(--line); border-radius: 12px; max-height: 320px; overflow-y: auto; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid #efece3; }
.list-row:last-child { border-bottom: none; }

/* ---------- boot / loading ---------- */
.boot { display: grid; place-items: center; min-height: 60vh; color: var(--g800); font-weight: 700; padding: 20px; }
.boot-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); max-width: 420px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--g100); border-top-color: var(--g700); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 30, 40, .55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .2s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.25); border-top: 5px solid var(--au500); }
.modal-title { font-size: 19px; font-weight: 800; color: var(--g900); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.alert-msg { font-size: 16px; white-space: pre-wrap; margin: 0 0 12px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 420px); }
.toast { background: var(--g900); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); border-inline-start: 4px solid var(--au500); transition: opacity .3s, transform .3s; }
.toast-error { background: #5d1611; border-inline-start-color: #ff8a80; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- sign-in page ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 48px clamp(24px, 5vw, 64px);
  background: radial-gradient(1200px 600px at 10% 110%, rgba(201,162,60,.18), transparent 60%), linear-gradient(160deg, var(--g800), var(--g950));
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-brand::after {
  content: ""; position: absolute; left: -60px; bottom: -40px; width: 340px; height: 420px;
  border: 2px solid rgba(201,162,60,.28); border-bottom: none; border-radius: 50% 50% 0 0 / 65% 65% 0 0;
}
.auth-logo { width: 132px; height: 132px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px var(--au500), 0 18px 40px rgba(0,0,0,.25); }
.auth-logo img { width: 96px; height: 96px; object-fit: contain; border-radius: 50%; }
.auth-brand h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; }
.auth-brand .tag { color: var(--au300); font-weight: 700;  font-size: 13px; }
.auth-brand p { color: #d5ddf0; max-width: 420px; margin: 0; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; font-weight: 800; color: var(--g900); }
.auth-card .sub { color: var(--muted); margin: 6px 0 22px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 20px; flex-direction: row; align-items: center; gap: 16px; }
  .auth-brand::after, .auth-brand p { display: none; }
  .auth-logo { width: 72px; height: 72px; flex: none; }
  .auth-logo img { width: 52px; height: 52px; }
  .auth-brand h1 { font-size: 21px; }
  .auth-panel { place-items: start center; }
}
@media (max-width: 720px) {
  .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; border-radius: 999px; }
  .topbar { gap: 10px; }
  .brand-text small { display: none; }
  .user-name, .user-chip { display: none; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ---------- extras for the blank template ---------- */
input[type=number] { width: 100%; font: inherit; color: var(--ink); padding: 11px 12px; border: 1px solid #d5d1c3; border-radius: 10px; background: #fff; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { position: relative; }
.days input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.days span { display: block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--g200); font-weight: 700; font-size: 13px; color: var(--muted); background: #fff; cursor: pointer; }
.days input:checked + span { background: var(--g700); color: #fff; border-color: var(--g700); }
.days input:focus-visible + span { outline: 2px solid var(--au500); outline-offset: 1px; }
.logo-preview { width: 84px; height: 84px; border-radius: 50%; background: #fff; border: 2px solid var(--au500); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-preview img { width: 70px; height: 70px; object-fit: contain; }
.inline-edit { display: flex; gap: 6px; align-items: center; }

/* ---------- كشف الحضور ---------- */
.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.sheet-meta b { color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); align-items: center; margin-bottom: 10px; }
.mk { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 6px; font-weight: 800; font-size: 12px; padding: 0 4px; }
.mk-p { background: var(--g50); color: var(--g700); }
.mk-a { background: var(--red50); color: var(--red); }
.mk-e { background: var(--amber50); color: var(--amber); }
.sheet-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; width: max-content; min-width: 100%; }
table.sheet th, table.sheet td { padding: 0; border-bottom: 1px solid var(--line); border-inline-start: 1px solid #eef0f5; text-align: center; white-space: nowrap; }
table.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--g50); font-weight: 800; color: var(--g900); }
table.sheet .c-name { position: sticky; inset-inline-start: 0; z-index: 1; background: #fff; text-align: start; padding: 8px 10px; min-width: 150px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; box-shadow: -1px 0 0 var(--line) inset; }
table.sheet thead .c-name { z-index: 3; background: var(--g50); }
table.sheet .c-n { width: 30px; color: var(--muted); font-size: 12px; }
.sess-h { display: block; width: 40px; padding: 5px 0; cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
.sess-h small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.sess-h:hover { background: var(--g100); }
th.is-today, td.is-today { background: var(--au100) !important; }
th.is-done .sess-h::after { content: "✓"; display: block; font-size: 10px; color: var(--g600); line-height: 1; }
th.is-late .sess-h::after { content: "!"; display: block; font-size: 11px; color: var(--red); line-height: 1; font-weight: 800; }
.cell { width: 40px; height: 36px; border: none; background: transparent; font: inherit; font-weight: 800; cursor: pointer; display: grid; place-items: center; margin: 0 auto; }
.cell:hover { background: var(--g50); }
.cell.s-p { color: var(--g600); }
.cell.s-a { color: var(--red); background: var(--red50); }
.cell.s-e { color: var(--amber); background: var(--amber50); }
.cell.dirty { box-shadow: inset 0 0 0 2px var(--au500); }
.cell:disabled { cursor: default; }
td.c-sum { padding: 0 8px; font-weight: 700; }
td.c-grade { padding: 0 10px; font-weight: 800; color: var(--g800); background: var(--g50); }
.savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--g950); color: #fff; padding: 10px 14px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin-top: 12px; }
.class-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.class-chip { border: 1px solid var(--g200); background: #fff; border-radius: 12px; padding: 10px 14px; cursor: pointer; font: inherit; text-align: start; }
.class-chip b { display: block; font-size: 16px; color: var(--g900); }
.class-chip small { color: var(--muted); font-size: 12px; }
.class-chip.active { background: var(--g800); border-color: var(--g800); }
.class-chip.active b, .class-chip.active small { color: #fff; }
.seg3 { display: inline-flex; gap: 2px; padding: 3px; background: var(--g50); border-radius: 999px; flex: none; }
.seg3 button { border: none; background: transparent; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.seg3 button.on[data-v="p"] { background: var(--g700); color: #fff; }
.seg3 button.on[data-v="a"] { background: var(--red); color: #fff; }
.seg3 button.on[data-v="e"] { background: var(--au500); color: #2a1a00; }
.modal.wide { max-width: 620px; max-height: 88vh; overflow: auto; }
.date-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.date-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.date-grid input { padding: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.print-head { display: none; }

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; font-size: 10px; }
  #appHeader, .hero, .no-print, .savebar, #toasts { display: none !important; }
  .container { margin: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; }
  .print-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
  .print-head img { width: 60px; height: 60px; object-fit: contain; }
  .print-head h2 { font-size: 15px; text-align: center; }
  .print-head .ph-meta { font-size: 11px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
  .sheet-wrap { max-height: none; overflow: visible; border: none; }
  table.sheet { font-size: 9px; width: 100%; border: 1px solid #000; }
  table.sheet th, table.sheet td { border: 1px solid #555 !important; }
  table.sheet thead th, table.sheet .c-name { position: static; }
  .sess-h { width: auto; min-width: 18px; padding: 2px 0; }
  .sess-h small { font-size: 7.5px; }
  .cell { width: auto; min-width: 18px; height: 20px; background: none !important; }
  table.sheet .c-name { min-width: 0; max-width: none; padding: 2px 4px; }
  th.is-today, td.is-today { background: none !important; }
  th.is-done .sess-h::after, th.is-late .sess-h::after { content: none; }
  .print-foot { display: block !important; font-size: 10px; margin-top: 6px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-foot { display: none; }
table.sheet .tot-end { display: none; }
@media print { table.sheet .tot-front { display: none; } table.sheet .tot-end { display: table-cell; } }
table.sheet .c-grade.tot-front { box-shadow: inset -2px 0 0 var(--au500); }

/* ---------- ألوان الباستيل: ليلكي ووردي ---------- */
:root {
  --g950: #4a3f6b;
  --g900: #4a3f6b;
  --g800: #8a78c9;
  --g700: #9a89d4;
  --g600: #7f6cc0;
  --g200: #ddd5f3;
  --g100: #ebe6f8;
  --g50: #f6f3fc;
  --au700: #a5566a;
  --au600: #d98fa0;
  --au500: #f2b8c4;
  --au300: #f7d3db;
  --au100: #fdeef1;
  --ink: #3b3452; --muted: #7a7290; --bg: #fbf8fd;
  --p-head: #ece6f8; --p-hero1: #e7e0f7; --p-hero2: #f8e3ea;
  --shadow: 0 1px 2px rgba(60,50,90,.04), 0 10px 28px rgba(60,50,90,.07);
}
.topbar { background: var(--p-head); color: var(--ink); border-bottom: 3px solid var(--au500); }
.brand { color: var(--ink); }
.brand-badge { box-shadow: 0 0 0 2px var(--au500); }
.brand-text small { color: var(--au700); }
.nav a { color: var(--muted); }
.nav a:hover { background: rgba(255,255,255,.6); color: var(--ink); }
.nav a.active { background: var(--au500); color: var(--ink); }
.user-chip { color: var(--ink); }
.avatar { background: var(--g100); color: var(--g950); border-color: var(--g200); }
.btn-ghost-light { color: var(--ink); border-color: var(--g200); background: rgba(255,255,255,.5); }
.btn-ghost-light:hover { background: #fff; }
.btn-gold { background: var(--au500); color: var(--ink); }
.btn-gold:hover:not(:disabled) { background: var(--au300); }
.hero { background: linear-gradient(135deg, var(--p-hero1) 0%, var(--p-hero2) 100%); color: var(--ink); }
.hero p { color: var(--muted); }
.eyebrow { color: var(--au700); }
.hero::before, .hero::after { border-color: rgba(255,255,255,.7); }
.auth-brand { background: linear-gradient(160deg, var(--p-hero1), var(--p-hero2)); color: var(--ink); }
.auth-brand::after { border-color: rgba(255,255,255,.8); }
.auth-brand p { color: var(--muted); }
.auth-brand .tag { color: var(--au700); }
.auth-logo { box-shadow: 0 0 0 4px var(--au500), 0 18px 40px rgba(60,50,90,.12); }
.toast { background: var(--g950); }
.savebar { background: var(--g950); }
.savebar .btn-ghost-light { color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }
.cell.s-p { color: var(--g600); }
th.is-today, td.is-today { background: var(--au100) !important; }
