/* نِظام — same look as the Nawat Soft ERP dashboard: white side menu, light top bar with screen search,
   gradient page icons and primary buttons, Cairo font (self-hosted: the centers work on a LAN without internet) */
@font-face { font-family: "Cairo"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url(../fonts/cairo-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-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: "Cairo"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url(../fonts/cairo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f6fb; --surface: #ffffff; --surface-2: #f8f9fd; --surface-3: #eef0f7; --line: #e8eaf2; --line-strong: #d9dce8;
  --text: #111827; --text-2: #374151; --muted: #5f6675; --faint: #6b7280;
  --primary: #4f46e5;
  /* Derived from --primary so any accent (presets or a custom colour, set by js/look.js) works in both modes */
  --primary-hover: color-mix(in srgb, var(--primary) 84%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 9%, var(--surface));
  --primary-ink: color-mix(in srgb, var(--primary) 90%, #000);
  --ring: color-mix(in srgb, var(--primary) 22%, transparent);
  --glow: color-mix(in srgb, var(--primary) 60%, transparent);
  --grad: linear-gradient(135deg, var(--primary), var(--primary-hover));
  --hover-row: var(--surface-2); --track: #c9cdd8; --scrim: rgba(15, 18, 35, .5); --ink-mix: #000;
  --zoom: 1; --vh: calc(100vh / var(--zoom));
  --green: #047857; --green-bg: #e7f8f1; --red: #c81e1e; --red-bg: #fdecec; --amber: #b45309; --amber-bg: #fef3e2; --gray: #4b5563; --gray-bg: #f0f1f5;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .04);
  --sh-2: 0 4px 6px -2px rgba(17, 24, 39, .04), 0 12px 24px -6px rgba(17, 24, 39, .08);
  --sh-3: 0 24px 48px -12px rgba(17, 24, 39, .22);
  --side-w: 270px; --top-h: 64px;
  color-scheme: light;
  --font: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
}
/* Indigo → purple → pink like the ERP, turned around the hue of whatever accent the PC chose */
@supports (color: oklch(from red l c h)) {
  :root { --grad: linear-gradient(135deg, var(--primary) 0%, oklch(from var(--primary) calc(l - .02) c calc(h + 30)) 55%, oklch(from var(--primary) l c calc(h + 70)) 120%); }
}

/* Dark mode: chosen in المظهر (data-theme="dark"), or "auto" follows the device */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f1a; --surface: #121826; --surface-2: #161d2e; --surface-3: #1d2539; --line: #232c42; --line-strong: #323c56;
  --text: #f1f4fa; --text-2: #cbd2e1; --muted: #a0a9bd; --faint: #8b95ab;
  --primary-ink: color-mix(in srgb, var(--primary) 55%, #fff);
  --primary-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --green: #34d399; --green-bg: #0f2e25; --red: #f87171; --red-bg: #361a1d; --amber: #fbbf24; --amber-bg: #33270f; --gray: #a3acbf; --gray-bg: #20283b;
  --track: #3a4560; --scrim: rgba(0, 0, 0, .6); --ink-mix: #fff;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .3); --sh-2: 0 8px 24px -8px rgba(0, 0, 0, .5); --sh-3: 0 24px 48px -12px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0b0f1a; --surface: #121826; --surface-2: #161d2e; --surface-3: #1d2539; --line: #232c42; --line-strong: #323c56;
    --text: #f1f4fa; --text-2: #cbd2e1; --muted: #a0a9bd; --faint: #8b95ab;
    --primary-ink: color-mix(in srgb, var(--primary) 55%, #fff);
    --primary-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
    --green: #34d399; --green-bg: #0f2e25; --red: #f87171; --red-bg: #361a1d; --amber: #fbbf24; --amber-bg: #33270f; --gray: #a3acbf; --gray-bg: #20283b;
    --track: #3a4560; --scrim: rgba(0, 0, 0, .6); --ink-mix: #fff;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .3); --sh-2: 0 8px 24px -8px rgba(0, 0, 0, .5); --sh-3: 0 24px 48px -12px rgba(0, 0, 0, .6);
  }
}

/* Screen size (المظهر): the whole UI is zoomed; --vh keeps full-height parts fitting the window */
html { zoom: var(--zoom); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-ink); text-decoration: none; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
kbd { font: 600 11px/1 var(--font); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; direction: ltr; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: var(--vh); }
.side { width: var(--side-w); flex: none; background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: var(--vh); z-index: 40; transition: width .2s ease; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 12px; height: var(--top-h); padding: 0 18px; flex: none; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px -6px var(--glow); }
.logo svg.i { width: 22px; height: 22px; }
.brand-t { min-width: 0; flex: 1; line-height: 1.2; }
.brand b { display: block; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .side-close { display: none; }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 12px 14px; }
.nav-title { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 16px 12px 6px; }
.nav-sec, .nav-home { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 11px; margin-block: 1px; border: 0; border-radius: 11px;
  background: none; color: var(--text-2); font-size: 14.5px; font-weight: 600; cursor: pointer; text-align: start; transition: background .15s, color .15s; }
.nav-sec:hover, .nav-home:hover { background: var(--surface-3); color: var(--text); }
.nav-ic { display: grid; place-items: center; color: var(--faint); flex: none; transition: color .15s; }
.nav-ic .i { width: 20px; height: 20px; }
.nav-sec:hover .nav-ic, .nav-home:hover .nav-ic { color: var(--primary); }
.nav-sec.current, .nav-sec.current .nav-ic { color: var(--primary-ink); }
.nav-home.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px var(--glow); }
.nav-home.active .nav-ic { color: #fff; }
.nav-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { flex: none; font-size: 11.5px; font-weight: 600; line-height: 1.6; padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.nav-sec .chev { width: 15px; height: 15px; opacity: .55; transition: transform .2s; transform: rotate(90deg); }
.nav-sec[aria-expanded="true"] .chev { transform: rotate(0); }
/* Screens of a section hang from a thin guide line */
.nav-links { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px; margin-inline-start: 21px; }
.nav-links::before { content: ""; position: absolute; inset-block: 4px 8px; inset-inline-start: 0; width: 2px; border-radius: 2px; background: var(--line); }
.nav-link { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 6px 13px; margin-inline-start: 9px;
  border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; }
.nav-link.active::before { content: ""; position: absolute; inset-inline-start: -9px; top: 25%; bottom: 25%; width: 2px; border-radius: 2px; background: var(--primary); }
.nav-link.soon { color: var(--faint); opacity: .7; cursor: default; }
.nav-link.soon:hover { background: none; }
.soon-tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 0 8px; }

.user { display: flex; align-items: center; gap: 10px; margin: 10px 12px 12px; padding: 9px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.user:hover { border-color: var(--primary); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #ec4899); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.user-link { display: flex; align-items: center; gap: 10px; color: inherit; min-width: 0; flex: 1; }
.user-t { min-width: 0; line-height: 1.3; }
.user b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user small { display: block; color: var(--muted); font-size: 12.5px; }
.dot-online { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px var(--surface-2); flex: none; }
.user .btn-icon { width: 34px; height: 34px; }
.side-scrim { display: none; }

/* Collapsed rail (desktop): icons only; a section click opens the full menu */
.app.rail { --side-w: 76px; }
.app.rail .brand { justify-content: center; padding: 0; }
.app.rail .brand-t, .app.rail .nav-title, .app.rail .nav-links, .app.rail .nav-t, .app.rail .cnt, .app.rail .nav-sec .chev,
.app.rail .user-t, .app.rail .user .btn-icon { display: none; }
.app.rail .nav { padding-inline: 12px; }
.app.rail .nav-sec, .app.rail .nav-home { justify-content: center; padding: 0; min-height: 46px; }
.app.rail .user { justify-content: center; padding: 8px; margin: 10px; }
.app.rail .user-link { flex: none; }
.app.rail .dot-online { position: absolute; bottom: 8px; inset-inline-end: 12px; }

/* Top bar: menu button, screen search, size / theme / account */
.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.gsearch { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; width: min(340px, 30vw); flex: none; padding: 0 13px 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-1); }
.gsearch:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.gsearch > .i, .gsearch > span > .i { width: 17px; height: 17px; color: var(--muted); }
.gsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; color: var(--text); }
.gs-results { position: absolute; top: calc(100% + 8px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3);
  padding: 6px; z-index: 50; max-height: 60vh; overflow-y: auto; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.gs-item .i { width: 17px; height: 17px; color: var(--muted); }
.gs-item small { margin-inline-start: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.gs-item:hover, .gs-item.sel { background: var(--primary-soft); color: var(--primary-ink); }
.gs-item.sel .i { color: var(--primary-ink); }
.dd-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* Page title inside the top bar (no separate title row): gradient icon of the section + title + section name */
.pt { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 0 1 auto; margin-inline-end: auto; }
.pt-t { min-width: 0; line-height: 1.25; }
.pt-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 8px 16px -8px var(--glow); }
.pt-ic .i { width: 19px; height: 19px; }
.pt h1 { margin: 0; font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt .crumb { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt[hidden] + .gsearch { margin-inline-end: auto; }

.content { padding: 20px 26px 26px; flex: 1; width: 100%; }
/* SaaS: subscription warning / read-only notice above the screen */
.sub-bar { margin: 14px 26px 0; padding: 10px 14px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); font-weight: 600; font-size: 14px; }
.sub-bar.bad { background: var(--red-bg); color: var(--red); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 26px 18px; color: var(--muted); font-size: 12.5px; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.card-body { padding: 20px; }
.card-foot { display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 17px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--sh-1); transition: .18s; }
.btn:hover { border-color: var(--primary); color: var(--primary-ink); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px var(--glow); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px var(--glow); color: #fff; }
.btn.danger { background: var(--red); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(220, 38, 38, .55); }
.btn.danger:hover { color: #fff; filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn .i { width: 18px; height: 18px; }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; border: 0; background: none; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; transition: .15s; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.del:hover { background: var(--red-bg); color: var(--red); }
.btn-icon:disabled { opacity: .35; cursor: default; }
.btn-icon .i { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.input, .select { height: 42px; width: 100%; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 14.5px; transition: .15s; }
.input:hover, .select:hover { border-color: var(--line-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.affix { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.affix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.affix .input { border: 0; border-radius: 0; box-shadow: none; }
.affix em { font-style: normal; display: grid; place-items: center; padding: 0 12px; background: var(--surface-3); border-inline-start: 1px solid var(--line); color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 240px; transition: .15s; }
.search:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; font-size: 14.5px; }
.search .i { color: var(--muted); width: 17px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* Filter chips (ERP "fchip"): pills, the chosen one filled with the primary colour */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--primary); }
.chip b { font-size: 11.5px; font-weight: 700; padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip[aria-pressed="true"] b { background: rgba(255, 255, 255, .25); color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.green { background: var(--green); } .dot.red { background: var(--red); } .dot.gray { background: var(--gray); }

/* Status pills with a dot */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on { background: var(--green-bg); color: var(--green); }
.badge.off { background: var(--gray-bg); color: var(--gray); }
.badge.stop { background: var(--red-bg); color: var(--red); }
button.badge { border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; }
.day { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: 13px; font-weight: 600; }

.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 42px; height: 24px; border-radius: 99px; background: var(--track); position: relative; transition: background .15s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: inset-inline-start .15s; }
.toggle input:checked + .track { background: var(--primary); }
.toggle input:checked + .track::after { inset-inline-start: 21px; }
.toggle input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Tables: a toolbar row (search + chips) on top, light header, thin row lines */
.table-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.table-tools .grow { flex: 1; }
.table-tools .search { min-width: 0; width: min(300px, 100%); }
.table-tools .select { width: auto; min-width: 170px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
.tbl th, .tbl td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--hover-row); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.sel { background: var(--primary-soft); box-shadow: inset -3px 0 0 var(--primary); }
.tbl tr.clickable { cursor: pointer; }
.tbl .name { display: flex; align-items: center; gap: 11px; min-width: 190px; }
/* Each row's initial gets its own colour (6 hues in turn, like the ERP's c1…c6) */
.tbl .name .mono { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
  background: color-mix(in srgb, var(--hue, var(--primary)) 13%, var(--surface)); color: color-mix(in srgb, var(--hue, var(--primary)) 75%, var(--ink-mix)); }
.tbl tbody tr:nth-child(6n+2) .mono { --hue: #0284c7; }
.tbl tbody tr:nth-child(6n+3) .mono { --hue: #059669; }
.tbl tbody tr:nth-child(6n+4) .mono { --hue: #d97706; }
.tbl tbody tr:nth-child(6n+5) .mono { --hue: #db2777; }
.tbl tbody tr:nth-child(6n) .mono { --hue: #7c3aed; }
.tbl .name b { display: block; font-weight: 600; white-space: nowrap; }
.tbl .name small { display: block; color: var(--muted); font-size: 12.5px; }
.tbl .money b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tbl .money small { color: var(--muted); font-size: 12.5px; }
.tbl .acts { display: flex; gap: 2px; justify-content: flex-end; opacity: .6; transition: opacity .15s; }
.tbl tr:hover .acts, .tbl .acts:focus-within { opacity: 1; }
@media (hover: none) { .tbl .acts { opacity: 1; } }
.times { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; font-weight: 600; color: var(--primary-ink); background: var(--primary-soft);
  padding: 2px 8px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
/* Laptops: age and gender move under the student's name instead of taking columns */
@media (max-width: 1440px) { .tbl .hide-md { display: none; } }
.tbl .show-md { display: none; }
@media (max-width: 1440px) { .tbl .show-md { display: block; } }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .i { width: 34px; height: 34px; opacity: .45; }
.empty b { display: block; color: var(--text); font-size: 16px; margin: 8px 0 2px; }
.alert { padding: 10px 14px; border-radius: 10px; background: var(--red-bg); color: var(--red); font-weight: 600; font-size: 14px; }

/* Row of filters / actions above a list */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-head .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Split: list + editor */
.split { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.split > .list { flex: 999 1 560px; min-width: 0; }
.split > .editor { flex: 1 1 380px; max-width: 440px; position: sticky; top: calc(var(--top-h) + 16px); }

/* quick add: the small "+" next to a field's title (stage, group, teacher) */
.qa-head { display: inline-flex; align-items: center; gap: 6px; }
.qa-btn { width: 22px; height: 22px; border-radius: 7px; border: 1px solid var(--line); background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; cursor: pointer; padding: 0; vertical-align: middle; }
.qa-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qa-btn .i { width: 14px; height: 14px; }
.qa-back { z-index: 60; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days button { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; cursor: pointer; font-size: 13px; padding: 0 2px; }
.days button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.slots { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.slot { display: flex; align-items: center; gap: 8px; }
.slot > b { width: 72px; font-size: 14px; }
.slot .input { height: 38px; flex: 1; min-width: 0; direction: ltr; text-align: center; }
.slot span { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; padding: 4px 6px; }

/* Home: gradient welcome (ERP "hero") + screens grouped by section */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 26px 30px; color: #fff; background: var(--grad);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; box-shadow: 0 18px 40px -20px var(--glow); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero::before { width: 260px; height: 260px; top: -130px; inset-inline-end: -60px; }
.hero::after { width: 150px; height: 150px; bottom: -75px; inset-inline-end: 210px; }
.hero > * { position: relative; }
.hero h2 { margin: 8px 0 4px; font-size: 26px; font-weight: 800; }
.hero p { margin: 0; opacity: .9; }
.hero-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .16); padding: 3px 11px; border-radius: 99px; }
.hero-date .i { width: 15px; height: 15px; }
.home-sec { margin-top: 24px; }
.home-sec h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.home-sec h3 .i { width: 18px; height: 18px; color: var(--primary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: .18s; }
.tile:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--sh-2); }
.tile .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--hue, var(--primary)) 12%, var(--surface)); color: color-mix(in srgb, var(--hue, var(--primary)) 78%, var(--ink-mix)); }
.tile .ic .i { width: 20px; height: 20px; }
.tile b { display: block; font-weight: 700; font-size: 14.5px; }

/* Modal + toast */
.modal-back { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--sh-3); padding: 22px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 0 0 18px; color: var(--muted); }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; }
.modal.wide { width: min(760px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide .mbody { overflow: auto; flex: 1; margin-bottom: 14px; }
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--text); color: var(--surface); padding: 12px 18px; border-radius: 12px; box-shadow: var(--sh-3); font-weight: 600; z-index: 60; }
.toast.err { background: var(--red); color: #fff; }

/* Login: gradient art panel (like the ERP) + form */
/* height (not min-height) + overflow hidden: the login page must never scroll, on any screen (user request 2026-10-27) —
   a flex child stretches to exactly this height, so anything of its content too tall for a short screen clips
   (login-side has its own overflow: hidden below) instead of growing the page */
.login { height: var(--vh); overflow: hidden; display: flex; flex-wrap: wrap; background: var(--surface); }
.login-side { position: relative; overflow: hidden; flex: 1.05 1 440px; background: #1e1b4b; background-image: var(--grad); color: #fff; padding: 32px 60px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.login-side::before, .login-side::after { content: ""; position: absolute; border-radius: 50%; filter: blur(10px); }
.login-side::before { width: 380px; height: 380px; background: #22d3ee; opacity: .22; top: -120px; inset-inline-end: -120px; }
.login-side::after { width: 320px; height: 320px; background: #f472b6; opacity: .28; bottom: -100px; inset-inline-start: -90px; }
.login-side > * { position: relative; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .logo { background: rgba(255, 255, 255, .2); box-shadow: none; }
.login-brand b { display: block; font-size: 21px; font-weight: 800; }
.login-brand small { display: block; font-size: 13px; opacity: .8; }
.login-brand.sm { display: none; }
/* الرسمة المتحركة (user request 2026-10-27, "معبّرة عن المنصة التعليمية"، شكل "د" من 4 تصميمات اتعرضوا):
   شعار التخرج ثابت في النص بينبض، حواليه دايرة متقطعة بتلف ببطء، وأيقونتين عليها عايمين حواليها زي قمر صناعي. */
.login-hero { display: flex; align-items: center; justify-content: center; height: 170px; margin-bottom: 6px; }
.lh-orbit { position: relative; width: 170px; height: 170px; }
.lh-ring { position: absolute; inset: 0; margin: auto; width: 152px; height: 152px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .35);
  animation: lh-spin 22s linear infinite; }
.lh-core { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 20px; background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32); backdrop-filter: blur(8px); display: grid; place-items: center; animation: lh-pulse 3.6s ease-in-out infinite; }
.lh-core .i { width: 28px; height: 28px; }
.lh-sat { position: absolute; inset: 0; margin: auto; width: 152px; height: 152px; }
.lh-sat.s1 { animation: lh-spin 18s linear infinite; }
.lh-sat.s2 { animation: lh-spin2 14s linear infinite; }
.lh-badge { position: absolute; top: -14px; inset-inline-start: calc(50% - 14px); width: 28px; height: 28px; border-radius: 9px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); display: grid; place-items: center; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .3); }
/* the badge spins the exact opposite of its own .lh-sat parent (same duration, opposite net angle) so the icon stays upright while it orbits */
.lh-sat.s1 .lh-badge { animation: lh-spin-rev 18s linear infinite; }
.lh-sat.s2 .lh-badge { animation: lh-spin2-rev 14s linear infinite; }
.lh-badge .i { width: 13px; height: 13px; }
@keyframes lh-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes lh-spin-rev { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } }
@keyframes lh-spin2 { 0% { transform: rotate(160deg); } 100% { transform: rotate(-200deg); } }
@keyframes lh-spin2-rev { 0% { transform: rotate(-160deg); } 100% { transform: rotate(200deg); } }
@keyframes lh-pulse {
  0%, 100% { box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .4), 0 0 0 0 rgba(255, 255, 255, .25); }
  50% { box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .4), 0 0 0 16px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) { .lh-ring, .lh-sat, .lh-sat .lh-badge, .lh-core { animation: none; } }
.login-pitch h2 { margin: 0 0 8px; font-size: 29px; line-height: 1.3; font-weight: 800; }
.login-pitch p { margin: 0; opacity: .85; font-size: 15px; }
.login-pitch ul { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 520px; }
.login-pitch li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px); font-weight: 600; font-size: 14px; }
.login-pitch li .i { width: 18px; height: 18px; }
/* this fits down to ~650px tall unaided (a 1366x768 laptop, browser chrome included); these are only for genuinely
   short windows past that — never on an ordinary screen, so the design never looks "plainer" at common heights */
@media (max-height: 560px) {
  .login-side { padding-block: 20px; gap: 10px; }
  .login-pitch ul { display: none; }
}
@media (max-height: 420px) { .login-hero { display: none; } }
.login-center small { display: block; opacity: .75; font-size: 13px; }
.login-center b { font-size: 17px; }
.login-main { flex: 1 1 400px; display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-form h1 { margin: 0 0 4px; font-size: 30px; font-weight: 800; }
.login-form p { margin: 0 0 12px; color: var(--muted); }
.login-form .btn { height: 48px; font-size: 16px; width: 100%; }
.login-input { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); transition: .15s; }
.login-input:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.login-input > .i { width: 18px; height: 18px; color: var(--muted); }
.login-input input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; font-size: 15.5px; }
.pw-eye { width: 32px; height: 32px; margin-inline-end: -6px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.pw-eye .i { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .login-side { display: none; }
  .login-brand.sm { display: flex; }
  .login-brand.sm .logo { background: var(--grad); }
  .login-brand.sm small { color: var(--muted); opacity: 1; }
}

/* Medium screens: the add/edit card slides in from the side instead of wrapping under the list */
@media (max-width: 1180px) {
  .split > .editor[id] { position: fixed; inset-block: 0; inset-inline-end: 0; top: 0; width: min(440px, 100%); max-width: none; border-radius: 0; z-index: 45; overflow-y: auto; box-shadow: var(--sh-3); border-block: 0; }
  /* Always-visible add panels go under the list instead of covering it */
  .split > .editor:not([id]) { position: static; max-width: none; flex-basis: 100%; }
  .acct-name { display: none; }
}

/* Small screens: the menu becomes a drawer */
@media (max-width: 900px) {
  .app.rail { --side-w: 270px; }
  .app.rail .brand { justify-content: flex-start; padding: 0 18px; }
  .app.rail .brand-t, .app.rail .nav-title, .app.rail .nav-t, .app.rail .cnt, .app.rail .user-t { display: block; }
  .app.rail .nav-sec .chev { display: inline; }
  .app.rail .user .btn-icon { display: inline-grid; }
  .app.rail .nav-links:not([hidden]) { display: flex; }
  .app.rail .nav-sec, .app.rail .nav-home { justify-content: flex-start; padding: 0 11px; min-height: 42px; }
  .app.rail .user { justify-content: flex-start; padding: 9px 10px; margin: 10px 12px 12px; }
  .app.rail .user-link { flex: 1; }
  .app.rail .dot-online { position: static; }
  .side { width: min(300px, 86vw); position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(105%); transition: transform .22s ease; box-shadow: var(--sh-3); }
  .app.menu-open .side { transform: none; }
  .app.menu-open .side-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 39; animation: fade .2s; }
  .brand .side-close { display: inline-grid; }
  body { overflow-x: hidden; }
  body.no-scroll { overflow: hidden; }
  .top { padding: 0 14px; }
  .gsearch { width: min(260px, 34vw); }
  .pt-ic { display: none; }
  .content { padding: 14px 16px 18px; }
  .sub-bar { margin: 12px 16px 0; }
  .foot { padding: 10px 16px 16px; }
  .search { min-width: 0; flex: 1 1 200px; }
  .page-head .tools { width: 100%; }
  .split > .editor[id] { width: 100%; }
}
@keyframes fade { from { opacity: 0; } }

/* Phones */
@media (max-width: 600px) {
  .gsearch kbd { display: none; }
  .top-tools { gap: 4px; }
  .zoom-ctl .zoom-val { display: none; }
  .zoom-ctl .btn-icon { width: 30px; height: 30px; }
  .content { padding: 12px; }
  .sub-bar { margin: 10px 12px 0; }
  .page-head { margin-bottom: 12px; }
  .page-head .tools > * { flex: 1 1 100%; }
  .page-head .tools > .select { width: 100% !important; min-width: 0 !important; }
  .page-head .tools > .btn { flex: 1 1 calc(50% - 4px); }
  .page-head .tools > .grow { display: none; }
  .table-tools { padding: 12px; }
  .table-tools .search, .table-tools .select { width: 100%; flex: 1 1 100%; }
  .card-head, .card-body { padding: 14px; }
  .card-foot { padding: 12px 14px; flex-wrap: wrap; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100% !important; max-width: none !important; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 18px 16px; }
  .drawer > .drawer-body { padding: 14px; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .photo { flex-wrap: wrap; }
  .seg { width: 100%; }
  .seg label { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .toast { inset-inline: 12px; transform: none; bottom: 16px; text-align: center; }
  .hide-sm { display: none; }
  table.tbl { min-width: 560px; }
  .hero { padding: 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
}

/* Wide side drawer (big forms like students) */
.drawer-back { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); z-index: 44; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(680px, 100%); background: var(--surface); z-index: 45; display: flex; flex-direction: column; box-shadow: var(--sh-3); }
.drawer > .card-head { flex: none; }
.drawer > .drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.drawer > .card-foot { flex: none; background: var(--surface-2); }
.fs { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; }
.fs > legend { padding: 0 8px; font-weight: 700; font-size: 14px; color: var(--primary-ink); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.photo { display: flex; align-items: center; gap: 14px; }
.photo .ph { width: 88px; height: 104px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--faint); padding: 0; }
.photo .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.barcode-box { display: flex; gap: 8px; align-items: end; }
.barcode-box .input { direction: ltr; text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 16px; letter-spacing: .5px; }
.checks { display: flex; flex-wrap: wrap; gap: 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.pager { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pager .btn { height: 34px; padding: 0 12px; }
.ok-txt { color: var(--green); font-weight: 600; }
.err-txt { color: var(--red); font-weight: 600; }
@media (min-width: 601px) and (max-width: 700px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Barcode scanner screens (attendance) */
.scan-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.scan-box { flex: 2 1 420px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.scan-box label { font-weight: 700; font-size: 15px; }
.scan-input { height: 64px; font-size: 26px; text-align: center; direction: ltr; letter-spacing: 2px; font-family: ui-monospace, Consolas, monospace; border: 2px solid var(--primary); border-radius: 14px; outline: none; width: 100%; background: var(--surface); }
.scan-input:focus { box-shadow: 0 0 0 4px var(--ring); }
.scan-result { flex: 3 1 420px; border-radius: var(--r-lg); padding: 20px 24px; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-height: 140px; border: 1px solid var(--line); background: var(--surface); }
.scan-result.ok { background: #ecfdf5; border-color: #a7f3d0; }
.scan-result.err { background: #fef2f2; border-color: #fecaca; }
.scan-result.warn { background: #fffbeb; border-color: #fde68a; }
.scan-result b { font-size: 26px; line-height: 1.3; }
.scan-result.ok b { color: #065f46; }
.scan-result.err b { color: #991b1b; }
.scan-result.warn b { color: #92400e; }
.scan-result span { color: var(--text-2); font-size: 16px; }
/* The coloured result boxes keep light backgrounds in both modes, so their text stays dark */
.scan-result.ok, .scan-result.err, .scan-result.warn { color: #1f2937; }
.scan-result.ok span, .scan-result.err span, .scan-result.warn span { color: #374151; }
.clock { flex: 1 1 180px; padding: 18px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.clock b { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.clock span { color: var(--muted); }

/* Segmented choice (radio buttons) */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; }
.seg label { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-1); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }

/* المظهر */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; color: #fff; padding: 0; box-shadow: var(--sh-1); }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 3px var(--surface) inset; }
.swatch .i { opacity: 0; }
.swatch[aria-pressed="true"] .i { opacity: 1; }
.swatch.custom { background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444); position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.look-preview { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface-2); }

/* Top bar tools: screen size, light/dark, account menu */
.top-tools { display: flex; align-items: center; gap: 6px; }
.zoom-ctl { display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--sh-1); }
.zoom-ctl .btn-icon { width: 34px; height: 34px; }
.zoom-val { min-width: 50px; height: 34px; border: 0; background: none; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--text); cursor: pointer; border-radius: 9px; }
.zoom-val:hover { background: var(--surface-3); }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 8px; height: 44px; padding: 3px; padding-inline-end: 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); box-shadow: var(--sh-1);
  color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.acct-btn:hover { border-color: var(--primary); }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.acct-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3); padding: 6px; z-index: 30; display: flex; flex-direction: column; }
.acct-menu[hidden] { display: none; }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 11px; border-radius: 9px; color: var(--text-2); font: inherit; font-weight: 600; font-size: 14px; border: 0; background: none; cursor: pointer; text-align: start; }
.acct-menu a .i, .acct-menu button .i { width: 18px; height: 18px; color: var(--muted); }
.acct-menu a:hover, .acct-menu button:hover { background: var(--surface-3); color: var(--text); }
.acct-menu #m-logout:hover { background: var(--red-bg); color: var(--red); }
.acct-menu #m-logout:hover .i { color: var(--red); }
@media (max-width: 600px) { .acct-btn { padding: 3px; } }

/* File drop area (تصحيح الامتحان) */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2); cursor: pointer; color: var(--text); }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop > .i { width: 28px; height: 28px; color: var(--primary-ink); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .3); box-shadow: none; backdrop-filter: blur(6px); }
.btn.glass:hover { background: rgba(255, 255, 255, .26); color: #fff; border-color: rgba(255, 255, 255, .45); }
/* Phones: the size control lives in المظهر so the search keeps its room */
@media (max-width: 600px) { .zoom-ctl { display: none; } }
/* Phones: the bar wraps — menu, title and account on the first line, the screen search under them */
@media (max-width: 600px) {
  .top { height: auto; flex-wrap: wrap; row-gap: 8px; padding-block: 10px; }
  .pt { flex: 1 1 0; }
  .pt .crumb { display: none; }
  .gsearch { order: 3; flex: 1 1 100%; width: auto; }
}

/* بيانات الأسئلة: the answer key drawn like the bubble sheet */
.key-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 22px; }
.key-row { display: flex; align-items: center; gap: 10px; padding: 3px 6px; border-radius: 10px; }
.key-row:hover, .key-row:focus-within { background: var(--surface-2); }
.key-row > b { width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.bubbles { display: flex; gap: 6px; }
.bubbles label { position: relative; cursor: pointer; }
.bubbles input { position: absolute; opacity: 0; pointer-events: none; }
.bubbles span { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--muted); transition: .12s; }
.bubbles label:hover span { border-color: var(--primary); color: var(--primary-ink); }
.bubbles input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 10px -4px var(--glow); }
.bubbles input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* List screens (class "rows", the user's pick): each row is its own white card on the page background — compact sizes so
   more rows fit. The toolbar (search / stage) stays a white bar on top. */
.card.rows { background: none; border-color: transparent; box-shadow: none; }
.card.rows > .table-tools { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-1); margin-bottom: 6px; padding: 10px 14px; }
.card.rows > .card-foot { border: 0; padding: 8px 6px 0; }
.card.rows > .card-head { border: 0; padding-inline: 6px; }
.card.rows .table-wrap { padding: 2px; }
.card.rows .tbl { border-collapse: separate; border-spacing: 0 6px; margin-top: -6px; }
.card.rows .tbl th { background: none; border: 0; padding: 4px 14px 0; font-size: 12.5px; }
.card.rows .tbl td { background: var(--surface); border-block: 1px solid var(--line); border-bottom-width: 1px; padding: 8px 14px; font-size: 14px; }
.card.rows .tbl tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.card.rows .tbl td:first-child { border-inline-start: 1px solid var(--line); border-start-start-radius: 14px; border-end-start-radius: 14px; }
.card.rows .tbl td:last-child { border-inline-end: 1px solid var(--line); border-start-end-radius: 14px; border-end-end-radius: 14px; }
.card.rows .tbl tbody tr:hover { background: none; }
.card.rows .tbl tbody tr:hover td { background: var(--surface-2); border-color: var(--line-strong); }
.card.rows .tbl tbody tr.sel { box-shadow: none; }
.card.rows .tbl tbody tr.sel td { background: var(--primary-soft); }
.card.rows .tbl td[colspan] { border-radius: 14px; }
.card.rows .tbl .name { gap: 10px; }
.card.rows .tbl .name .mono { width: 34px; height: 34px; border-radius: 10px; font-size: 13.5px; }
.card.rows .tbl .name b { font-size: 14.5px; }
.card.rows .tbl .name small { font-size: 12px; }
.card.rows .tbl .acts { gap: 6px; opacity: 1; }
.card.rows .tbl .acts .btn-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--text-2); }
.card.rows .tbl .acts .btn-icon:hover { background: var(--primary-soft); color: var(--primary-ink); }
.card.rows .tbl .acts .btn-icon.del:hover { background: var(--red-bg); color: var(--red); }
.card.rows .tbl .acts .btn-icon .i { width: 16px; height: 16px; }
.card.rows .badge { height: 24px; font-size: 12.5px; }
.mono-num { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; color: var(--text-2); direction: ltr; unicode-bidi: isolate; }
.cls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; white-space: nowrap; }
.grp { font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--hue) 13%, var(--surface)); color: color-mix(in srgb, var(--hue) 78%, var(--ink-mix)); }

/* Screen search list: section headings when nothing is typed yet */
.gs-sec { position: sticky; top: -6px; z-index: 1; padding: 8px 10px 4px; margin: 0 -6px; background: var(--surface); font-size: 12px; font-weight: 700; color: var(--muted); }
.gs-sec:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line); }

/* Drop-downs: our own chevron instead of the browser's arrow (RTL: on the left) */
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 13px center; }
.select:disabled { cursor: not-allowed; opacity: .6; }

/* Choice cards (طباعة الامتحان: the exam) */
.pick-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 260px; overflow-y: auto; padding: 2px; }
.pick-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: .15s; }
.pick-card:hover { border-color: var(--primary); }
.pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card b { font-size: 14.5px; }
.pick-card small { color: var(--muted); font-size: 12.5px; }
.pick-meta { display: flex; gap: 6px; margin-top: 6px; }
.pick-meta span { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.pick-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.pick-card:has(input:checked) .pick-meta span { background: var(--surface); color: var(--primary-ink); }
.pick-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.pick-card:has(input:checked)::after { content: ""; position: absolute; top: 10px; inset-inline-end: 10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }

/* Barcode field (حضور / انصراف): looks like the card's barcode label — black bars on white in both modes */
.bc-field { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 18px 6px; border: 2px solid var(--primary); border-radius: 14px;
  background: #fff; color: #111; cursor: text; transition: box-shadow .15s; }
.bc-field:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.bc-bars { width: 100%; display: flex; justify-content: center; }
.bc-bars svg { width: min(100%, 360px); height: 64px; display: block; }
.bc-field.empty .bc-bars { opacity: .12; }
.bc-digits { width: 100%; border: 0; outline: 0; background: none; color: #111; text-align: center; direction: ltr;
  font: 600 22px/1.3 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: 6px; padding: 0; }
.bc-digits::placeholder { color: #6b7280; letter-spacing: 0; font: 600 15px var(--font); }

/* ---------- Home dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.kpi { display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px; color: var(--text); transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.kpi-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.kpi-ic .i { width: 21px; height: 21px; }
.c1 { background: color-mix(in srgb, #4f46e5 12%, var(--surface)); color: color-mix(in srgb, #4f46e5 80%, var(--ink-mix)); }
.c3 { background: color-mix(in srgb, #059669 12%, var(--surface)); color: color-mix(in srgb, #059669 80%, var(--ink-mix)); }
.c4 { background: color-mix(in srgb, #d97706 12%, var(--surface)); color: color-mix(in srgb, #d97706 80%, var(--ink-mix)); }
.c6 { background: color-mix(in srgb, #7c3aed 12%, var(--surface)); color: color-mix(in srgb, #7c3aed 80%, var(--ink-mix)); }
.kpi-t { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.kpi-t small { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-t b { font-size: 26px; font-weight: 800; line-height: 1.25; }
.kpi-t b small { font-size: 13px; color: var(--muted); }
.kpi-sub { color: var(--muted); font-size: 12.5px; }
.meter { display: block; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 14%, var(--surface)); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-card .card-head { border: 0; padding-bottom: 0; }

/* Columns: ≤ 24px bars, 4px rounded top, square at the baseline; the whole slot is the hover target */
.cols { position: relative; display: flex; align-items: stretch; gap: 4px; height: 210px; padding-inline-start: 34px; }
.cols-grid { position: absolute; inset: 0 0 24px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cols-grid span { border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 0; padding-top: 0; text-align: end; direction: ltr; }
.cols-grid span::before { content: ""; }
.col { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; outline: none; }
.bar-slot { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar-slot i { width: min(24px, 70%); min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--primary) 45%, var(--surface)); transition: background .12s; }
.col.now .bar-slot i { background: var(--primary); }
.bar-slot i { position: relative; }
.bar-slot em { position: absolute; bottom: calc(100% + 2px); inset-inline: -12px; text-align: center; font-style: normal; font-size: 12px; font-weight: 700; color: var(--text); }
.col small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.col.now small { color: var(--text); font-weight: 700; }
.col:hover .bar-slot i, .col:focus-visible .bar-slot i { background: var(--primary); }
.col .tip { position: absolute; bottom: calc(100% - 20px); inset-inline-start: 50%; transform: translateX(50%); display: none; z-index: 2; white-space: nowrap;
  background: var(--text); color: var(--surface); padding: 6px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--sh-2); }
.col .tip b { display: block; font-size: 13px; }
.col:hover .tip, .col:focus-visible .tip { display: block; }

/* Horizontal bars: label · bar · value at the tip */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 120px) 1fr auto; align-items: center; gap: 10px; outline: none; border-radius: 8px; }
.hbar:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.hbar-l { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 18px; display: flex; }
.hbar-track i { height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--primary); }
[dir="rtl"] .hbar-track i { border-radius: 4px 0 0 4px; }
.hbar b { font-size: 14px; }
.avg { display: flex; align-items: center; gap: 10px; }
.avg .meter { width: 120px; margin: 0; }
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { flex-direction: column; gap: 8px; padding: 12px; }
  .kpi-ic { width: 36px; height: 36px; border-radius: 11px; }
  .kpi-t b { font-size: 22px; }
  .cols { height: 170px; }
  .col small { font-size: 9.5px; }
}

