@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/plex-arabic-400.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/plex-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/plex-arabic-500.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/plex-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/plex-arabic-600.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/plex-latin-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/plex-arabic-700.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/plex-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }

/* جدولي — هوية أكاديمية: أبيض نظيف + كحلي جامعي + لمسة ذهبية */
:root {
  --bg-canvas: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-sunken: #edf1f6;
  --bg-hover: #f0f3f8;
  --text-primary: #14213a;
  --text-secondary: #505e74;
  --text-muted: #8a95a6;
  --border-hairline: #e2e7ee;
  --border-strong: #cdd5e0;
  --accent-primary: #1e3a66;
  --accent-ink: #ffffff;
  --accent-soft: #e8eef8;
  --chalk: #a87512;
  --chalk-soft: #fbf3df;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1f7a4d;
  --hero-from: #1e3a66;
  --hero-to: #2c5288;
  --hero-ink: #ffffff;
  --shadow: none;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg-canvas: #0d121b; --bg-surface: #151c29; --bg-sunken: #0a0e15; --bg-hover: #1b2434;
    --text-primary: #e6ebf3; --text-secondary: #a2aec0; --text-muted: #6d798c;
    --border-hairline: #222d3f; --border-strong: #324057;
    --accent-primary: #8db1ea; --accent-ink: #0b1322; --accent-soft: #1a2a44;
    --chalk: #e2b85a; --chalk-soft: #352c19; --danger: #f08b7f; --danger-soft: #3b1d1b; --ok: #6fcf97;
    --hero-from: #1a2c4d; --hero-to: #243d66; --hero-ink: #f1f5fb;
    --shadow: none;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: #0d121b; --bg-surface: #151c29; --bg-sunken: #0a0e15; --bg-hover: #1b2434;
    --text-primary: #e6ebf3; --text-secondary: #a2aec0; --text-muted: #6d798c;
    --border-hairline: #222d3f; --border-strong: #324057;
    --accent-primary: #8db1ea; --accent-ink: #0b1322; --accent-soft: #1a2a44;
    --chalk: #e2b85a; --chalk-soft: #352c19; --danger: #f08b7f; --danger-soft: #3b1d1b; --ok: #6fcf97;
    --hero-from: #1a2c4d; --hero-to: #243d66; --hero-ink: #f1f5fb;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-family: var(--font);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ——— الهيكل ——— */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-hairline);
  display: flex; align-items: center; gap: 10px; min-height: 58px;
}
.topbar h1 { font-size: 18px; font-weight: 700; line-height: 1.2; flex: 1; }
.topbar .sub { display: block; font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--accent-primary); color: var(--accent-ink);
  display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text-secondary); transition: background .2s var(--ease);
}
.icon-btn:active { background: var(--bg-hover); }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.net-dot.off { background: var(--chalk); }

main#view { flex: 1; padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); max-width: 980px; width: 100%; margin: 0 auto; }
main#view.full { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-surface); border-top: 1px solid var(--border-hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; color: var(--text-muted); position: relative;
}
.tabbar button.on { color: var(--accent-primary); font-weight: 600; }
.tabbar button.on::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 2px; background: var(--accent-primary); border-radius: 0 0 2px 2px;
}
.tabbar svg.i { width: 22px; height: 22px; }

/* ——— عناصر عامة ——— */
.section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 22px 2px 8px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 4px; }
.section-title .grow { flex: 1; }
.card { background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.pad { padding: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-secondary); font-size: 13px; }
.tiny { font-size: 12px; color: var(--text-muted); }
.list > * + * { border-top: 1px solid var(--border-hairline); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; width: 100%; text-align: start; }
.list-item:active { background: var(--bg-hover); }
.list-item .title { font-weight: 600; line-height: 1.35; }
.chev { color: var(--text-muted); transform: scaleX(-1); }

.btn {
  height: 46px; padding: 0 18px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; transition: transform .15s var(--ease), background .2s var(--ease);
  border: 1px solid var(--border-strong); background: var(--bg-surface);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent-primary); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-primary); }
