/* الجدول المدرسي — هوية «السبّورة والطباشير». */
@font-face { font-family: "Reem Kufi"; font-weight: 500; font-display: swap; src: url(/fonts/reem-kufi-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/reem-kufi-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; font-weight: 500; font-display: swap; src: url(/fonts/reem-kufi-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Reem Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/reem-kufi-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(/fonts/tajawal-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url(/fonts/tajawal-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(/fonts/tajawal-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(/fonts/tajawal-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url(/fonts/tajawal-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(/fonts/tajawal-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --board: #17443D; --board-deep: #0F322D; --board-soft: #E3EEE9;
  --paper: #F1F5F1; --surface: #FFFFFF; --ink: #1D2B28; --muted: #5F706B; --line: #D3DDD8;
  --chalk: #F2C230; --chalk-soft: #FFF4CC;
  --red: #C23A27; --red-soft: #FBE5E0; --ok: #1F7A55; --ok-soft: #DCF0E6; --amber: #8A5F00; --amber-soft: #FFF0CC;
  --kufi: "Reem Kufi", "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --sans: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6; }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.muted { color: var(--muted); }
.grow { flex: 1 1 auto; min-width: 0; }
.loading { text-align: center; padding: 30vh 16px; font-family: var(--kufi); font-size: 28px; color: var(--board); }

/* الأزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--board); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--board); border-color: var(--board); color: #fff; }
.btn.primary:hover { background: var(--board-deep); }
.btn.big { min-height: 52px; padding: 10px 24px; font-size: 18px; font-weight: 700; }
.btn.small { min-height: 38px; padding: 4px 12px; font-size: 15px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--board-soft); }
.btn.icon-only { padding: 0; width: 44px; flex: 0 0 44px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-text { color: var(--red); }
.btn.chalk { background: var(--chalk); border-color: var(--chalk); color: var(--ink); font-weight: 700; }
.btn.onboard { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; min-height: 40px; padding: 4px 12px; font-size: 15px; }
.btn.onboard:hover { border-color: #fff; }
.btn.has { color: var(--amber); }
.link { background: none; border: 0; padding: 6px 0; color: var(--board); text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }

/* الشريط والخطوات */
.bar { background: var(--board); color: #fff; }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; }
.brand { font-family: var(--kufi); font-weight: 700; font-size: 22px; }
.school-name { color: var(--chalk); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.bar-note { color: var(--chalk); margin-inline-start: auto; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.save-state { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: #CFE3DC; }
.save-state.offline { color: var(--chalk); }
.steps { background: var(--board-deep); position: sticky; top: 0; z-index: 5; }
.steps-in { max-width: 1120px; margin: 0 auto; padding: 0 8px; display: flex; overflow-x: auto; }
.step { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 6px 14px; background: none; border: 0; border-bottom: 4px solid transparent; color: #BFD5CD; font-weight: 500; }
.step.on { color: #fff; border-bottom-color: var(--chalk); font-weight: 700; }
.step-num { font-weight: 700; font-size: 15px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; }
.step.on .step-num { background: var(--chalk); border-color: var(--chalk); color: var(--ink); }

/* الصفحات */
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 18px; }
.page.wide { max-width: 1120px; }
.page-head h1 { font-family: var(--kufi); font-size: 34px; line-height: 1.3; color: var(--board); }
.page-head p { color: var(--muted); max-width: 60ch; }
.page-head.slim { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.block > * { max-width: 100%; }
.block > .rows, .block > .field, .block > .tt-wrap, .block > .row, .block > .more, .block > .dist, .block > .quick { align-self: stretch; }
.block h2 { font-weight: 700; font-size: 21px; color: var(--board); }
.block h3, .sheet h3 { font-size: 17px; font-weight: 700; }
.block-lead, .sheet-lead, .field-hint { color: var(--muted); font-size: 15px; max-width: 64ch; }
.empty-note { color: var(--muted); padding: 10px 0; }
.page-nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.foot-note { color: var(--muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: 15px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--board); outline: 3px solid var(--chalk-soft); outline-offset: 0; }
input.num { width: 64px; flex: 0 0 64px; text-align: center; padding: 8px 4px; -moz-appearance: textfield; }
input.num::-webkit-outer-spin-button, input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select.unset { border-style: dashed; color: var(--amber); background: var(--amber-soft); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--board); flex: 0 0 22px; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.choice { min-height: 56px; padding: 8px 12px; border-radius: var(--r); border: 1.5px solid var(--line); background: #fff; font-weight: 500; }
.choice.on { background: var(--board); border-color: var(--board); color: #fff; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; white-space: nowrap; font-weight: 500; flex: 0 0 auto; }
.chip.on { background: var(--board); border-color: var(--board); color: #fff; }
.chip.add { border-style: dashed; color: var(--board); }
.chip.add.other { border-style: solid; }
.dot { font-style: normal; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--chalk); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.rows > .row + .row { border-top: 1px solid var(--line); }
.row-label { color: var(--muted); font-size: 14px; }
.row input.grow { flex: 1 1 150px; width: auto; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; }
.stepper .btn { min-height: 40px; width: 40px; flex-basis: 40px; }
.more summary { cursor: pointer; padding: 10px 0; color: var(--board); font-weight: 500; }
.badge { font-size: 14px; padding: 2px 10px; border-radius: 999px; background: var(--board-soft); white-space: nowrap; }
.badge.over { background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 0 6px; border-radius: 6px; background: rgba(29, 43, 40, .12); white-space: nowrap; }
.tag.bad { background: var(--red); color: #fff; }

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid; align-items: flex-start; }
.note .ico { flex: 0 0 auto; margin-top: 4px; }
.note ul { list-style: disc; padding-inline-start: 20px; }
.note.ok { background: var(--ok-soft); border-color: var(--ok); color: #124C35; }
.note.bad { background: var(--red-soft); border-color: var(--red); color: #7A1F12; }
.note.warn { background: var(--amber-soft); border-color: #D9A521; color: #5E4100; }
.balance { display: flex; flex-direction: column; gap: 10px; }

/* الجداول العامة (المواد، التوزيع، الأوقات) */
.tt-wrap { overflow-x: auto; max-width: 100%; }
.matrix { border-collapse: collapse; width: 100%; }
.matrix th, .matrix td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.matrix thead th { font-size: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.matrix tbody th { text-align: start; min-width: 150px; font-weight: 500; }
.matrix .totals th, .matrix .totals td { border-bottom: 0; font-size: 14px; white-space: nowrap; padding-top: 10px; }
.matrix .totals .over { color: var(--red); font-weight: 700; }
.matrix .totals .full { color: var(--ok); }
.quick { display: flex; flex-direction: column; gap: 8px; }
.quick-label { font-size: 14px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 8px; }
.dist + .dist { margin-top: 10px; }
.dist-cell { display: flex; align-items: center; gap: 2px; min-width: 170px; }
.th-count { color: var(--muted); font-size: 14px; }
.av { border-collapse: separate; border-spacing: 4px; }
.av th { font-weight: 500; font-size: 14px; }
.av-head { background: none; border: 0; padding: 6px 8px; font-weight: 500; border-radius: 8px; min-height: 40px; }
.av-head:hover { background: var(--board-soft); }
.av-cell { width: 72px; height: 46px; border-radius: 8px; border: 1.5px dashed var(--line); background: #fff; font-size: 12px; }
.av-cell.off { border: 0; color: #fff; background: repeating-linear-gradient(135deg, var(--red), var(--red) 8px, #D2543F 8px, #D2543F 16px); }

/* جدول الدروس: السبّورة */
.tt { border-collapse: separate; border-spacing: 5px; background: var(--board); border-radius: 16px; padding: 8px; width: 100%; min-width: 600px; table-layout: fixed; }
.tt caption { caption-side: top; text-align: start; padding: 0 0 6px; }
.tt th { color: #fff; font-weight: 700; font-size: 15px; padding: 6px 4px; }
.tt tbody th, .tt .tt-corner { width: 76px; }
.tt td { padding: 0; height: 72px; }
.cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 100%; height: 100%; min-height: 72px; padding: 4px; border: 0; border-radius: 9px; text-align: center; line-height: 1.3; color: var(--ink); position: relative; }
.cell.empty { background: transparent; border: 1.5px dashed rgba(255, 255, 255, .32); }
.cell.closed { background: repeating-linear-gradient(135deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, .22) 7px, rgba(0, 0, 0, .1) 7px, rgba(0, 0, 0, .1) 14px); color: rgba(255, 255, 255, .7); font-size: 12px; }
button.cell.empty:hover { border-color: var(--chalk); }
.c-main { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.c-sub { font-size: 12.5px; color: #3F514C; overflow-wrap: anywhere; }
.c-tags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cell.noteacher { box-shadow: inset 0 0 0 2px #D9A521; }
.cell.noteacher .c-sub { color: var(--amber); font-weight: 700; }
.cell.bad { box-shadow: inset 0 0 0 3px var(--red); }
.cell.bad::after { content: "تعارض"; position: absolute; top: -7px; inset-inline-start: 6px; background: var(--red); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 6px; }
.cell.sel { outline: 4px solid var(--chalk); outline-offset: 1px; }
.cell.hint-ok.empty { border: 2px dashed var(--chalk); background: rgba(242, 194, 48, .14); }
.cell.hint-bad { box-shadow: inset 0 0 0 3px var(--red); }
.cell.hint-bad.empty { background: rgba(194, 58, 39, .35); border-color: var(--red); }
.cell.hint-bad:not(.empty) { opacity: .6; }

.tt-whole { border-collapse: collapse; background: #fff; font-size: 11.5px; }
.tt-whole th, .tt-whole td { border: 1px solid var(--line); padding: 2px 3px; text-align: center; min-width: 58px; height: 40px; line-height: 1.25; }
.tt-whole thead th { background: var(--board); color: #fff; font-weight: 700; }
.tt-whole tbody th { background: var(--board-soft); white-space: nowrap; min-width: 92px; position: sticky; inset-inline-start: 0; }
.tt-whole .day-start { border-inline-start: 3px solid var(--board); }
.w-main { display: block; font-weight: 700; }
.w-sub { display: block; color: #3F514C; }

/* صفحة الجدول */
.status { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; flex-wrap: wrap; }
.status.ok { border-color: var(--ok); background: var(--ok-soft); }
.status.bad { border-color: var(--red); background: var(--red-soft); }
.status.warn { border-color: #D9A521; background: var(--amber-soft); }
.st.bad { color: var(--red); font-weight: 700; }
.st.warn { color: var(--amber); font-weight: 700; }
.st-more { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.segs { display: inline-flex; border: 1.5px solid var(--board); border-radius: var(--r); overflow: hidden; align-self: flex-start; max-width: 100%; }
.seg { min-height: 44px; padding: 6px 16px; background: #fff; border: 0; font-weight: 500; flex: 1 1 auto; }
.seg + .seg { border-inline-start: 1.5px solid var(--board); }
.seg.on { background: var(--board); color: #fff; font-weight: 700; }
.segs.small .seg { min-height: 38px; font-size: 15px; }
.tray { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tray-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tray-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 14px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--paper); }
.tray-chip.on { background: var(--chalk); border-color: var(--chalk); }
.selbar { position: sticky; bottom: 8px; z-index: 4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--chalk-soft); border: 2px solid var(--chalk); }

/* النوافذ */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(15, 50, 45, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: rise .18s ease-out; }
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 18px 8px; }
.sheet-head h2 { font-weight: 700; font-size: 21px; color: var(--board); }
.sheet-body { padding: 4px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.confirm-text { white-space: pre-line; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; padding: 20px; } .sheet { border-radius: 18px; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-error { color: var(--red); font-weight: 500; min-height: 0; }
.form-error:empty { display: none; }
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.option:hover { border-color: var(--board); }
.option small { color: var(--muted); }
.issues { display: flex; flex-direction: column; gap: 6px; }
.issue { width: 100%; text-align: start; padding: 10px 12px; border-radius: 10px; border: 0; border-inline-start: 5px solid; background: var(--paper); }
.issue.bad { border-color: var(--red); background: var(--red-soft); }
.issue.warn { border-color: #D9A521; background: var(--amber-soft); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.facts dt { color: var(--muted); }
.facts dd.small { font-size: 13px; overflow-wrap: anywhere; }
.card-preview { width: 100%; max-width: 340px; height: auto; align-self: center; border-radius: 12px; }

#toast { position: fixed; inset-inline: 12px; bottom: 16px; z-index: 40; margin: 0 auto; max-width: 560px; display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; background: var(--board-deep); color: #fff; }
#toast.show { display: flex; }
#toast.bad { background: #8E2516; }
#toast.ok { background: var(--ok); }
.toast-text { flex: 1 1 200px; }
.toast-btn { min-height: 38px; padding: 4px 14px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .6); background: transparent; color: #fff; font-weight: 700; }

.busy { position: fixed; inset: 0; z-index: 50; background: rgba(15, 50, 45, .82); display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 20px; }
.busy-box p { font-family: var(--kufi); font-size: 26px; margin-top: 18px; }
.busy-box small { color: #CFE3DC; }
.busy-grid { display: grid; grid-template-columns: repeat(6, 34px); gap: 6px; justify-content: center; }
.busy-grid i { height: 26px; border-radius: 6px; background: var(--chalk); opacity: .15; animation: fill 2.1s infinite; }
.busy-grid i:nth-child(3n) { background: #CFE8D8; }
.busy-grid i:nth-child(4n) { background: #F9D2C4; }
@keyframes fill { 0%, 100% { opacity: .15; } 40%, 70% { opacity: 1; } }

/* صفحة البداية */
.landing { min-height: 100vh; display: flex; flex-direction: column; background: var(--board); color: #fff; }
.hero { flex: 1; max-width: 1120px; width: 100%; margin: 0 auto; padding: 32px 16px 40px; display: grid; gap: 36px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.hero h1 { font-family: var(--kufi); font-weight: 700; font-size: clamp(38px, 8vw, 68px); line-height: 1.25; }
.hero p { font-size: 19px; max-width: 46ch; color: #DCEAE5; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.landing .btn.primary { background: var(--chalk); border-color: var(--chalk); color: var(--ink); }
.landing .btn.big:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .hero-note { font-size: 15px; color: #BFD5CD; }
.board { border: 10px solid var(--board-deep); border-radius: 18px; padding: 14px; background: #1B4F47; }
.board-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.board-cell { border-radius: 7px; color: var(--ink); font-size: clamp(10px, 2.4vw, 14px); font-weight: 700; padding: 10px 2px; text-align: center; white-space: nowrap; overflow: hidden; animation: chalk .45s both ease-out; }
@keyframes chalk { from { opacity: 0; transform: scale(.82); } }
.foot { padding: 14px 16px 22px; text-align: center; }
.foot .link { color: #DCEAE5; }
@media (min-width: 860px) { .hero { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { .board-cell, .sheet, .busy-grid i { animation: none; } .busy-grid i { opacity: .8; } }

/* الطباعة */
#print { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  body { background: #fff; }
  #app, #toast, .sheet-wrap, .busy { display: none !important; }
  #print { display: block; }
  .print-page { break-after: page; }
  .print-page:last-child { break-after: auto; }
  .print-page header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 18px; }
  .print-page header b { font-family: var(--kufi); font-size: 22px; }
  .tt-wrap { overflow: visible; }
  .tt { background: #fff; border-spacing: 0; border-collapse: collapse; padding: 0; min-width: 0; border-radius: 0; }
  .tt th { color: #000; border: 1.5px solid #333; background: #eee; }
  .tt td { border: 1.5px solid #333; height: 26mm; }
  .cell { border-radius: 0; min-height: 26mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cell.empty, .cell.closed { border: 0; background: #fff; }
  .c-main { font-size: 15pt; } .c-sub { font-size: 11pt; color: #000; }
  .tt-whole { font-size: 7pt; width: 100%; }
  .tt-whole th, .tt-whole td { min-width: 0; height: 9mm; border-color: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt-whole thead th { background: #ddd; color: #000; }
  .tt-whole tbody th { position: static; background: #eee; }
}

.public .brand { font-family: var(--sans); font-size: 20px; }
@media (max-width: 480px) { .step { padding: 6px 8px; font-size: 15px; gap: 5px; } .step-num { width: 22px; height: 22px; font-size: 13px; } .page-head h1 { font-size: 28px; } }
.preview { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }

/* المراقبة */
.duty { border-collapse: separate; border-spacing: 5px; background: var(--board); border-radius: 16px; padding: 8px; width: 100%; }
.duty th { color: #fff; font-weight: 700; font-size: 15px; padding: 6px 8px; white-space: nowrap; }
.duty th small { display: block; font-weight: 400; font-size: 12px; color: #CFE3DC; }
.duty td { padding: 0; }
.duty-cell { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 120px; min-height: 52px; padding: 6px 8px; border: 0; border-radius: 9px; background: var(--chalk-soft); color: var(--ink); font-weight: 700; text-align: center; }
.duty-cell.empty { background: transparent; border: 1.5px dashed rgba(255, 255, 255, .4); color: #CFE3DC; font-weight: 400; }
.duty-cell.bad { box-shadow: inset 0 0 0 3px var(--red); }
.duty-cell.empty.bad { background: rgba(194, 58, 39, .3); color: #fff; }
button.duty-cell:hover { outline: 2px solid var(--chalk); }
.duty-strip { background: var(--chalk-soft); border: 1.5px solid var(--chalk); border-radius: 12px; padding: 10px 14px; }
.duty-strip ul { list-style: disc; padding-inline-start: 20px; }
.chip.static { cursor: default; }
.dot.over { background: var(--red); color: #fff; }
.option.slim { padding: 8px 12px; }
.option.on { border-color: var(--board); background: var(--board-soft); }
.option.dim { opacity: .6; }
@media print {
  .duty { background: #fff; border-spacing: 0; border-collapse: collapse; padding: 0; border-radius: 0; }
  .duty th { color: #000; background: #eee; border: 1.5px solid #333; }
  .duty th small { color: #000; }
  .duty td { border: 1.5px solid #333; }
  .duty-cell { border-radius: 0; background: #fff; min-height: 16mm; font-size: 14pt; }
  .duty-strip { margin-top: 6mm; border-color: #333; background: #fff; }
}

/* اليوم: الغياب والبدلاء */
.date-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.date-nav input[type=date] { width: auto; flex: 0 1 190px; }
.absence { align-self: stretch; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.absence header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.absence h3 { font-size: 19px; }
.matrix.cover td, .matrix.cover th { text-align: start; }
.matrix.cover select { min-width: 220px; }
.tt-day { border-collapse: collapse; background: #fff; width: 100%; font-size: 13px; }
.tt-day th, .tt-day td { border: 1px solid var(--line); padding: 4px; text-align: center; min-width: 84px; height: 50px; line-height: 1.3; }
.tt-day thead th { background: var(--board); color: #fff; font-weight: 700; }
.tt-day tbody th { background: var(--board-soft); white-space: nowrap; }
.tt-day td.covered { box-shadow: inset 0 0 0 3px var(--chalk); }
.tt-day td.vacant { background: var(--amber-soft); color: var(--amber); }
.tt-day td.open { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 3px var(--red); }
.reserve { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; }
.reserve th, .reserve td { border: 1px solid var(--line); padding: 5px; vertical-align: top; text-align: start; min-width: 110px; }
.reserve thead th, .reserve tbody th { background: var(--board-soft); white-space: nowrap; }
.res-name { display: block; white-space: nowrap; }
.cover-strip { background: var(--ok-soft); border-color: var(--ok); }
@media print {
  .tt-day, .reserve { font-size: 9pt; }
  .tt-day th, .tt-day td, .reserve th, .reserve td { border-color: #333; min-width: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt-day thead th { background: #ddd; color: #000; }
}

/* الأوقات والامتحانات */
.tt th small, .tt-day th small { display: block; font-weight: 400; font-size: 11.5px; color: #CFE3DC; direction: ltr; }
textarea { width: 100%; min-height: 120px; resize: vertical; line-height: 1.7; }
.times-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-self: stretch; }
.times-grid input.num { width: 100%; flex: none; }
.times-preview { background: var(--board-soft); border-radius: 10px; padding: 10px 14px; font-size: 15px; align-self: stretch; }
.tt-day td.moved { box-shadow: inset 0 0 0 3px var(--ok); }
.duty-cell.light { background: var(--chalk-soft); min-width: 110px; font-size: 15px; }
.duty-cell.light.empty { background: var(--red-soft); border: 1.5px dashed var(--red); color: var(--red); }
.matrix.exam td { min-width: 130px; }
.matrix.exam select { min-width: 120px; }
@media print { .tt th small { color: #000; } .matrix.exam th, .matrix.exam td { border: 1.5px solid #333; padding: 6px; font-size: 12pt; } .duty-cell.light { background: #fff; } }