/* Dense card rows (attendance lists): tighter spacing so more students fit; the list scrolls inside its box */
.card.rows.dense > .card-head { padding: 4px 6px 8px; }
.card.rows.dense .table-wrap { overflow-y: auto; }
.card.rows.dense .tbl { border-spacing: 0 4px; margin-top: -4px; }
.card.rows.dense .tbl th { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 4px 12px; }
.card.rows.dense .tbl td { padding: 5px 12px; font-size: 13.5px; }
.card.rows.dense .tbl td:first-child { border-start-start-radius: 11px; border-end-start-radius: 11px; }
.card.rows.dense .tbl td:last-child { border-start-end-radius: 11px; border-end-end-radius: 11px; }
.card.rows.dense .tbl .name .mono { width: 28px; height: 28px; border-radius: 8px; font-size: 12.5px; }
.card.rows.dense .tbl .name b { font-size: 14px; }
.card.rows.dense .tbl .acts .btn-icon { width: 28px; height: 28px; }
.card.rows.dense .empty { padding: 26px 10px; }

/* حضور / انصراف: one compact strip on top — barcode label · result · clock */
.scan-strip { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; padding: 10px; margin-bottom: 12px; }
.bc-field.compact { flex: 0 1 330px; min-width: 240px; padding: 8px 14px 4px; border-radius: 12px; }
.bc-field.compact .bc-bars svg { height: 38px; width: min(100%, 280px); }
.bc-field.compact .bc-digits { font-size: 17px; letter-spacing: 4px; }
.bc-field.compact .bc-digits::placeholder { font-size: 12.5px; }
.scan-strip .scan-result { flex: 1 1 300px; min-height: 0; padding: 10px 18px; border-radius: 12px; border: 0; border-inline-start: 5px solid var(--line-strong);
  background: var(--surface-2); gap: 2px; justify-content: center; }