.btn.block { width: 100%; }
.btn.sm { height: 38px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; min-width: 120px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.input, select.input {
  font-size: 16px; -webkit-user-select: text; user-select: text; touch-action: manipulation;
  width: 100%; height: 46px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--bg-canvas); outline: none; transition: border-color .2s var(--ease);
}
.input:focus { border-color: var(--accent-primary); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; background: var(--bg-surface);
}
.chip.on { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--accent-ink); font-weight: 600; }
.chip.taken { opacity: .5; border-style: dashed; }
.chip small { font-size: 11px; opacity: .8; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.stepper button { width: 40px; height: 38px; display: grid; place-items: center; font-size: 18px; color: var(--accent-primary); }
.stepper button:active { background: var(--bg-hover); }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--border-strong); transition: background .2s var(--ease); }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent-primary); }
.switch input:checked + i::after { transform: translateX(-18px); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--bg-sunken); color: var(--text-secondary); }
.badge.green { background: var(--accent-soft); color: var(--accent-primary); }
.badge.chalk { background: var(--chalk-soft); color: color-mix(in srgb, var(--chalk) 70%, var(--text-primary)); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

.load-bar { height: 4px; border-radius: 2px; background: var(--bg-sunken); overflow: hidden; margin-top: 6px; }
.load-bar > i { display: block; height: 100%; background: var(--accent-primary); border-radius: 2px; }

.note { padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.7; border: 1px solid var(--border-hairline); background: var(--bg-surface); }
.note.warn { background: var(--chalk-soft); border-color: transparent; }
.note.err { background: var(--danger-soft); border-color: transparent; color: var(--text-primary); }
.note ul { padding-inline-start: 18px; margin-top: 4px; }

/* ——— الرئيسية ——— */
.hero {
  padding: 20px 18px 18px; border-radius: 16px; color: var(--hero-ink);
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: repeating-linear-gradient(0deg, currentColor 0 1px, transparent 1px 26px);
  border-top: 3px solid var(--chalk);
}
.hero h2 { font-size: 20px; line-height: 1.3; font-weight: 700; }
.hero p { opacity: .85; font-size: 13.5px; margin-top: 2px; }
.hero .btn { margin-top: 16px; background: #ffffff; color: #1e3a66; border: 0; position: relative; z-index: 1; width: 100%; height: 50px; font-size: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.hero .btn[disabled] { opacity: .6; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { padding: 12px; }
.stat b { display: block; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-secondary); }

/* ——— الصفوف ——— */
.grade-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 58px; }
.grade-row .title { font-weight: 600; }
.grade-row.off .title { color: var(--text-muted); }
.plan-table { width: 100%; border-collapse: collapse; }
.plan-table td { padding: 8px 4px; border-top: 1px solid var(--border-hairline); }
.plan-table tr:first-child td { border-top: 0; }
.plan-table td:last-child { width: 130px; text-align: end; }

/* ——— المعلمون ——— */
.teacher-avatar {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-primary);
  display: grid; place-items: center; font-weight: 700; flex: none; font-size: 15px;
}
.days-mini { display: flex; gap: 3px; margin-top: 4px; }
.days-mini i { width: 16px; height: 4px; border-radius: 2px; background: var(--border-strong); }
.days-mini i.on { background: var(--accent-primary); }
.assign-block { border: 1px solid var(--border-hairline); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--bg-canvas); }
.grade-label { font-size: 12px; color: var(--text-secondary); margin: 10px 0 6px; font-weight: 600; }
.grade-label:first-child { margin-top: 0; }
.load-summary { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-primary); margin-bottom: 14px; }
.load-summary b { font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }

/* ——— الجدول ——— */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-sunken); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { height: 38px; border-radius: 8px; font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.seg button.on { background: var(--bg-surface); color: var(--text-primary); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.picker { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.picker::-webkit-scrollbar { display: none; }
.picker .chip { flex: none; white-space: nowrap; scroll-snap-align: start; }

.tt-wrap { overflow-x: auto; border: 1px solid var(--border-hairline); border-radius: var(--radius); background: var(--bg-surface); margin-top: 10px; -webkit-overflow-scrolling: touch; }
table.tt { border-collapse: collapse; width: 100%; min-width: 340px; table-layout: fixed; }
table.tt th, table.tt td { border: 1px solid var(--border-hairline); text-align: center; vertical-align: middle; }
table.tt thead th { background: var(--bg-sunken); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); height: 34px; }
table.tt tbody th { background: var(--bg-sunken); font-size: 12.5px; font-weight: 700; width: 52px; }
table.tt td { height: 64px; padding: 4px 2px; font-size: 12.5px; line-height: 1.3; cursor: pointer; }
table.tt td .s { display: block; font-weight: 700; }
table.tt td .t { display: block; font-size: 10.5px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tt td.empty { color: var(--text-muted); }
table.tt td.p7 { background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--bg-sunken) 6px 7px); }
table.tt td.opt .s { color: color-mix(in srgb, var(--chalk) 75%, var(--text-primary)); }
table.tt td.noteacher { background: var(--chalk-soft); }
table.tt td.bad { background: var(--danger-soft); box-shadow: inset 0 0 0 2px var(--danger); }
table.tt td.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-primary); }
table.tt td.count { font-weight: 700; color: var(--accent-primary); font-size: 14px; cursor: default; }
table.tt.master { min-width: 900px; }
table.tt.master td { white-space: nowrap; overflow: hidden; }
table.tt.master td { height: 40px; font-size: 11.5px; padding: 2px; }
table.tt.master tbody th { width: 100px; font-size: 12px; white-space: nowrap; position: sticky; inset-inline-start: 0; z-index: 1; }
table.tt.master thead th { font-size: 11px; }
table.tt.master thead tr:first-child th { font-size: 12.5px; color: var(--text-primary); }
table.tt.master th.dsep, table.tt.master td.dsep { border-inline-start: 2px solid var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-inline-end: 4px; border: 1px solid var(--border-strong); }

.actions-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.actions-bar button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px;
  background: var(--bg-surface); border: 1px solid var(--border-hairline); font-size: 12px; color: var(--text-secondary);
}
.actions-bar button:active { background: var(--bg-hover); }
.actions-bar svg.i { color: var(--accent-primary); width: 22px; height: 22px; }

/* ——— النوافذ السفلية ——— */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 28, .45); z-index: 50; opacity: 0; transition: opacity .2s linear; }
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 51; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg-surface); border-radius: 18px 18px 0 0; transform: translateY(100%); transition: transform .22s var(--ease);
  max-width: 640px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet.settled { transform: none; transition: none; }
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border-hairline); flex: none; }
.sheet-head h3 { flex: 1; font-size: 17px; font-weight: 700; }
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px; border-top: 1px solid var(--border-hairline); display: flex; gap: 8px; flex: none; }
.sheet-foot .btn { flex: 1; }

/* ——— التقدم ——— */
.overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg-canvas) 92%, transparent); display: grid; place-items: center; padding: 24px; }
.progress-card { width: min(360px, 100%); padding: 22px; text-align: center; }
.progress-card h3 { font-size: 17px; margin-bottom: 4px; }
.progress-track { height: 6px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; margin: 16px 0 10px; }
.progress-track i { display: block; height: 100%; width: 0; background: var(--accent-primary); transition: width .2s linear; }
.grid-anim { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; width: 120px; margin: 0 auto 14px; }
.grid-anim i { aspect-ratio: 1; border-radius: 2px; background: var(--bg-sunken); animation: cell 1.6s var(--ease) infinite; }
@keyframes cell { 0%, 100% { background: var(--bg-sunken); } 50% { background: var(--accent-primary); } }

.toast {
  position: fixed; inset-inline: 16px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); z-index: 70;
  margin: 0 auto; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--text-primary); color: var(--bg-canvas);
  font-size: 14px; transform: translateY(20px); opacity: 0; transition: all .3s var(--ease); pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
body.full-view .toast { bottom: calc(env(safe-area-inset-bottom) + 96px); }
@media (min-width: 700px) { table.tt tbody th { width: 72px; } table.tt td { font-size: 13.5px; } }

.empty-state { text-align: center; padding: 34px 20px; }
.empty-state svg.i { width: 44px; height: 44px; color: var(--text-muted); stroke-width: 1.25; }
.empty-state h3 { margin-top: 10px; font-size: 16px; }
.empty-state p { color: var(--text-secondary); font-size: 13.5px; margin: 4px 0 16px; }

.fab {
  position: fixed; inset-inline-start: 16px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); z-index: 25;
  height: 52px; padding: 0 20px; border-radius: 14px; background: var(--accent-primary); color: var(--accent-ink);
  display: flex; align-items: center; gap: 8px; font-weight: 700; box-shadow: 0 6px 18px rgba(20, 33, 58, .25);
}

.fade-in { animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ——— الطباعة ——— */
#print-root { display: none; }
.pr-page { page-break-after: always; break-after: page; padding: 0; color: #000; background: #fff; font-family: var(--font); direction: rtl; }
.pr-page:last-child { page-break-after: auto; break-after: auto; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
.pr-head h2 { font-size: 20px; line-height: 1.3; }
.pr-head .meta { font-size: 12px; text-align: end; line-height: 1.5; }
.pr-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pr-table th, .pr-table td { border: 1px solid #000; text-align: center; vertical-align: middle; padding: 4px 2px; }
.pr-table thead th { background: #e8e8e8; font-size: 12px; height: 30px; }
.pr-table tbody th { background: #f2f2f2; font-size: 14px; width: 80px; }
.pr-table td { height: 74px; font-size: 14px; line-height: 1.35; }
.pr-table td b { display: block; font-size: 15px; }
.pr-table td small { display: block; font-size: 11px; color: #333; }
.pr-table.master td { height: 26px; font-size: 9.5px; padding: 1px; }
.pr-table.master tbody th { font-size: 10px; white-space: nowrap; }
.pr-table.master thead tr:first-child th:first-child { width: 118px; }
.pr-table.master td { white-space: nowrap; overflow: hidden; }
.pr-table.master thead th { font-size: 9.5px; height: 20px; }
.pr-table .dsep { border-inline-start: 2px solid #000; }
.pr-foot { display: flex; justify-content: space-between; margin-top: 28px; font-size: 13px; }
.pr-foot div { text-align: center; min-width: 160px; }
.pr-foot div span { display: block; margin-top: 30px; border-top: 1px dotted #000; padding-top: 4px; }

/* وضع PDF: صفحات بارتفاع ثابت يطابق A4 الأفقية */
.pdf-mode .pr-page { padding: 4px 10px; break-after: auto; page-break-after: auto; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; }
  .app, .sheet, .sheet-backdrop, .toast, .overlay { display: none !important; }
  #print-root { display: block !important; }
}
table.tt th.dh { width: 52px; }
table.tt th.ch { width: 38px; }
@media (min-width: 700px) { table.tt th.dh { width: 72px; } }

/* تعديل اسم المدرسة من الرئيسية */
.hero-name { display: flex; align-items: center; gap: 8px; color: inherit; text-align: start; position: relative; z-index: 1; }
.hero-name svg.i { width: 18px; height: 18px; opacity: .75; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