.scan-strip .scan-result b { font-size: 20px; line-height: 1.35; }
.scan-strip .scan-result span { font-size: 14px; color: var(--muted); }
.scan-strip .scan-result.ok { border-inline-start-color: #10b981; }
.scan-strip .scan-result.err { border-inline-start-color: #ef4444; }
.scan-strip .scan-result.warn { border-inline-start-color: #f59e0b; }
.scan-strip .scan-result.ok span, .scan-strip .scan-result.err span, .scan-strip .scan-result.warn span { color: #374151; }
.scan-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; min-width: 130px; }
.scan-side .clock { padding: 0; flex: none; gap: 0; }
.scan-side .clock b { font-size: 24px; line-height: 1.2; }
.scan-side .clock span { font-size: 12px; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn.sm .i { width: 15px; height: 15px; }
@media (max-width: 600px) { .bc-field.compact { flex-basis: 100%; } .scan-side { flex-direction: row; flex-basis: 100%; justify-content: space-between; } }
.scan-strip .scan-result.ok { background: #ecfdf5; }
.scan-strip .scan-result.err { background: #fef2f2; }
.scan-strip .scan-result.warn { background: #fffbeb; }
.grp { white-space: nowrap; }

/* حضور الطلاب: today's list + the four alert lists (like the desktop's GrdAlert1–4) */
.att-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .att-grid { grid-template-columns: minmax(0, 1fr); } }
.alert-panels { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 10px; overflow: hidden; min-height: 320px; }
.alert-panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid color-mix(in srgb, var(--hue) 30%, var(--line));
  border-radius: 12px; box-shadow: var(--sh-1); overflow: hidden; }
/* Filled header in the list's colour, like the desktop's coloured labels */
.alert-panel header { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: var(--hue); color: #fff; }
.alert-panel header b { font-size: 14px; font-weight: 700; }
.alert-panel header .grow { flex: 1; }
.a-cnt { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 99px; background: rgba(255, 255, 255, .25); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.a-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 8px;
  background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.a-btn:hover { background: rgba(255, 255, 255, .28); }
.a-btn .i { width: 15px; height: 15px; }
.alert-list { overflow-y: auto; flex: 1; min-height: 40px; }
.a-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.a-tbl th { position: sticky; top: 0; background: color-mix(in srgb, var(--hue) 8%, var(--surface)); color: var(--muted); font-size: 11.5px; font-weight: 700;
  text-align: start; padding: 4px 8px; }
.a-tbl td { padding: 5px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.a-tbl tr:hover td { background: color-mix(in srgb, var(--hue) 6%, var(--surface)); }
.a-tbl td:first-child, .a-tbl th:first-child { width: 26px; padding-inline-end: 0; }
.a-tbl input { accent-color: var(--hue); width: 15px; height: 15px; cursor: pointer; display: block; }
.a-tbl b { font-weight: 600; white-space: nowrap; }
.a-notes { color: var(--muted); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--muted); direction: ltr; text-align: end; white-space: nowrap; }
.alert-empty { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; min-height: 40px; padding: 8px; color: var(--muted); font-size: 12.5px; }
.alert-empty .i { width: 15px; height: 15px; color: var(--hue); }
.alert-empty.err { color: var(--red); text-align: center; }
.adot { width: 9px; height: 9px; border-radius: 50%; background: var(--hue); flex: none; box-shadow: 0 0 0 2px var(--surface); }
.alert-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.alert-chips span { padding: 3px 10px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.scan-side .clock b small { font-size: 15px; color: var(--muted); }
.scan-side .clock b em { font-style: normal; font-size: 15px; }

/* حضور الطلاب: alert lists in a drawer. A slim rail on the left shows the four counts; a button opens the drawer on that list */
.att-grid { grid-template-columns: minmax(0, 1fr) 76px; }
@media (max-width: 1100px) { .att-grid { grid-template-columns: minmax(0, 1fr) 76px; } }
.alert-rail { display: flex; flex-direction: column; gap: 8px; position: sticky; top: calc(var(--top-h) + 12px); }
.ar-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--hue); color: #fff; font: inherit; box-shadow: 0 6px 14px -8px var(--hue); transition: transform .12s, opacity .12s; }
.ar-btn:hover { transform: translateX(-2px); }
.ar-btn b { font-size: 20px; line-height: 1.1; font-weight: 800; }
.ar-btn small { font-size: 11px; font-weight: 700; opacity: .95; }
.ar-btn.zero { background: var(--surface); color: var(--muted); box-shadow: var(--sh-1); border: 1px solid var(--line); }
.ar-btn.zero b { color: color-mix(in srgb, var(--hue) 70%, var(--muted)); }
.ar-btn.flash { animation: arflash 1s ease 2; }
@keyframes arflash { 0%, 100% { transform: none; } 30% { transform: scale(1.12); box-shadow: 0 0 0 6px color-mix(in srgb, var(--hue) 30%, transparent); } }
/* RTL: the drawer slides out from the left edge */
.alert-drawer { position: fixed; z-index: 35; top: calc(var(--top-h) + 8px); bottom: 12px; inset-inline-end: 12px; width: min(460px, calc(100vw - 24px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--hue); border-radius: 16px;
  box-shadow: var(--sh-3); animation: adin .18s ease; }
@keyframes adin { from { opacity: 0; transform: translateX(-16px); } }
.alert-drawer header { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0 8px; border-bottom: 1px solid var(--line); }
.ad-tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.ad-tab { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 7px; border: 0; border-bottom: 3px solid transparent; background: none;
  font: inherit; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ad-tab span { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--hue) 14%, var(--surface)); color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); }
.ad-tab[aria-selected="true"] { color: color-mix(in srgb, var(--hue) 85%, var(--ink-mix)); border-bottom-color: var(--hue); }
.ad-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.ad-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ad-row:hover { background: color-mix(in srgb, var(--hue) 6%, var(--surface)); }
.ad-row input { accent-color: var(--hue); width: 17px; height: 17px; flex: none; cursor: pointer; }
.ad-row span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.ad-row b { font-size: 14px; font-weight: 600; }
.ad-row small { color: var(--muted); font-size: 12.5px; }
.ad-row em { font-style: normal; font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); direction: ltr; }
.ad-row.fresh { background: color-mix(in srgb, var(--hue) 13%, var(--surface)); }
.ad-row.fresh b { color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); }
.alert-drawer footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.alert-drawer footer .grow { flex: 1; font-size: 12px; padding: 0; }
.alert-drawer .alert-empty { min-height: 120px; }
@media (max-width: 600px) { .att-grid { grid-template-columns: minmax(0, 1fr); } .alert-rail { flex-direction: row; position: static; order: -1; } .ar-btn { flex: 1; } }

/* The result box keeps one height whatever it shows, so the lists below never jump */
.scan-strip .scan-result { height: 86px; overflow: hidden; }
.scan-strip .scan-result > b, .scan-strip .scan-result > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-strip .scan-result.has-chips { padding-block: 7px; gap: 1px; }
.scan-strip .scan-result.has-chips > b { font-size: 17px; line-height: 1.3; }
.scan-strip .scan-result.has-chips > span { font-size: 12.5px; }
.scan-strip .alert-chips { flex-wrap: nowrap; overflow: hidden; margin-top: 3px; }
.scan-strip .alert-chips span { flex: 0 1 auto; min-width: 0; max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 9px; font-size: 12.5px; line-height: 1.5; }
@media (max-width: 600px) { .scan-strip .scan-result { height: auto; min-height: 70px; } }
.ad-all { position: sticky; top: -4px; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-top: -4px; background: color-mix(in srgb, var(--hue) 8%, var(--surface));
  border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.ad-all input { accent-color: var(--hue); width: 17px; height: 17px; cursor: pointer; }
.ad-all span { color: var(--muted); font-weight: 600; }
.ad-all em { margin-inline-start: auto; font-style: normal; font-size: 12.5px; color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); }

/* التنبيهات (4 screens + manual report): slim coloured bar, dense card rows, the list fitted to the window */
.al-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 14px; margin-bottom: 12px; border-inline-start: 5px solid var(--hue); }
.al-bar b { font-size: 15px; color: color-mix(in srgb, var(--hue) 82%, var(--ink-mix)); }
.al-bar small { color: var(--muted); font-size: 13px; }
.al-bar .grow { flex: 1; }
.al-bar .toggle { font-size: 13.5px; }
.al-bar .toggle input:checked + .track { background: var(--hue); }
.al-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hue) 18%, transparent); }
.al-wrap .split { gap: 12px; }
.al-wrap .card.rows > .table-tools { padding: 8px 10px; gap: 8px; }
.al-wrap .table-tools .search { width: min(240px, 100%); height: 38px; }
.al-wrap .chip { height: 32px; padding: 0 11px; font-size: 13px; }
.al-wrap .tbl .name .mono { background: color-mix(in srgb, var(--hue) 13%, var(--surface)); color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); }
.al-wrap .tbl .name small { font-size: 11.5px; }
.al-note { color: var(--text-2); max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-wrap .tbl tbody tr.sel td { background: color-mix(in srgb, var(--hue) 10%, var(--surface)); }
.btn.danger-text { color: var(--red); }
.btn.danger-text:hover { border-color: var(--red); color: var(--red); }
.al-editor { border-top: 3px solid var(--hue); }
.al-editor .card-head { padding: 12px 16px; }
.al-editor .card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.al-editor .card-foot { padding: 10px 16px; }
.al-pick { display: flex; flex-direction: column; gap: 10px; }
.al-who { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--hue) 10%, var(--surface)); font-weight: 700; }
.al-editor textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }
.al-wrap .table-tools { flex-wrap: nowrap; }
.al-wrap .table-tools .search { flex: 1 1 160px; width: auto; min-width: 0; }
.al-wrap .table-tools .chips { flex-wrap: nowrap; }
.al-wrap .tbl { table-layout: fixed; width: 100%; }
.al-wrap .tbl .c-name { width: 36%; }
.al-wrap .tbl .c-st { width: 118px; }
.al-wrap .tbl .c-act { width: 84px; }
.al-wrap .tbl td { overflow: hidden; }
.al-wrap .tbl .name { min-width: 0; }
.al-wrap .tbl .name .mono { width: 26px; height: 26px; flex: none; }
.al-wrap .tbl .name > span:not(.mono) { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.al-wrap .tbl .name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-wrap .tbl .name small { flex: none; color: var(--muted); }
.al-note { max-width: none; }
@media (max-width: 900px) {
  .al-wrap .table-tools { flex-wrap: wrap; }
  .al-wrap .tbl { table-layout: auto; }
  .al-wrap .tbl colgroup, .al-wrap .tbl td:nth-child(3), .al-wrap .tbl th:nth-child(3) { display: none; }
  .al-wrap .al-note { width: 100%; max-width: 0; }
  .al-wrap .tbl .name b { max-width: 34vw; }
}
@media (max-width: 600px) { .al-wrap .tbl .name small { display: none; } .al-wrap .tbl td { padding-inline: 8px; } .al-wrap .tbl .acts { gap: 4px; } }

/* Scroll-free pages: a list and a side form fitted to the window (fitSplit in ui.js) */
.fit-scroll { overflow-y: auto; }
.count-pill { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.count-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.count-pill.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.count-pill.warn b { color: var(--amber); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.muted { color: var(--muted); }
.pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.pct.bad { color: var(--red); }
.tbl td.one { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* الامتحانات screens */
.pbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 9px 14px; margin-bottom: 12px; }
.pbar > b { font-size: 15px; }
.pbar .grow { flex: 1; }
.pbar-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-ink); }
.pbar-ic .i { width: 17px; height: 17px; }
.xp.split { gap: 12px; }
.xp .card.rows > .table-tools, .xp-key > .table-tools { padding: 8px 10px; gap: 8px; }
.xp .table-tools .search { flex: 2 1 200px; width: auto; height: 38px; }
.xp .table-tools .select, .xp-key .table-tools .select { flex: 1 1 140px; width: auto; min-width: 0; height: 38px; font-size: 14px; }
.xp .table-tools .select.wide, .xp-key .table-tools .select.wide { flex: 2 1 220px; }
.xp-key .table-tools .select.narrow { flex: 0 1 130px; }
.xp .tbl td { white-space: nowrap; }
.xp .tbl .name { min-width: 0; }
.xp .tbl .name > span:not(.mono) { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.xp .tbl .name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.xp .tbl .name small { flex: none; }
.xp .editor { border-top: 3px solid var(--primary); }
.xp .editor .card-head { padding: 12px 16px; }
.xp .editor .card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.xp .editor .card-foot { padding: 10px 16px; }
.f2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.xp-key > .card-body { overflow-y: auto; padding: 12px 16px; }
.xp-key .key-head { margin-bottom: 10px; }
.xp-key .key-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 18px; }
.xp-key .key-row { padding: 2px 6px; }
/* طباعة الامتحان */
.sh-add { flex: 2 1 260px; position: relative; display: flex; align-items: center; }
.sh-add > .i { position: absolute; inset-inline-start: 12px; width: 18px; height: 18px; color: var(--primary-ink); pointer-events: none; }
.sh-add .input { height: 38px; padding-inline-start: 38px; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.pick-cards.one { grid-template-columns: minmax(0, 1fr); max-height: none; overflow: visible; gap: 8px; }
.sh-foot { flex-direction: column; align-items: stretch; gap: 10px; }
.sh-foot .seg { width: 100%; }
.sh-foot .seg label { flex: 1; justify-content: center; padding: 0 6px; min-height: 34px; }
.sh-btns { display: flex; gap: 8px; }
/* تصحيح الامتحان */
.om-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px; margin-bottom: 12px; }
.drop.slim { flex: 1 1 420px; flex-direction: row; justify-content: flex-start; text-align: start; gap: 12px; padding: 12px 16px; }
.drop.slim > span { display: flex; flex-direction: column; gap: 2px; }
.om-legacy { flex: 0 1 auto; }
.om-legacy summary { cursor: pointer; padding: 6px 4px; }
.om-legacy[open] { flex-basis: 100%; }
.om-legacy-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.om-legacy-body .select { width: auto; flex: 0 1 220px; height: 38px; }
.om-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.om-err { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; color: var(--red); font-size: 12.5px; font-weight: 600; }
.tbl .name .mono.bad { background: var(--red-bg); color: var(--red); }
#om-results .table-wrap { overflow-y: auto; }
@media (max-width: 600px) { .f2 { grid-template-columns: minmax(0, 1fr); } .xp .tbl .name small { display: none; } .xp .tbl .name b { max-width: 40vw; } }
.xp .tbl td.one { max-width: 170px; }
.xp .tbl .name b { max-width: 190px; }
@media (max-width: 1600px) { .xp .tbl .name small { display: none; } .xp .tbl .grp { max-width: 130px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; } }
.xp.split > .editor { flex: 1 1 320px; max-width: 360px; }
.xp .tbl td.mono-num, .xp .tbl td.mono-num b { font-size: 13px; }
@media (max-width: 1600px) { .xl-only { display: none; } }
@media (max-width: 900px) { .xp.split > .editor { max-width: none; } }
@media (max-width: 600px) { .tbl .hide-sm { display: none; } }
@media (max-width: 600px) { .xp .tbl td, .xp .tbl th { padding-inline: 7px; } .xp .tbl .name b { max-width: 32vw; } .xp .tbl .acts { gap: 4px; } }

/* تصحيح الامتحان — review popup: one screen, scan | answers (columns of 25 like the paper) */
.modal.ov { width: min(1280px, 100%); height: min(860px, calc(100vh - 32px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ov-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ov-head .name { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.ov-head .name .mono { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; font-weight: 800; background: var(--primary-soft); color: var(--primary-ink); }
.ov-head .name .mono.bad { background: var(--red-bg); color: var(--red); }
.ov-head .name > span:not(.mono) { display: flex; flex-direction: column; min-width: 0; }
.ov-head .name b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-head .name small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-score { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ov-deg { font-size: 14px; color: var(--muted); padding-inline: 6px; }
.ov-deg b { font-size: 22px; color: var(--text); }
.ov-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.ov-scan { min-height: 0; min-width: 0; display: grid; place-items: center; padding: 12px; background: var(--surface-2); overflow: hidden; }
.ov-scan canvas { border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--sh-1); background: #fff; }
.ov-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-inline-start: 1px solid var(--line); overflow: auto; }
.ov-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.ov-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ov-legend i { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.ov-legend i.ok { background: var(--green); } .ov-legend i.bad { background: var(--red); } .ov-legend i.key { box-shadow: inset 0 0 0 2px #2563eb; }
.ov-legend .hint { font-size: 12px; }
.ov-grid { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 2px 14px; align-content: start; }
.ov-q { display: flex; align-items: center; gap: 3px; padding: 1px 4px; border-radius: 7px; }
.ov-q.bad { background: color-mix(in srgb, var(--red) 8%, transparent); }
.ov-q.blank { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.ov-q > b { width: 26px; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-2); }
.ov-c { width: 23px; height: 23px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 11.5px; font-weight: 700; line-height: 1; padding: 0; cursor: pointer; display: grid; place-items: center; }
.ov-c:hover { border-color: var(--primary); }
.ov-c.key { box-shadow: 0 0 0 2px #2563eb; border-color: transparent; }
.ov-c.ok { background: var(--green); border-color: var(--green); color: #fff; }
.ov-c.bad { background: var(--red); border-color: var(--red); color: #fff; }
.ov-fix { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-top: auto; }
.ov-fix summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 3px 0; }
.ov-fix-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px 0 4px; }
.ov-fix-body .input, .ov-fix-body .select { height: 36px; font-size: 13.5px; }
.ov-foot { display: flex; justify-content: flex-end; }
.ov-foot .btn { min-width: 120px; }
@media (max-width: 900px) {
  .modal.ov { height: 94vh; }
  .ov-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46% minmax(0, 1fr); }
  .ov-side { border-inline-start: 0; border-top: 1px solid var(--line); }
  .ov-grid { grid-auto-flow: row; grid-template-rows: none !important; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
.ov-grid { gap: 1px 12px; }
.ov-c { width: 21px; height: 21px; font-size: 11px; }
.ov-q > b { width: 24px; }
@media (max-width: 900px) {
  .modal-back > .modal.ov { width: 100vw !important; max-width: 100vw !important; }
  .ov-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}
@media (min-width: 901px) and (max-height: 780px) { .ov-c { width: 18px; height: 18px; font-size: 10px; } .ov-q > b { font-size: 11px; } .ov-side { gap: 6px; padding-block: 8px; } }

/* إعدادات النماذج: settings in one strip, the scan fills the rest of the page, magnifier lens */
.st-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; padding: 10px 14px; margin-bottom: 12px; }
.st-bar .grow { flex: 1; }
.st-fill { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; max-width: 320px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.st-fill input { width: 100%; accent-color: var(--primary); }
.st-off { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.st-off .input { width: 96px; height: 38px; }
.st-bar .btn { height: 38px; }
.st-prev { padding: 8px 12px 10px; }
.st-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; padding: 2px 2px 8px; }
.st-k { width: 13px; height: 13px; display: inline-block; }
.st-k.corner { background: rgba(37,99,235,.45); border-radius: 3px; }
.st-k.blank { border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(100,116,139,.8); }
.st-view { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); border-radius: 10px; }
.st-view canvas#st-canvas { border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: zoom-in; box-shadow: var(--sh-1); }
.st-lens { position: absolute; width: 300px; height: 300px; border-radius: 50%; overflow: hidden; border: 3px solid var(--surface); box-shadow: var(--sh-3), 0 0 0 1px var(--line-strong); pointer-events: none; z-index: 2; background: #fff; }
.st-lens canvas { display: block; }
@media (hover: none) { .st-info .ov-legend .hint { display: none; } }

/* إرسال الرسائل: students fitted to the window + side composer with a WhatsApp-like preview */
.btn.wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.wa:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn.wa:disabled { opacity: .5; }
.ms .chips { flex-wrap: nowrap; }
.ms .table-tools .select { flex: 1 1 130px; }
.ms .table-tools .search { flex: 2 1 180px; }
.ms .tbl tbody tr[data-pick] { cursor: pointer; }
.ms-act { text-align: end; }
.ms-act .btn .i { width: 15px; height: 15px; }
.ms-to { width: 100%; }
.ms-to label { flex: 1; justify-content: center; min-height: 34px; }
.ms-tpl, .ms-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ms-tpl .chip { height: 28px; padding: 0 10px; font-size: 12.5px; }
.ms-field { border: 1px dashed var(--line-strong); background: var(--surface-2); color: var(--primary-ink); border-radius: 7px; padding: 2px 7px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ms-field:hover { border-color: var(--primary); background: var(--primary-soft); }
.ms-fields .grow { flex: 1; }
.ms-compose textarea { height: auto; min-height: 92px; padding: 9px 12px; resize: vertical; line-height: 1.7; }
.ms-prev { border-radius: 12px; padding: 10px 12px 14px; background: #efeae2; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; }
.ms-prev-to { font-size: 12px; color: #54656f; margin-bottom: 8px; }
.ms-prev-to b { color: #111b21; }
.ms-bubble { position: relative; margin-inline-start: auto; width: fit-content; max-width: 92%; background: #d9fdd3; color: #111b21; padding: 8px 11px; border-radius: 10px 0 10px 10px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
:root[data-theme="dark"] .ms-prev { background-color: #0b141a; } :root[data-theme="dark"] .ms-bubble { background: #005c4b; color: #e9edef; } :root[data-theme="dark"] .ms-prev-to, :root[data-theme="dark"] .ms-prev-to b { color: #aebac1; }
.ms-foot { flex-wrap: wrap; }
.ms-foot #ms-next { flex: 1; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .ms-prev { background-color: #0b141a; } :root[data-theme="auto"] .ms-bubble { background: #005c4b; color: #e9edef; } :root[data-theme="auto"] .ms-prev-to, :root[data-theme="auto"] .ms-prev-to b { color: #aebac1; } }
.ms-foot { flex-wrap: nowrap; }
.ms-compose .card-body { gap: 8px; }
.ms-to label { min-height: 30px; }
@media (max-height: 760px) { .ms-compose textarea { min-height: 70px; } .ms-prev { padding: 8px 10px 10px; } .ms-bubble { font-size: 13px; } }
@media (max-width: 600px) { .ms .chips { flex-wrap: wrap; } .ms .chip { white-space: nowrap; } }
@media (max-width: 600px) { .ms-act .btn > span { display: none; } .ms-act .btn { padding: 0 9px; } .ms .tbl td, .ms .tbl th { padding-inline: 6px; } }

/* الشات — floating button + panel (bottom corner, every screen) */
.foot { padding-inline-end: 84px; }
.chat-fab { position: fixed; bottom: 18px; inset-inline-end: 20px; z-index: 40; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary) 60%, transparent), var(--sh-2); transition: transform .15s; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab .i { width: 24px; height: 24px; }
.chat-host.open .chat-fab { transform: scale(.92); }
.chat-badge { position: absolute; top: -3px; inset-inline-start: -3px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff;
  font-size: 11.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); font-variant-numeric: tabular-nums; }
.chat-fab.ring { animation: chat-ring .9s ease 2; }
@keyframes chat-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .chat-fab.ring { animation: none; } }
.chat-panel { position: fixed; bottom: 84px; inset-inline-end: 20px; z-index: 41; width: min(380px, calc(100vw - 24px)); height: min(580px, calc(100vh - 110px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-3); display: flex; flex-direction: column; overflow: hidden;
  animation: chat-in .18s ease; }
@keyframes chat-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 10px; background: var(--grad); color: #fff; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-title b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { font-size: 12px; opacity: .85; }
.chat-x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.chat-x:hover { background: rgba(255,255,255,.26); }
.chat-x .i { width: 18px; height: 18px; }
.chat-x[data-back] .i { transform: rotate(-90deg); }
.chat-head .chat-av { border: 2px solid rgba(255,255,255,.5); }
.chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.chat-search { display: flex; align-items: center; gap: 8px; margin: 10px; padding: 0 12px; height: 38px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.chat-search .i { width: 16px; height: 16px; color: var(--muted); }
.chat-search input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; outline: none; min-width: 0; }
.chat-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.chat-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.chat-row:hover { background: var(--surface); }
.chat-row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-row-t b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-t small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row.unread .chat-row-t small { color: var(--text); font-weight: 600; }
.chat-row-m { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.chat-row-m time { font-size: 11px; color: var(--muted); }
.chat-row.unread .chat-row-m time { color: var(--primary-ink); font-weight: 700; }
.chat-row-m .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; font-style: normal; display: grid; place-items: center; }
.chat-av { position: relative; width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: color-mix(in srgb, var(--hue, var(--primary)) 16%, var(--surface)); color: color-mix(in srgb, var(--hue, var(--primary)) 80%, var(--ink-mix)); }
.chat-head .chat-av { width: 38px; height: 38px; font-size: 15px; }
.chat-av.room { background: var(--primary-soft); color: var(--primary-ink); }
.chat-head .chat-av.room { background: rgba(255,255,255,.18); color: #fff; }
.chat-av.room .i { width: 20px; height: 20px; }
.chat-av .on { position: absolute; bottom: 0; inset-inline-end: 0; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--surface); }
.chat-empty { margin: auto; padding: 24px; text-align: center; color: var(--muted); font-size: 13.5px; }
.chat-empty.err { color: var(--red); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.chat-more { align-self: center; margin-bottom: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.chat-day { align-self: center; margin: 10px 0 6px; }
.chat-day span { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; padding: 3px 10px; border-radius: 99px; }
.chat-msg { display: flex; margin-top: 6px; }
.chat-msg.grouped { margin-top: 0; }
.chat-msg.me { justify-content: flex-end; }
.chat-bubble { max-width: 82%; padding: 7px 11px 5px; border-radius: 16px; font-size: 14px; line-height: 1.6; box-shadow: var(--sh-1); display: flex; flex-direction: column; }
.chat-msg.them .chat-bubble { background: var(--surface); color: var(--text); border-start-start-radius: 5px; }
.chat-msg.me .chat-bubble { background: var(--grad); color: #fff; border-start-end-radius: 5px; }
.chat-msg.grouped.them .chat-bubble { border-start-start-radius: 16px; }
.chat-msg.grouped.me .chat-bubble { border-start-end-radius: 16px; }
.chat-who { font-size: 12px; color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); margin-bottom: 1px; }
.chat-txt { white-space: pre-wrap; word-break: break-word; }
.chat-meta { align-self: flex-end; display: flex; align-items: center; gap: 4px; font-size: 10.5px; opacity: .75; margin-top: 1px; }
.chat-tick { font-style: normal; letter-spacing: -2px; }
.chat-tick.read { color: #a5f3fc; opacity: 1; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-compose textarea { flex: 1; resize: none; min-height: 40px; max-height: 110px; padding: 9px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; outline: none; }
.chat-compose textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.chat-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-send .i { width: 18px; height: 18px; transform: scaleX(-1); }
@media (max-width: 600px) {
  .chat-fab { bottom: 14px; inset-inline-end: 14px; width: 50px; height: 50px; }
  .chat-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
  .chat-host.open .chat-fab { display: none; }
}
.nav-gap { height: 10px; }

/* Merged screens: one menu item, its screens as tabs on top */
.nav-n { margin-inline-start: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-link.active .nav-n { background: var(--surface); color: var(--primary-ink); }
.page-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-1); overflow-x: auto; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.ptab { flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.ptab:hover { background: var(--surface-2); color: var(--text); }
.ptab.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; }
.gs-item.sub span { font-weight: 500; }

/* تصميم التقارير والشهادات */
.rd-help { display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; margin-bottom: 12px; }
.rd-help-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-ink); }
.rd-help ol { margin: 4px 0 4px; padding-inline-start: 20px; font-size: 13.5px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 0 26px; }
.rd-help small { color: var(--muted); font-size: 12.5px; }
.rd-help a { color: var(--primary-ink); font-weight: 600; }
.rd .tbl td { white-space: nowrap; }
.rd .tbl .name small { color: var(--muted); }
.rd-ic .i { width: 15px; height: 15px; }
.rd-ic.receipts { --hue: #16a34a; } .rd-ic.certificates { --hue: #ca8a04; } .rd-ic.barcodes { --hue: #2563eb; } .rd-ic.reports { --hue: #7c3aed; }
.rd-ic { background: color-mix(in srgb, var(--hue) 14%, var(--surface)) !important; color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)) !important; }
.rd-acts { justify-content: flex-end; }
.rd-acts .btn .i { width: 15px; height: 15px; }
@media (max-width: 900px) { .rd-acts .btn > span { display: none; } .rd-acts .btn { padding: 0 9px; } .rd-help ol { flex-direction: column; } }
@media (max-width: 600px) {
  .rd .tbl td { white-space: normal; padding-inline: 7px; }
  .rd .tbl .name small { display: none; }
  .rd-acts { flex-wrap: wrap; gap: 4px; max-width: 120px; }
  .rd-acts .btn { height: 32px; }
}
.rd-help > div { flex: 1; min-width: 0; }
.rd-tool { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rd-tool small { color: var(--muted); font-size: 12.5px; }

/* تليجرام */
.btn.tg { background: #229ed9; border-color: #229ed9; color: #fff; }
.btn.tg:hover { background: #1c8bc0; border-color: #1c8bc0; color: #fff; }
.btn.tg:disabled { opacity: .5; }
.ms-ch { width: 100%; }
.ms-ch label { flex: 1; justify-content: center; gap: 6px; min-height: 34px; }
.ms-ch .i { width: 16px; height: 16px; }
.ms-ch label:has(input[value="wa"]:checked) { color: #15803d; }
.ms-ch label:has(input[value="tg"]:checked) { color: #1c8bc0; }
.ms-tg-note { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, #229ed9 10%, var(--surface)); font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.ms-tg-note .i { width: 16px; height: 16px; color: #229ed9; flex: none; margin-top: 2px; }
.ms-tg-note a { color: #1c8bc0; font-weight: 700; }
.ms .tbl .badge .i { width: 13px; height: 13px; }
.ms-act { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.ms-link { width: min(440px, 100%); }
.ms-qr { display: grid; place-items: center; margin: 4px 0 12px; }
.ms-qr img { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.ms-linkbox { display: flex; gap: 8px; margin-bottom: 14px; }
.ms-linkbox .input { font-size: 12.5px; }
.tgs-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; margin-bottom: 12px; }
.tgs-state > div { display: flex; flex-direction: column; }
.tgs-state small { color: var(--muted); }
.tgs-state .grow { flex: 1; }
.tgs-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.tgs-state.on .tgs-ic { background: #229ed9; color: #fff; }
.tgs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.tgs-steps, .tgs-how ul { margin: 0 0 12px; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); line-height: 1.7; }
.tgs-how p { margin: 0 0 8px; color: var(--text-2); }
.tgs code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.tgs a { color: var(--primary-ink); }
.tgs-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.tgs-form .field { flex: 1 1 260px; }
@media (max-width: 900px) { .tgs-grid { grid-template-columns: minmax(0, 1fr); } }

/* الدروس أونلاين — staff screens */
.lp-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lp-row > span { display: flex; flex-direction: column; min-width: 0; }
.lp-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.lp-row small { color: var(--muted); font-size: 12px; }
.lp-row .bad, .lp-ytprev .bad { color: var(--red); font-weight: 700; }
.lp-thumb { width: 64px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-3); }
.lp-thumb.none { display: grid; place-items: center; color: var(--muted); }
.lp-thumb.none .i { width: 18px; height: 18px; }
.lp-stats { display: flex; gap: 4px; flex-wrap: wrap; }
.lp-stat { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
span.lp-stat { cursor: default; }
.lp-stat .i { width: 13px; height: 13px; }
.lp-stat.warn { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.lp-ytprev { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--green); font-weight: 600; min-height: 0; }
.lp-ytprev:empty { display: none; }
.lp-ytprev img { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; }
.lp-ytprev .i { width: 14px; height: 14px; }
.lp-groups { display: flex; flex-direction: column; gap: 14px; max-height: 360px; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.lp-stage-h { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.lp-stage-h small { color: var(--muted); }
.lp-glist { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 2px; padding-inline: 26px 0; }
.lp-g { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--surface); }
.lp-g:has(input:checked) { background: color-mix(in srgb, var(--hue) 15%, var(--surface)); border-color: color-mix(in srgb, var(--hue) 45%, transparent); color: color-mix(in srgb, var(--hue) 80%, var(--ink-mix)); }
.lp-g input, .lp-stage-h input { accent-color: var(--primary); width: 17px; height: 17px; }
.lp-toggles { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; }
.lp-files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.lp-file { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.lp-file a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-file small { color: var(--muted); }
.lp-file .i { width: 15px; height: 15px; flex: none; }
.lp-editor textarea { height: auto; min-height: 64px; padding: 8px 12px; }
.lp-modal { width: min(760px, 100%); }
.lp-thread { display: flex; flex-direction: column; gap: 12px; }
.lp-t { border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.lp-c { padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.lp-c.staff { background: var(--primary-soft); margin-inline-start: 24px; }
.lp-c.q:not(.staff) { background: var(--amber-bg); }
.lp-c.focus { box-shadow: 0 0 0 2px var(--primary); }
.lp-c-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.lp-c-h time { color: var(--muted); font-size: 11.5px; margin-inline-start: auto; }
.lp-c-h .badge { height: 20px; font-size: 11px; padding: 0 7px; }
.lp-c-h .btn-icon { width: 26px; height: 26px; }
.lp-c-b { white-space: pre-wrap; word-break: break-word; font-size: 14px; margin-top: 2px; }
.lp-reply { display: flex; gap: 6px; }
.lp-reply .input { height: 36px; font-size: 13.5px; }
.lv-done td { opacity: .65; }
.la-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; margin-bottom: 12px; }
.la-bar > div { display: flex; flex-direction: column; min-width: 0; flex: 1 1 300px; }
.la-bar small { color: var(--muted); font-size: 12.5px; }
.la-bar a { color: var(--primary-ink); }
.la-bar .grow { flex: 0; }
.la-bar > .seg { flex: none; flex-direction: row; }   /* الطلاب | أولياء الأمور */
.la-ph { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }   /* أولياء الأمور: one phone */
.la-pass { font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: 1px; background: var(--amber-bg); color: var(--amber); padding: 2px 8px; border-radius: 6px; }
.la .acts { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.la .table-tools .select { flex: 1 1 140px; width: auto; height: 38px; }
.lt .select { height: 36px; max-width: 280px; }

/* بوابة الطالب (portal.html) — phone first */
.portal-body { background: var(--bg); min-height: 100vh; }
.portal { max-width: 920px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.pt-login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 55%), var(--bg); }
.pt-login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--sh-3); padding: 28px 22px; text-align: center; }
.pt-login-card h1 { margin: 10px 0 4px; font-size: 22px; }
.pt-login-card p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.pt-login-card form { display: flex; flex-direction: column; gap: 12px; text-align: start; }
.pt-logo { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--sh-2); }
.pt-logo .i { width: 28px; height: 28px; }
.pt-logo.sm { width: 36px; height: 36px; border-radius: 11px; margin: 0; }
.pt-logo.sm .i { width: 20px; height: 20px; }
.pt-pass { position: relative; }
.pt-pass .btn-icon { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }
.pt-big { height: 46px; font-size: 15.5px; }
.pt-help { color: var(--muted); text-align: center; }
.pt-app { width: 100%; margin-top: 14px; }
.pt-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.pt-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pt-brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pt-brand b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-brand small { color: var(--muted); font-size: 12px; }
.pt-main { flex: 1; padding: 14px 14px 90px; }
.pt-tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgba(0,0,0,.25); }
.pt-tabs a { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.pt-tabs a .i { width: 22px; height: 22px; }
.pt-tabs a.on { color: var(--primary-ink); background: var(--primary-soft); }
.pt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pt-head h2 { margin: 0; font-size: 20px; }
.pt-head .search { width: min(260px, 100%); height: 38px; }
.pt-loading, .pt-empty { padding: 50px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pt-empty .i { width: 36px; height: 36px; opacity: .5; }
.pt-empty b { color: var(--text); font-size: 15px; }
.pt-empty.sm { padding: 18px 10px; font-size: 13px; }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pt-lesson { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--text); text-decoration: none; box-shadow: var(--sh-1); transition: transform .15s, box-shadow .15s; }
.pt-lesson:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.pt-cover { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); display: grid; place-items: center; }
.pt-cover img { width: 100%; height: 100%; object-fit: cover; }
.pt-playic { position: absolute; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.pt-playic .i { width: 24px; height: 24px; }
.pt-noimg .i { width: 40px; height: 40px; color: var(--muted); }
.pt-new { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 99px; }
.pt-lesson-t { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.pt-lesson-t b { font-size: 15px; line-height: 1.5; }
.pt-lesson-t small { color: var(--muted); font-size: 12.5px; }
.pt-meta { display: flex; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pt-meta span { display: inline-flex; align-items: center; gap: 3px; }
.pt-meta .i { width: 13px; height: 13px; }
.pt-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 700; text-decoration: none; margin-bottom: 10px; }
.pt-back .i { width: 18px; height: 18px; transform: rotate(-90deg); }
.pt-article { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--sh-1); padding-bottom: 14px; }
.pt-video { aspect-ratio: 16 / 9; background: #000; position: relative; overflow: hidden; }
.pt-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.pt-video:fullscreen, .pt-video:-webkit-full-screen { aspect-ratio: auto; }
.pt-wm { position: absolute; color: rgba(255, 255, 255, .55); font-size: 12px; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); pointer-events: none; user-select: none; transition: top 1s linear, left 1s linear; }
.pt-yt-top { position: absolute; top: 0; left: 0; right: 0; height: 54px; z-index: 1; }
.pt-yt-end { position: absolute; inset: 0; z-index: 1; background: #000; display: flex; align-items: center; justify-content: center; }
.pt-replay { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pt-replay:hover { background: rgba(255, 255, 255, .28); }
.pt-replay .i { width: 26px; height: 26px; }
.pt-fs { position: absolute; top: 8px; left: 8px; z-index: 2; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); border: 0; border-radius: 8px; color: #fff; cursor: pointer; }
.pt-fs:hover { background: rgba(0, 0, 0, .75); }
.pt-fs .i { width: 17px; height: 17px; }
.pt-article h1 { margin: 14px 16px 2px; font-size: 19px; line-height: 1.5; }
.pt-article h3 { margin: 16px 16px 8px; font-size: 15px; }
.pt-by { margin: 0 16px; color: var(--muted); font-size: 13px; }
.pt-body { margin: 12px 16px 0; white-space: pre-wrap; word-break: break-word; line-height: 1.8; font-size: 14.5px; }
.pt-body a, .pt-c-b a, .pt-notes a { color: var(--primary-ink); }
.pt-files { display: flex; flex-direction: column; gap: 6px; margin: 0 16px; }
.pt-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--surface-2); }
.pt-file > .i:first-child { width: 22px; height: 22px; color: var(--primary-ink); flex: none; }
.pt-file > .i:last-child { width: 18px; height: 18px; color: var(--muted); margin-inline-start: auto; flex: none; }
.pt-file span { display: flex; flex-direction: column; min-width: 0; }
.pt-file b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-file small { color: var(--muted); font-size: 12px; }
.pt-comments { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: var(--sh-1); }
.pt-ctabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; margin-bottom: 10px; }
.pt-ctabs button, .pt-ctabs a { flex: 1; height: 36px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; display: grid; place-items: center; text-decoration: none; }
.pt-ctabs button[aria-selected="true"], .pt-ctabs a[aria-selected="true"] { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-1); }
#pt-clist { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.pt-thread { display: flex; flex-direction: column; gap: 6px; }
.pt-c { padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.pt-c.mine { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.pt-c.staff { background: var(--primary-soft); margin-inline-start: 22px; }
.pt-c-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pt-c-h time { margin-inline-start: auto; color: var(--muted); font-size: 11px; }
.pt-c-h .badge { height: 20px; font-size: 11px; padding: 0 7px; }
.pt-c-b { white-space: pre-wrap; word-break: break-word; font-size: 14px; margin-top: 2px; line-height: 1.7; }
.pt-wait { color: var(--amber); font-weight: 700; padding-inline-start: 12px; }
.pt-cform { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.pt-cform textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; resize: vertical; }
.pt-cform .btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.pt-cform .btn .i { transform: scaleX(-1); }
.pt-live { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-1); }
.pt-live.now { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.pt-live.done { opacity: .7; }
.pt-live-d { width: 50px; flex: none; text-align: center; padding: 6px 0; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); display: flex; flex-direction: column; }
.pt-live-d b { font-size: 20px; line-height: 1.1; }
.pt-live-d small { font-size: 11.5px; font-weight: 700; }
.pt-live-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pt-live-t b { font-size: 15px; }
.pt-live-t small { color: var(--muted); font-size: 12.5px; }
.pt-left { color: var(--primary-ink); font-weight: 700; font-size: 13px; white-space: nowrap; }
.pt-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; display: inline-block; animation: pt-blink 1s infinite; }
@keyframes pt-blink { 50% { opacity: .3; } }
.pt-sub { margin: 18px 2px 10px; font-size: 15px; color: var(--muted); }
.pt-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 10px; }
.pt-card h3 { margin: 0; font-size: 16px; }
.pt-me { flex-direction: row; align-items: center; gap: 14px; }
.pt-me > div { display: flex; flex-direction: column; gap: 2px; }
.pt-me small { color: var(--muted); }
.pt-av { width: 54px; height: 54px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex: none; }
/* سجلّي: attendance + payments */
.pt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 4px; }
.pt-stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 2px; }
.pt-stats b { font-size: 20px; color: var(--primary-ink); }
.pt-stats small { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.pt-stats .ok b { color: var(--green); }
.pt-stats .bad b { color: var(--red); }
.pt-sub .badge { height: 22px; font-size: 12px; padding: 0 8px; vertical-align: middle; }
/* portal: pay with a Fawry reference number */
.pt-fawry { display: grid; gap: 6px; text-align: center; margin-bottom: 10px; border: 2px dashed var(--primary); }
.pt-fawry-ref { font-size: 30px; letter-spacing: 3px; color: var(--primary); font-variant-numeric: tabular-nums; }
.pt-rec { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-1); }
.pt-ok { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.pt-ok .i, .pt-no .i { width: 18px; height: 18px; }
.pt-no { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--red-bg); color: var(--red); }
.pt-rec.miss { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.pt-rec.miss .pt-live-d { background: var(--red-bg); color: var(--red); }
.pt-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.pt-amt b { font-size: 15px; }
.pt-amt small { font-size: 12px; font-weight: 700; }
.pt-amt .ok { color: var(--green); }
.pt-amt .bad { color: var(--red); }
/* بوابة ولي الأمر (js/parent.js): the children on top, a lesson's watched share */
.pr-kids { padding: 10px 14px 0; flex-wrap: nowrap; overflow-x: auto; }
.pr-kids .chip { white-space: nowrap; text-decoration: none; }
/* تطبيق نِظام (PWA): the first screen «أنا طالب / أنا ولي أمر» (js/start.js) and how to install it (js/install.js) */
.st-roles { display: flex; flex-direction: column; gap: 10px; text-align: start; }
.st-role { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: start; box-shadow: var(--sh-1); }
.st-role:hover, .st-role[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.st-role > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.st-role b { font-size: 16px; }
.st-role small { color: var(--muted); font-size: 12.5px; }
.st-role > .i { width: 18px; height: 18px; color: var(--muted); transform: rotate(90deg); }
.inst-btn[hidden] { display: none; }
.inst-btn.pt-big { width: 100%; }
.inst-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .45); }
.inst-card { width: min(380px, 100%); background: var(--surface); border-radius: 20px; padding: 22px 20px; box-shadow: var(--sh-3); text-align: center; display: flex; flex-direction: column; gap: 10px; }
.inst-card h3 { margin: 4px 0 0; }
.inst-card ol { text-align: start; margin: 0; padding-inline-start: 22px; line-height: 2; }
.inst-card small, .inst-card p { color: var(--muted); margin: 0; }
.inst-k { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: var(--surface-2); font-weight: 800; }
a.pt-rec { color: inherit; text-decoration: none; }
.pt-left.bad { color: var(--red); }
.pr-lesson .pt-live-t { flex: 1; min-width: 0; }
.pr-st { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.pr-bar { display: block; flex: 1 1 120px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; max-width: 220px; }
.pr-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); }
.pt-note { display: block; text-align: center; margin-top: 12px; }
@media (min-width: 760px) { .pt-main { padding-bottom: 100px; } .pt-tabs { inset-inline: auto; left: 50%; transform: translateX(-50%); bottom: 14px; border-radius: 18px; border: 1px solid var(--line); width: min(540px, calc(100% - 28px)); } }
.lp-stats { flex-wrap: nowrap; }
.lp .tbl td, .lv .tbl td { white-space: nowrap; }
.lp-row b { max-width: 230px; }
.lv .tbl td:first-child b { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.lp .tbl .grp, .lv .tbl .grp { max-width: 120px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.pt-pass .input { padding-right: 46px; }
.pt-pass .btn-icon { inset-inline-end: auto; right: 4px; }
@media (max-width: 1650px) { .tbl .lp-gcol { display: none; } }
.pt-pass .btn-icon { right: auto; left: 4px; }
.pt-pass .input { padding-right: 13px; padding-left: 46px; }

/* الدروس: compact form — groups as a drop-down, small YouTube preview next to the link */
.lp-gdd { position: relative; }
.lp-gdd > summary { list-style: none; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; cursor: pointer; }
.lp-gdd > summary::-webkit-details-marker { display: none; }
.lp-gdd > summary b { color: var(--primary-ink); }
.lp-gdd[open] > summary { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.lp-gdd .lp-groups { margin-top: 8px; max-height: 360px; }
.lp-ytrow { display: flex; align-items: center; gap: 8px; }
.lp-ytrow .input { flex: 1; min-width: 0; }
.lp-ytrow .lp-ytprev { flex: none; }
.lp-ytprev img { width: 68px; height: 38px; border-radius: 6px; object-fit: cover; display: block; }
.lp-ytprev .bad .i { width: 18px; height: 18px; color: var(--red); }
.lp-editor .card-body, .lv .editor .card-body { gap: 9px; }
.lp-editor .f2, .lv .editor .f2 { align-items: end; }
.lp-toggles { flex-wrap: nowrap; gap: 14px; font-size: 13px; }
.lp-editor textarea { min-height: 50px; }
@media (max-height: 780px) { .lp-editor .card-body, .lv .editor .card-body { gap: 6px; padding-block: 10px; } .lp-editor .field > span, .lv .editor .field > span { font-size: 12.5px; } }
@media (max-height: 780px) { .lp-editor .input, .lp-editor .select, .lv .editor .input, .lv .editor .select { height: 38px; } .lp-editor textarea { min-height: 40px; height: auto; } }
.lp-gdd-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f2:has(.lp-gdd[open]) { grid-template-columns: minmax(0, 1fr); }

/* بوابة الطالب — الامتحانات */
.portal.wide { max-width: 1240px; }
.pt-exam-c { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--text); text-decoration: none; box-shadow: var(--sh-1); }
.pt-exam-c.open, .pt-exam-c.doing { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.pt-exam-c.missed { opacity: .65; }
.pt-exam-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); flex: none; }
.pt-exam-c.result .pt-exam-ic { background: var(--green-bg); color: var(--green); }
.pt-exam-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pt-exam-t b { font-size: 15px; }
.pt-exam-t small { color: var(--muted); font-size: 12.5px; }
.pt-exam-s { font-size: 12.5px; font-weight: 700; color: var(--primary-ink); white-space: nowrap; }
.pt-exam-c.missed .pt-exam-s { color: var(--muted); }
.pt-score { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pt-score b { font-size: 18px; color: var(--text); }
.pt-einfo { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 13px; }
.pt-einfo span { display: inline-flex; align-items: center; gap: 4px; }
.pt-einfo .i { width: 15px; height: 15px; }
.pt-rules { margin: 0; padding-inline-start: 20px; color: var(--text-2); font-size: 13.5px; line-height: 1.9; }
.pt-start .pt-left { text-align: center; padding: 8px; }
.pt-done { text-align: center; align-items: center; padding: 30px 16px; }
.pt-done p { margin: 0; color: var(--muted); }
.pt-done-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.pt-done-ic .i { width: 30px; height: 30px; }
.pt-ebar { position: sticky; top: 61px; z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-2); }
.pt-ebar > b { flex: 1 1 140px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-timer { font: 800 20px ui-monospace, Consolas, monospace; direction: ltr; padding: 2px 10px; border-radius: 10px; background: var(--surface-2); }
.pt-timer.warn { background: var(--amber-bg); color: var(--amber); }
.pt-timer.bad { background: var(--red-bg); color: var(--red); animation: pt-blink 1s infinite; }
.pt-count { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.pt-save { font-size: 12px; color: var(--green); }
.pt-save.bad { color: var(--red); font-weight: 700; }
.pt-etabs { display: none; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; margin-bottom: 10px; }
.pt-etabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.pt-etabs button[aria-selected="true"] { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-1); }
.pt-exam { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.pt-pane { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: var(--sh-1); }
.pt-pane-answers { position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; }
.pt-paper { display: flex; flex-direction: column; gap: 6px; }
.pt-paper iframe { width: 100%; height: calc(100vh - 210px); min-height: 480px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pt-paper a { display: inline-flex; align-items: center; gap: 4px; color: var(--primary-ink); font-size: 13px; font-weight: 700; }
.pt-paper a .i { width: 15px; height: 15px; }
.pt-paper-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 8px; display: block; }
.pt-bubbles { display: flex; flex-direction: column; gap: 4px; }
.pt-bq { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 10px; }
.pt-bq:has([aria-pressed="true"]) { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.pt-bq > b { width: 28px; text-align: center; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pt-bq button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 800; cursor: pointer; }
.pt-bq button[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; }
.pt-result { text-align: center; align-items: center; }
.pt-big-score { display: flex; align-items: baseline; gap: 6px; }
.pt-big-score b { font-size: 48px; line-height: 1; }
.pt-big-score span { font-size: 18px; color: var(--muted); }
.pt-res-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; font-weight: 700; font-size: 14px; }
.pt-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 10px; }
.pt-kq { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 8px; }
.pt-kq.wrong { background: color-mix(in srgb, var(--red) 8%, transparent); }
.pt-kq.blank { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.pt-kq b { width: 24px; font-size: 12px; text-align: center; color: var(--text-2); }
.pt-kq i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11.5px; font-weight: 800; border: 1.5px solid var(--line-strong); color: var(--text-2); }
.pt-kq i.key { border-color: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 35%, transparent); }
.pt-kq i.mine { background: var(--red); border-color: var(--red); color: #fff; }
.pt-kq i.key.mine { background: var(--green); border-color: var(--green); }
@media (max-width: 900px) {
  .pt-etabs { display: flex; }
  .pt-exam { grid-template-columns: minmax(0, 1fr); }
  .pt-exam[data-show="paper"] .pt-pane-answers, .pt-exam[data-show="answers"] .pt-pane-paper { display: none; }
  .pt-pane-answers { position: static; max-height: none; }
  .pt-paper iframe { height: calc(100vh - 260px); min-height: 380px; }
  .pt-ebar { top: 57px; }
  .pt-tabs { display: flex; }
}
.oe-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.oe-sum .grow { flex: 1; }

.pt-pdf { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; min-height: 120px; }
.pt-pdf canvas { display: block; background: #fff; border-radius: 6px; box-shadow: var(--sh-1); }
.pt-pdf-wait { padding: 40px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.portal.taking .pt-tabs { display: none; }
.portal.taking .pt-main { padding-bottom: 20px; }
.pt-ebar .btn-icon .i { transform: rotate(-90deg); }
.pt-pane-paper { max-height: none; }
.oe .tbl td:nth-child(1), .oe .tbl td:nth-child(2) { white-space: normal; }
.oe .tbl td:nth-child(2) .mono-num { font-size: 12px; }

/* Data screens (employees, stages, groups, materials, notes, users…): compact rows, list fitted, the side form capped */
.split.fitpage .page-head, .fitpage + .page-head { margin-bottom: 10px; }
.g-when { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; }
.g-day { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-ink); }
.g-day.all { background: var(--surface-3); color: var(--text-2); }
.g-time { font-size: 12px; color: var(--muted); margin-inline-start: 4px; white-space: nowrap; }

/* الدعم والإعلانات (pages/support.js) */
.help-btn { position: relative; }
.help-cnt { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.help-cnt[hidden] { display: none; }
.ann-bar { display: flex; align-items: center; gap: 10px; background: var(--primary-soft); color: var(--primary-ink, var(--primary)); }
.ann-bar span { flex: 1; }
.ann-bar .btn-icon { color: inherit; width: 30px; height: 30px; }
.sp-news { display: grid; gap: 12px; max-width: 900px; }
.sp-ann { display: flex; gap: 14px; padding: 16px 18px; }
.sp-ann.unread { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.sp-ann-ic { font-size: 26px; line-height: 1; }
.sp-ann-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.sp-ann-head b { font-size: 16px; }
.sp-ann p { margin: 0 0 6px; color: var(--text-2); }
.sp-ann small { color: var(--muted); }
.sp-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.sp-list #sp-threads { max-height: calc(var(--vh, 100vh) - 260px); overflow: auto; }
.sp-thread { display: grid; gap: 4px; width: 100%; text-align: start; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: var(--text); cursor: pointer; }
.sp-thread:hover { background: var(--hover-row); }
.sp-thread.sel { background: var(--primary-soft); box-shadow: inset -3px 0 0 var(--primary); }
.sp-thread.unread b { color: var(--primary); }
.sp-t1, .sp-t2 { display: flex; align-items: center; gap: 8px; }
.sp-t2 small { color: var(--muted); }
.sp-chat { display: flex; flex-direction: column; min-height: 420px; }
.sp-msgs { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; max-height: calc(var(--vh, 100vh) - 380px); min-height: 160px; }
.sp-msg { display: flex; }
.sp-msg.them { justify-content: flex-end; }
.sp-bubble { max-width: 78%; padding: 10px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.sp-msg.them .sp-bubble { background: var(--primary-soft); border-color: transparent; }
.sp-bubble small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.sp-bubble p { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.sp-bubble img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 6px; }
.sp-closed { margin: 0 18px; padding: 8px 12px; border-radius: 10px; background: var(--gray-bg); color: var(--gray); font-size: 13.5px; }
.sp-send { display: grid; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.sp-send-row, .sp-new-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sp-send-row .grow { flex: 1; }
@media (max-width: 900px) { .sp-split { grid-template-columns: 1fr; } .sp-msgs { max-height: 60vh; } }

/* portal: notices (bell + list) */
.pt-top { position: sticky; }
.pt-top-acts { display: flex; align-items: center; gap: 4px; }
.pt-bell { position: relative; }
.pt-notes { position: absolute; top: calc(100% + 6px); inset-inline-end: 10px; width: min(380px, calc(100vw - 20px)); max-height: 70vh; overflow: auto; z-index: 30; box-shadow: var(--sh-3); padding: 4px 0; }
.pt-notes-head { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pt-note { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.pt-note:last-child { border-bottom: 0; }
.pt-note:hover { background: var(--hover-row); }
.pt-note.new { background: var(--primary-soft); }
.pt-note-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--primary); flex: none; }
.pt-note-ic .i { width: 18px; height: 18px; }
.pt-note > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-note > span:last-child > span { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.pt-note small { color: var(--muted); font-size: 12px; }

/* forum (portal + staff app): rooms, topics, chat, private messages */
.fo { display: flex; flex-direction: column; gap: 12px; }
.fo-sub { margin: 6px 0 0; font-size: 15px; color: var(--muted); font-weight: 700; }
.fo-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.fo-room { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: start; cursor: pointer; border: 1px solid var(--line); font: inherit; color: var(--text); position: relative; }
.fo-room:hover { border-color: var(--primary); }
.fo-room small { display: block; color: var(--muted); font-size: 12.5px; }
.fo-room-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.fo-unread { position: absolute; inset-inline-end: 12px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--red, #e11d48); color: #fff; font-size: 12px; display: grid; place-items: center; padding: 0 6px; }
.fo-head { display: flex; align-items: center; gap: 8px; }
.fo-head h3 { margin: 0; font-size: 18px; }
.fo-head .btn-icon .i { transform: rotate(90deg); }   /* back = right, in RTL */
.fo-tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.fo-tabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.fo-tabs button[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }
.fo-new { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.fo-new .btn { align-self: flex-start; }
.fo-topic { display: block; width: 100%; text-align: start; padding: 12px 14px; border: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--text); }
.fo-topic:hover { border-color: var(--primary); }
.fo-topic small { display: block; color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.fo-post { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.fo-post h4 { margin: 0; font-size: 17px; }
.fo-post.best { border: 2px solid #10b981; }
.fo-main { border-inline-start: 4px solid var(--primary); }
.fo-msg-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.fo-msg-h small { color: var(--muted); }
.fo-staff { color: var(--primary); }
.fo-acts { margin-inline-start: auto; display: inline-flex; gap: 4px; }
.fo-act { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px; color: var(--muted); border-radius: 6px; }
.fo-act:hover { background: var(--surface-2); color: var(--text); }
.fo-act .i { width: 15px; height: 15px; }
.fo-chat { display: flex; flex-direction: column; height: min(62vh, 560px); padding: 0; overflow: hidden; }
.fo-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.fo-msg { max-width: 82%; align-self: flex-start; background: var(--surface-2); border-radius: 14px; padding: 8px 12px; overflow-wrap: anywhere; }
.fo-msg.mine { align-self: flex-end; background: var(--primary-soft); }
.fo-msg.staff:not(.mine) { border: 1px solid var(--primary); }
.fo-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.fo-send .input { flex: 1; }
.empty.sm { padding: 18px; font-size: 14px; }
/* forum attachments */
.fo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fo-row .btn.primary { margin-inline-start: auto; }
.fo-attach { cursor: pointer; flex: none; }
.fo-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.fo-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.fo-chip .i { width: 14px; height: 14px; }
.fo-send .fo-chip { position: absolute; bottom: 100%; inset-inline-start: 10px; margin-bottom: 6px; }
.fo-send { position: relative; align-items: center; }
.fo-img { display: block; max-width: min(100%, 320px); max-height: 260px; border-radius: 10px; margin-top: 6px; border: 1px solid var(--line); }
.fo-file { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; max-width: 100%; }
.fo-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-file small { color: var(--muted); flex: none; }
.fo-file:hover { border-color: var(--primary); }
.fo-file .i { width: 16px; height: 16px; color: var(--primary); flex: none; }

/* Question bank (pages/question-bank.js) and bank exams (online-exams.js, portal.js) */
.seg button { min-height: 36px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-1); }
.seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.qb #qb-list { display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.qb-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.qb-row.sel { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.qb-q { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qb-body { font-weight: 600; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qb-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12.5px; color: var(--muted); }
.qb-meta .i { width: 14px; height: 14px; vertical-align: -2px; }
.qb-ans { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.qb-ans .ok { color: var(--green); font-weight: 700; }
.qf-ch { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qf-ch input[type=radio] { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.qf-ch b { width: 18px; text-align: center; flex: none; }
.qb-img { position: relative; width: fit-content; max-width: 100%; }
.qb-img img { max-width: 100%; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.qb-img .btn-icon { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--surface); }
.qb-imp .mbody { display: flex; flex-direction: column; gap: 12px; }
.qb-prev { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.qb-sq { line-height: 1.7; }
.qb-errs { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; color: var(--red); max-height: 160px; overflow: auto; }
.qb-imps summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.qb-impr { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.qb-impr span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-lv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.oe-lv label small { color: var(--muted); font-weight: 400; }
.oe-pick { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.oe-pick label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.oe-pick label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.oe-pick input { margin-top: 5px; width: 17px; height: 17px; flex: none; accent-color: var(--primary); }
.oe-an { display: flex; flex-direction: column; gap: 8px; }
.oe-an-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.oe-an-row .bar { flex: none; width: 90px; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.oe-an-row .bar i { display: block; height: 100%; background: var(--green); }
.oe-an-row.low .bar i { background: var(--red); }
.pt-qs { display: flex; flex-direction: column; gap: 12px; }
.pt-qc { display: block; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.pt-bq.pt-qc:has([aria-pressed="true"]) { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.pt-qh { display: flex; gap: 10px; align-items: flex-start; }
.pt-qn { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); font-size: 13px; }
.pt-qb { flex: 1; min-width: 0; font-weight: 600; line-height: 1.8; }
.pt-qimg { display: block; max-width: 100%; max-height: 320px; margin: 10px auto 0; border-radius: 10px; border: 1px solid var(--line); }
.pt-qch { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; }
.pt-qch.tf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pt-qc .pt-qch button, .pt-qch > div { display: flex; align-items: center; gap: 10px; width: auto; height: auto; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; text-align: start; cursor: pointer; }
.pt-qch i { flex: none; font-style: normal; font-weight: 800; color: var(--muted); }
.pt-qch i:empty { display: none; }
.pt-qch span { flex: 1; min-width: 0; line-height: 1.6; }
.pt-qc .pt-qch button[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; }
.pt-qc .pt-qch button[aria-pressed="true"] i { color: #fff; }
.pt-qch > div { cursor: default; }
.pt-qch > div.key { border-color: var(--green); background: var(--green-bg); }
.pt-qch > div.mine { border-color: var(--red); background: var(--red-bg); }
.pt-qch em { flex: none; font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.pt-qch > div.key em { color: var(--green); }
.pt-qch > div.mine em { color: var(--red); }
.pt-qc.rev.right { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.pt-qc.rev.wrong { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.pt-qc.rev.blank { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.pt-qnote { margin-top: 8px; font-size: 13px; color: var(--muted); }
.pt-qex { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); line-height: 1.8; font-size: 14px; }
.pt-taking { padding-bottom: 20px; }
.pt-mk .pt-exam-ic { background: var(--amber-bg); color: var(--amber); }
.pt-mkbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pt-hist { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.pt-hist span { flex: 1; }
.pt-hist small { color: var(--muted); }
.pt-rf { margin-bottom: 10px; }
.oe-b { display: flex; flex-direction: column; gap: 10px; }
.oe-b[hidden], .oe-random[hidden], .oe-pickf[hidden] { display: none; }
.oe-random { display: flex; flex-direction: column; gap: 10px; }

/* Resizable side form (ui.js resizableSplit): a bar between the list and the form, drag it or use its button */
.split-grip { display: none; }
@media (min-width: 1181px) {
  .split-grip { display: flex; justify-content: center; align-items: flex-start; align-self: stretch; flex: 0 0 10px; margin-inline: -14px; position: relative; z-index: 3; cursor: col-resize; touch-action: none; }
  .split-grip::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 4px; width: 2px; border-radius: 2px; background: transparent; transition: background .15s; }
  .split-grip:hover::before, .split.dragging .split-grip::before { background: var(--primary); }
  .split-grip:has(+ .editor[hidden]) { display: none; }
  .split-wide { position: sticky; top: calc(var(--top-h) + 40px); margin-top: 34px; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-1); }
  .split-wide:hover { color: var(--primary); border-color: var(--primary); }
  .split-wide .i { width: 14px; height: 14px; }
  .split.sized > .list { flex-basis: 0; }
  .split.sized > .editor, .xp.split.sized > .editor { flex: 0 0 var(--ed-w); max-width: none; }
  .split.dragging { user-select: none; cursor: col-resize; }
  /* wide: the fields side by side; long ones keep the whole row */
  .split.wide-form > .editor .card-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-content: start; gap: 10px 16px; }
  .split.wide-form > .editor .card-body > :is(.alert, .hint, .f2, .grid-2, .oe-b, .oe-p, details, .qf-m, .qf-t, .row, .lp-toggles, .seg, .field:has(textarea), .field:has(.chips), .field:has(.lp-gdd), .field:has(.days), .field:has(.lp-files), .field:has(.seg), .field:has(.qb-img), .field:has(.qf-ch)) { grid-column: 1 / -1; }
}
