/* ════════════════════════════════════════════════════════════
   رستگار نت
   ظاهر: سبز سرمه‌ای عمیق + زرد زعفرانی. فونت: وزیرمتن (داخل پروژه)
   ════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0f211b;
  --ink-2: #4b5f57;
  --paper: #f1f5f3;
  --card: #ffffff;
  --line: #d8e2dd;
  --deep: #0a2a24;
  --deep-2: #0f3a32;
  --brand: #0c6a58;
  --brand-ink: #08463a;
  --brand-soft: #dcf0e8;
  --gold: #e8a510;
  --gold-ink: #2b1d00;
  --gold-soft: #fcefca;
  --danger: #c4372f;
  --danger-soft: #fbe3e0;
  --ok: #178a58;
  --ok-soft: #d9f2e5;
  --warn-soft: #fff1cf;
  --radius: 12px;
  --font: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  --focus: 0 0 0 3px rgba(232, 165, 16, .55);
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.4; font-weight: 800; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.grow { flex: 1; }

/* ───────── آیکن ───────── */
.i {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.i.xl { width: 2.6rem; height: 2.6rem; stroke-width: 1.6; }

/* ───────── برند ───────── */
.brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink);
  font-weight: 900; font-size: 1.6rem; line-height: 1;
}
.brand-name { font-weight: 800; font-size: 1.3rem; color: #fff; }
.brand-sub { color: rgba(255, 255, 255, .6); font-size: .9rem; padding-inline-start: 12px; border-inline-start: 1px solid rgba(255, 255, 255, .25); }
.brand.dark .brand-name { color: var(--ink); }
.brand.compact .logo-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 1.2rem; }
.brand.compact .brand-name { font-size: 1.05rem; }

/* ───────── دکمه‌ها ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f4f8f6; border-color: #bfd0c8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #a82b24; border-color: #a82b24; }
.btn.danger-outline { color: var(--danger); border-color: #e7b5b1; }
.btn.danger-outline:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(15, 33, 27, .06); }
.btn.on-dark { color: #fff; }
.btn.on-dark:hover { background: rgba(255, 255, 255, .12); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .88rem; border-radius: 8px; }
.btn.lg { min-height: 50px; font-size: 1.05rem; border-radius: 12px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer; color: inherit;
}
.icon-btn:hover { background: rgba(15, 33, 27, .08); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; color: var(--ink-2); }
.icon-btn.sm:hover { background: var(--paper); color: var(--ink); }
.icon-btn.sm.warn:hover { background: var(--warn-soft); color: #8a5a00; }
.icon-btn.sm.ok:hover { background: var(--ok-soft); color: var(--ok); }
.icon-btn.sm.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ───────── فیلدها ───────── */
.field { display: grid; gap: 6px; }
.field > span { font-size: .88rem; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="date"], textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  background: #fff; border: 1px solid #c6d4cd; border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.8; }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12, 106, 88, .18); }
.ltr-input { direction: ltr; text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.pw { display: flex; gap: 6px; align-items: center; }
.pw input { flex: 1; }
.pw-toggle { color: var(--ink-2); }

.form-error { color: var(--danger); font-weight: 600; font-size: .92rem; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.alert.warn { background: var(--warn-soft); color: #6d4a00; }
.alert.info { background: var(--brand-soft); color: var(--brand-ink); }

.chip {
  display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, .14); color: inherit; font-size: .8rem; font-weight: 600;
}
.chip.sm { padding: 0 8px; font-size: .72rem; margin-inline-start: 6px; background: var(--gold-soft); color: #7a5600; }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.teacher { background: var(--gold); color: var(--gold-ink); }
.room-tag { background: var(--brand-soft); color: var(--brand-ink); padding: 2px 12px; border-radius: 8px; font-weight: 700; font-size: .9rem; }
.count-tag { color: var(--ink-2); font-weight: 600; font-size: .85rem; margin-inline-start: 6px; }
.count-tag:empty { display: none; }

/* ───────── اعلان کوچک (Toast) ───────── */
.toasts { position: fixed; inset-block-end: 90px; inset-inline: 0; display: grid; gap: 8px; justify-items: center; pointer-events: none; z-index: 100; padding: 0 12px; }
.toast {
  background: #14231e; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .92rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28); max-width: min(92vw, 460px);
  animation: toast-in .2s ease-out;
}
.toast.ok { background: #0f5a43; }
.toast.warn { background: #7a4a00; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────── پنجرهٔ گفتگو ───────── */
.dlg { border: 0; border-radius: 16px; padding: 0; width: min(92vw, 420px); background: #fff; color: var(--ink); box-shadow: 0 24px 80px rgba(0, 0, 0, .4); }
.dlg::backdrop { background: rgba(5, 20, 16, .6); }
.dlg form { padding: 22px; display: grid; gap: 14px; }
.dlg h3 { font-size: 1.15rem; }
#dlg-fields { display: grid; gap: 12px; }
#dlg-fields:empty { display: none; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 4px; }

/* ═══════════════════════ صفحهٔ ورود دانش‌آموز ═══════════════════════ */
.page-landing, .page-admin-login {
  background-color: var(--deep);
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  color: #fff;
  min-height: 100dvh;
}

.landing {
  max-width: 1200px; margin: 0 auto; min-height: 100dvh;
  padding: 40px clamp(18px, 4vw, 56px);
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: clamp(28px, 5vw, 72px); align-items: center;
}
.landing-main { display: grid; gap: 18px; }
.landing-title { font-size: clamp(1.7rem, 3.4vw, 2.7rem); font-weight: 900; line-height: 1.35; color: #fff; max-width: 18ch; }
.landing-lead { color: rgba(255, 255, 255, .72); max-width: 46ch; font-size: 1.02rem; }

.building {
  margin-top: 10px; width: min(100%, 540px);
  border: 2px solid rgba(255, 255, 255, .3); border-bottom: 0;
  border-radius: 16px 16px 0 0; overflow: hidden;
  background: rgba(255, 255, 255, .035);
}
.roof { height: 12px; background: var(--gold); }
.floor {
  display: grid; grid-template-columns: 76px 1fr; align-items: end; gap: 14px;
  padding: 16px 16px 0; border-top: 1px solid rgba(255, 255, 255, .18);
}
.roof + .floor { border-top: 0; }
.floor-label { align-self: center; padding-bottom: 16px; color: rgba(255, 255, 255, .62); font-size: .88rem; font-weight: 600; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.door {
  position: relative; height: 64px; padding: 0;
  border: 1.5px solid rgba(255, 255, 255, .4); border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: rgba(255, 255, 255, .07); color: #fff;
  font-size: 1.3rem; font-weight: 800; letter-spacing: .03em; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.door::after {
  content: ""; position: absolute; inset-inline-end: 12px; top: 54%;
  width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55;
}
.door:hover { background: rgba(255, 255, 255, .17); }
.door.is-selected { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.door:focus-visible { box-shadow: var(--focus); }

.landing-side { display: grid; gap: 16px; justify-items: stretch; }
.login-card {
  background: #fff; color: var(--ink); border-radius: 20px; padding: 28px;
  display: grid; gap: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
.login-card h2 { font-size: 1.4rem; }
.login-card.narrow { width: min(100%, 410px); }
.admin-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  color: rgba(255, 255, 255, .75); text-decoration: none; font-size: .92rem; padding: 8px;
}
.admin-link:hover { color: var(--gold); }
.back-link { text-align: center; color: var(--ink-2); font-size: .9rem; }

.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }

/* ═══════════════════════ پنل مدیریت ═══════════════════════ */
.admin-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px clamp(14px, 3vw, 32px);
  background: var(--deep); color: #fff;
}
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; color: rgba(255, 255, 255, .72);
  padding: 8px 16px; border-radius: 10px; font-weight: 700; cursor: pointer;
  border-bottom: 3px solid transparent; border-radius: 10px 10px 0 0;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.tab.is-active { color: #fff; border-bottom-color: var(--gold); background: rgba(255, 255, 255, .06); }
.admin-bar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: rgba(255, 255, 255, .7); }
.conn i { width: 9px; height: 9px; border-radius: 50%; background: #8a9a93; }
.conn.ok i { background: #3ddc97; box-shadow: 0 0 0 3px rgba(61, 220, 151, .22); }
.conn.bad i { background: #ff6b60; }

.admin-main { max-width: 1240px; margin: 0 auto; padding: 28px clamp(14px, 3vw, 32px) 60px; }
.pane-head { margin-bottom: 20px; display: grid; gap: 4px; }
.pane-head h1 { font-size: 1.6rem; }

.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.room-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; display: grid; gap: 14px; align-content: start;
}
.room-card.is-live { border-color: #9fd3c1; box-shadow: inset 0 3px 0 var(--brand); }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rc-num { font-size: 2rem; font-weight: 900; line-height: 1; letter-spacing: .02em; }
.rc-status { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(23, 138, 88, .18); }
.rc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--paper); border-radius: 10px; padding: 8px 10px; display: grid; }
.stat b { font-size: 1.35rem; line-height: 1.3; }
.stat span { font-size: .78rem; color: var(--ink-2); }
.rc-switches { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: .92rem; }
.switch {
  position: relative; flex: none; width: 42px; height: 24px; padding: 0;
  border: 0; border-radius: 99px; background: #b9c7c0; cursor: pointer;
  transition: background .18s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: inset-inline-start .18s;
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { inset-inline-start: 21px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pill b { font-size: 1.05rem; }
.pill small { color: var(--ink-2); font-size: .75rem; }
.pill:hover { border-color: #a9c0b6; }
.pill.is-active { background: var(--deep); border-color: var(--deep); color: #fff; }
.pill.is-active small { color: rgba(255, 255, 255, .7); }
.pill.is-live { box-shadow: inset 0 -3px 0 var(--ok); }

.two-col { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
#tab-attendance .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.card h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.date-input { width: auto; min-height: 38px; }
.stack { display: grid; gap: 14px; }

.bulk { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.bulk summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.bulk[open] > * + * { margin-top: 10px; }

.users-table { display: grid; }
.urow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; }
.uname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uacts { display: flex; gap: 2px; }
.status { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.st-present { background: var(--ok-soft); color: #0d6b41; }
.st-absent { background: #e9eeeb; color: var(--ink-2); }
.st-banned { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--ink-2); font-size: .92rem; padding: 10px 0; }

.created { border-color: #e2c26a; background: #fffaf0; margin-top: 18px; }
.created-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.created-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.created-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.created-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border: 1px solid #ecd9a4; border-radius: 10px; padding: 8px 12px; }
.ci-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-pass { font-size: 1.02rem; font-weight: 700; letter-spacing: .06em; background: var(--gold-soft); padding: 1px 8px; border-radius: 6px; }

.list-block { display: grid; gap: 2px; }
.list-block + .list-block { margin-top: 14px; }
.list-block h4 { font-size: .95rem; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.list-block.present h4 { border-bottom-color: var(--ok); }
.list-block.absent h4 { border-bottom-color: #b9c7c0; }
.att-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.att-meta { color: var(--ink-2); font-size: .82rem; }
.teachers-line { display: flex; align-items: center; gap: 8px; color: var(--brand-ink); background: var(--brand-soft); padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .9rem; }

/* ═══════════════════════ صفحهٔ کلاس ═══════════════════════ */
.page-class {
  --c-bg: #091512; --c-panel: #101f1b; --c-panel-2: #172a25; --c-line: #233832;
  --c-text: #e8f1ed; --c-muted: #8ea69c;
  background: var(--c-bg); color: var(--c-text); height: 100dvh; overflow: hidden;
}
.page-class .muted { color: var(--c-muted); }
.page-class .btn { background: var(--c-panel-2); border-color: var(--c-line); color: var(--c-text); }
.page-class .btn:hover { background: #1f3831; }
.page-class .btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.page-class .btn.primary:hover { background: #f2b628; }
.page-class .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.page-class .btn.ghost { background: transparent; border-color: transparent; }
.page-class .btn.danger-outline { color: #ff9a92; border-color: #5a2b28; background: transparent; }
.page-class .field > span { color: var(--c-muted); }
.page-class input[type="text"] { background: #0c1a16; border-color: var(--c-line); color: var(--c-text); }
.page-class .dlg { background: #fff; color: var(--ink); }
.page-class .dlg .btn { background: #fff; border-color: var(--line); color: var(--ink); }
.page-class .dlg .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-class .dlg .btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.page-class .dlg .btn.ghost { background: transparent; border-color: transparent; }
.page-class .dlg .field > span, .page-class .dlg .muted { color: var(--ink-2); }
.page-class .dlg input[type="text"] { background: #fff; border-color: #c6d4cd; color: var(--ink); }
.page-class .brand-name { color: #fff; }

/* پیش از ورود */
.prejoin { height: 100dvh; display: flex; padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.prejoin[hidden] { display: none; }
.prejoin-card { margin: auto; width: min(100%, 460px); background: var(--c-panel); border: 1px solid var(--c-line); border-radius: 20px; padding: 22px; display: grid; gap: 16px; }
.preview { position: relative; aspect-ratio: 16/10; max-height: 34dvh; width: 100%; border-radius: 14px; overflow: hidden; background: #050d0b; border: 1px solid var(--c-line); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--c-muted); }
.preview video:not([hidden]) + .preview-off { display: none; }
.pre-toggles { display: flex; gap: 10px; justify-content: center; }
.pre-toggles .ctl { flex: 1; flex-direction: row; justify-content: center; height: 46px; border-radius: 12px; font-size: .92rem; }
.prejoin-who { text-align: center; color: var(--c-muted); }
.prejoin-who b { color: var(--c-text); }
.note { background: #2a2210; color: #ffd98a; border-radius: 10px; padding: 8px 12px; font-size: .86rem; }

/* چیدمان اصلی */
.app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--c-line); background: var(--c-panel); }
.topbar .conn { color: var(--c-muted); }
.page-class .room-tag { background: #1c3a31; color: #bfe9d8; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
body.side-open .layout { grid-template-columns: minmax(0, 1fr) 360px; }
.stage { position: relative; min-height: 0; min-width: 0; overflow: auto; }

/* شبکهٔ تصویرها */
.grid {
  display: grid; gap: 10px; padding: 12px; min-height: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  align-content: center;
}
.grid[data-n="0"], .grid[data-n="1"] { grid-template-columns: minmax(0, 880px); justify-content: center; }
.grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  position: relative; aspect-ratio: 16 / 9; min-width: 0; overflow: hidden;
  background: #0d1a16; border: 1px solid var(--c-line); border-radius: 14px;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.local:not(.is-screen) video { transform: scaleX(-1); }
.tile.is-screen video, .tile.presenting video { object-fit: contain; }
.tile.no-video video { visibility: hidden; }
.tile .avatar { position: absolute; inset: 0; display: none; place-items: center; }
.tile.no-video .avatar { display: grid; }
.avatar span {
  width: clamp(54px, 26%, 92px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; background: #1d3b32; color: #bfe9d8;
  font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800;
}
.tile.is-teacher { border-color: #7a5d12; }
.tile.is-teacher .avatar span { background: #4a3908; color: #ffd36b; }
.tile .label {
  position: absolute; inset-inline: 8px; inset-block-end: 8px;
  display: flex; align-items: center; gap: 6px; pointer-events: none;
}
.tname { background: rgba(5, 14, 11, .72); padding: 2px 10px; border-radius: 8px; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mic-flag, .share-flag { display: none; width: 26px; height: 26px; border-radius: 50%; place-items: center; background: rgba(196, 55, 47, .92); }
.share-flag { background: rgba(232, 165, 16, .95); color: var(--gold-ink); }
.mic-flag .i, .share-flag .i { width: 15px; height: 15px; }
.tile.is-muted .mic-flag { display: grid; }
.tile.is-sharing .share-flag { display: grid; }

.grid.has-presenter .tile.presenting { grid-column: 1 / -1; order: -1 !important; max-height: 66dvh; width: 100%; justify-self: center; }
.grid.has-presenter { align-content: start; }

.share-banner {
  position: absolute; inset-block-start: 12px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px;
  background: var(--gold); color: var(--gold-ink); border-radius: 12px; font-weight: 700; font-size: .9rem; z-index: 5;
}
.share-banner .btn.danger { min-height: 30px; }

/* پنل کناری */
.side { display: none; flex-direction: column; min-height: 0; background: var(--c-panel); border-inline-start: 1px solid var(--c-line); }
body.side-open .side { display: flex; }
.side-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--c-line); overflow-x: auto; scrollbar-width: none; }
.stab {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--c-muted);
  padding: 9px 10px; font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.stab:hover { color: var(--c-text); }
.stab.is-active { color: #fff; border-bottom-color: var(--gold); }
.badge, .dock-badge { background: var(--danger); color: #fff; font-size: .7rem; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 5px; }
.side-close { display: none; margin-inline-start: auto; color: var(--c-text); }
.stab .count-tag { color: var(--c-muted); margin: 0; }

.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 10px 12px; gap: 6px; }
#pane-chat { padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; align-self: flex-start; background: var(--c-panel-2); border-radius: 4px 14px 14px 14px; padding: 7px 12px; }
.msg.mine { align-self: flex-end; background: #14473a; border-radius: 14px 4px 14px 14px; }
.msg.teacher { box-shadow: inset 3px 0 0 var(--gold); }
.msg-meta { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--c-muted); }
.msg-meta b { color: var(--c-text); font-weight: 700; }
.msg-meta time { margin-inline-start: auto; padding-inline-start: 10px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--c-line); }
.chat-form input { flex: 1; border-radius: 12px; }
.send { background: var(--gold); color: var(--gold-ink); border-radius: 12px; }
.send:hover { background: #f2b628; }
.send .i { transform: scaleX(-1); }
.chat-off { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 14px; color: var(--c-muted); border-top: 1px solid var(--c-line); }

.list-head { padding: 8px 0 2px; }
.list-head h4 { font-size: .9rem; color: var(--c-muted); font-weight: 700; }
.list-head + .people-list { margin-bottom: 8px; }
.people-list { display: grid; gap: 4px; }
.prow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--c-panel-2); border-radius: 10px; min-height: 40px; }
.prow.absent { background: transparent; border: 1px dashed var(--c-line); color: var(--c-muted); }
.prow.is-teacher { box-shadow: inset 3px 0 0 var(--gold); }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.pstat { display: inline-flex; gap: 4px; color: var(--c-muted); }
.pstat .ok { color: #46d39a; }
.pstat .off { color: #6d807a; }
.pstat .i { width: 15px; height: 15px; }
.pacts { display: inline-flex; gap: 3px; margin-inline-start: 4px; }
.tog { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; cursor: pointer; background: #0c1a16; }
.tog .i { width: 15px; height: 15px; }
.tog.is-on { color: #46d39a; background: #123428; }
.tog.is-off { color: #ff8e86; background: #3a1d1b; }
.tog:hover { filter: brightness(1.25); }
.tog.kick { color: #ff8e86; background: transparent; }
.tog.kick:hover { background: #3a1d1b; }
.page-class .empty { color: var(--c-muted); }
.page-class .switch { background: #3b4d47; }
.page-class .switch[aria-checked="true"] { background: #1fa56c; }
.switches { display: grid; gap: 2px; margin: 4px 0 8px; }
.ctl-actions { display: grid; gap: 8px; margin: 8px 0; }

/* نوار پایین */
.dock { display: flex; justify-content: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--c-panel); border-top: 1px solid var(--c-line); }
.ctl {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 76px; height: 56px; padding: 0 10px; border: 1px solid var(--c-line); border-radius: 14px;
  background: var(--c-panel-2); color: var(--c-text); font-size: .74rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ctl .i { width: 21px; height: 21px; }
.ctl:hover { background: #20372f; }
.ctl.on { background: #123b2d; border-color: #1f6b50; color: #9df0c8; }
.ctl.off { background: #3d1f1d; border-color: #7a3a36; color: #ffaaa3; }
.ctl.active { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.ctl.locked { opacity: .5; border-style: dashed; }
.ctl:disabled { opacity: .4; cursor: not-allowed; }
.ctl.leave { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctl.leave:hover { background: #a82b24; }
.dock-badge { position: absolute; inset-block-start: -5px; inset-inline-end: -5px; }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(4, 12, 10, .92); display: grid; place-items: center; padding: 20px; }
.overlay-card { background: var(--c-panel); border: 1px solid var(--c-line); border-radius: 20px; padding: 28px; width: min(100%, 420px); display: grid; gap: 14px; text-align: center; }
.overlay-card .btn { justify-self: center; }

/* ═══════════════════════ واکنش‌گرا ═══════════════════════ */
@media (max-width: 980px) {
  .landing { grid-template-columns: 1fr; padding-top: 28px; }
  .landing-title { max-width: none; }
  .two-col, #tab-attendance .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  body.side-open .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0; z-index: 30; border: 0; }
  .side-close { display: inline-grid; }
  .brand.compact .brand-name { display: none; }
  .topbar { gap: 8px; }
  .ctl { min-width: 0; flex: 1; max-width: 90px; }
  .dock { gap: 6px; }
  .grid { padding: 8px; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
  .grid[data-n="2"] { grid-template-columns: 1fr; }
  .toasts { inset-block-end: 84px; }
}

@media (max-width: 560px) {
  .floor { grid-template-columns: 58px 1fr; padding-inline: 10px; gap: 8px; }
  .doors { gap: 8px; }
  .door { height: 56px; font-size: 1.1rem; }
  .login-card { padding: 22px 18px; }
  .admin-bar { gap: 10px; }
  .tab { padding: 8px 10px; }
  .brand-sub { display: none; }
  .urow { grid-template-columns: minmax(0, 1fr) auto; }
  .urow .status { grid-row: 2; grid-column: 1; justify-self: start; }
  .urow .uacts { grid-row: 1 / span 2; grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .admin-bar, .toasts, .dlg, .created-actions { display: none !important; }
  body.printing-created .tabpane:not(#tab-users) { display: none !important; }
  body.printing-created #tab-users > :not(#created-box) { display: none !important; }
  body.printing-created .created { border: 0; background: #fff; }
}

/* ═══════════════════════ اتاق مدیر ═══════════════════════ */
select {
  width: 100%; min-height: 44px; padding: 9px 12px;
  background: #fff; border: 1px solid #c6d4cd; border-radius: 10px;
}
select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12, 106, 88, .18); }

/* دکمهٔ «اتاق مدیر» در صفحهٔ اول، جدا از ساختمان */
.sdoor {
  display: flex; align-items: center; gap: 14px; width: min(100%, 540px); margin-top: 14px; padding: 14px 18px;
  border: 1.5px dashed rgba(255, 255, 255, .45); border-radius: 14px;
  background: rgba(255, 255, 255, .05); color: #fff; text-align: start; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sdoor .i { width: 1.7rem; height: 1.7rem; color: var(--gold); }
.sdoor span { display: grid; line-height: 1.5; }
.sdoor b { font-size: 1.1rem; }
.sdoor small { color: rgba(255, 255, 255, .7); font-size: .85rem; }
.sdoor:hover { background: rgba(255, 255, 255, .12); }
.sdoor.is-selected { background: var(--gold); border: 1.5px solid var(--gold); color: var(--gold-ink); }
.sdoor.is-selected .i { color: var(--gold-ink); }
.sdoor.is-selected small { color: rgba(43, 29, 0, .75); }
.sdoor:focus-visible { box-shadow: var(--focus); }

/* صفحهٔ دانش‌آموز */
.support-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px clamp(14px, 3vw, 32px); background: var(--deep); color: #fff;
}
.support-wrap { max-width: 760px; margin: 0 auto; padding: 24px clamp(12px, 3vw, 24px) 40px; }
.support-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 16px; }
.support-intro { display: grid; gap: 4px; }
.support-intro h1 { font-size: 1.35rem; }
.sup-log, .conv-log {
  display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
  min-height: 260px; max-height: 52dvh; padding: 12px; background: var(--paper); border-radius: 12px;
}
.sup-msg { max-width: 86%; padding: 7px 12px; border-radius: 4px 14px 14px 14px; background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.sup-msg.mine { align-self: flex-end; background: var(--brand-soft); border-color: #b5ddcd; border-radius: 14px 4px 14px 14px; }
.sup-msg.admin { box-shadow: inset 3px 0 0 var(--gold); }
.sup-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--ink-2); }
.sup-meta b { color: var(--ink); }
.sup-meta time { margin-inline-start: auto; }
.sup-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sup-form, .conv-form { display: flex; gap: 8px; }
.sup-form input, .conv-form input { flex: 1; }

/* تب «اتاق مدیر» در پنل مدیریت */
.tab .badge { margin-inline-start: 6px; }
.support-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.thread-list { display: grid; gap: 6px; max-height: 66dvh; overflow-y: auto; }
.thread {
  display: grid; gap: 2px; text-align: start; width: 100%; padding: 9px 12px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.thread:hover { border-color: #a9c0b6; }
.thread.is-active { background: var(--deep); border-color: var(--deep); color: #fff; }
.thread.is-unread:not(.is-active) { border-color: var(--gold); background: #fffaf0; }
.thread-top { display: flex; align-items: center; gap: 8px; }
.thread-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.thread-top time { margin-inline-start: auto; font-size: .75rem; opacity: .7; }
.thread-last { font-size: .85rem; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .room-tag { padding: 0 8px; font-size: .78rem; }
.thread.is-active .room-tag { background: rgba(255, 255, 255, .18); color: #fff; }
.conv { display: grid; gap: 12px; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.conv-who { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.conv-log { min-height: 320px; max-height: 56dvh; }
.conv-log .sup-msg.student { background: #fff; }
.conv-log .sup-msg.mine { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--gold); }
.empty.big { padding: 60px 10px; text-align: center; }

@media (max-width: 980px) { .support-layout { grid-template-columns: 1fr; } }

/* ───── چراغ کیفیت اینترنت و حضور هوشمند ───── */
.lamp { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; margin-inline-end: 8px; vertical-align: middle; border: 1px solid rgba(0,0,0,.25); }
.lamp.green { background: #22c55e; box-shadow: 0 0 7px #22c55e; }
.lamp.yellow { background: #eab308; box-shadow: 0 0 7px #eab308; }
.lamp.red { background: #ef4444; box-shadow: 0 0 7px #ef4444; animation: lampblink 1.2s infinite; }
.lamp.off { background: #9aa5a0; opacity: .55; }
@keyframes lampblink { 50% { opacity: .45; } }
.prow .lamp { margin-inline-end: 0; }
.lamp-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--c-muted); padding: 4px 2px 8px; }
.lamp-legend .lamp { width: 9px; height: 9px; margin-inline-end: 4px; box-shadow: none; animation: none; }
.session-line { font-size: .82rem; color: var(--c-muted); padding: 2px 2px 6px; }
.chip.sm.warn { background: #fef3c7; color: #92400e; }
.st-wait { background: #fef3c7; color: #92400e; }
.ctl.end { background: #b45309; border-color: #b45309; color: #fff; }
.ctl.end:hover { background: #92400e; }
.list-block.wait h4 { border-bottom-color: #eab308; }
.uname, .att-name { display: flex; align-items: center; }
.sess { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.sess-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sess-stats { display: flex; gap: 10px; }
.sess-stats .stat { flex: 1; }
#dlg-text { white-space: pre-line; }

/* ───── تختهٔ وایت‌برد ───── */
body.board-on .stage { display: flex; flex-direction: column; overflow: hidden; }
body.board-on .grid { display: flex; flex: none; min-height: 0; overflow-x: auto; padding: 6px; gap: 6px; align-content: normal; }
body.board-on .tile, body.board-on .grid.has-presenter .tile.presenting { width: 112px; max-height: none; flex: none; border-radius: 10px; }
body.board-on .tile .label { font-size: .65rem; padding: 1px 6px; }
.board { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #16241f; border-top: 1px solid var(--c-line); }
.board[hidden] { display: none; }
.board-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; overflow-x: auto; scrollbar-width: thin; background: var(--c-panel); border-bottom: 1px solid var(--c-line); flex: none; }
.board-tools .bt { flex: none; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--c-line); background: var(--c-panel-2); color: var(--c-text); cursor: pointer; }
.board-tools .bt .i { width: 20px; height: 20px; }
.board-tools .bt.is-on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.board-tools .bt:disabled { opacity: .35; cursor: not-allowed; }
.board-tools .bt.danger { color: #ffaaa3; }
.board-tools .bt.sz i { display: block; border-radius: 50%; background: currentColor; }
.board-tools .sw { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #3b5148; cursor: pointer; padding: 0; }
.board-tools .sw.is-on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.board-tools .bcolor { flex: none; width: 34px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.board-tools .bsep { flex: none; width: 1px; align-self: stretch; background: var(--c-line); margin: 2px 4px; }
.board-tools .bnote { color: var(--c-muted); font-size: .85rem; padding: 0 6px; white-space: nowrap; }
.board-tools .grow { flex: 1; }
.board-view { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px; overflow: hidden; }
.board-paper { position: relative; background: #fff; border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.5); direction: ltr; }
.board-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (max-width: 900px) {
  body.board-on .tile, body.board-on .grid.has-presenter .tile.presenting { width: 84px; }
  .board-tools .bt { width: 42px; height: 42px; }
  .board-tools .sw { width: 30px; height: 30px; }
}

/* دکمهٔ ورود همیشه در دسترس بماند، حتی وقتی پیام خطای دوربین/میکروفن صفحه را بلند می‌کند */
#join-btn { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -10px 14px -6px var(--c-panel); }
.prejoin-card .note { font-size: .85rem; line-height: 1.7; }
.layout { grid-template-rows: minmax(0, 1fr); }
.board { min-height: 220px; }
.board-paper { width: 100%; aspect-ratio: 16 / 9; }

/* ───── قرعه‌کشی ───── */
.pick { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(4,12,9,.78); backdrop-filter: blur(3px); padding: 16px; }
.pick[hidden] { display: none; }
.pick-card { width: min(92vw, 560px); text-align: center; background: var(--c-panel); border: 2px solid var(--gold); border-radius: 24px; padding: 28px 22px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.pick-title { color: var(--gold); font-weight: 700; letter-spacing: .02em; margin-bottom: 14px; }
.pick-name { font-size: clamp(1.8rem, 7vw, 3.2rem); font-weight: 800; line-height: 1.5; min-height: 1.6em; overflow-wrap: anywhere; color: var(--c-text); }
.pick.done .pick-name { color: var(--gold); animation: pickpop .45s ease-out; }
@keyframes pickpop { 0% { transform: scale(.7); opacity: .3; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.pick-bar { height: 6px; border-radius: 99px; background: #0d1a16; overflow: hidden; margin-top: 18px; }
.pick-bar i { display: block; height: 100%; width: 100%; background: var(--gold); }

/* ───── گزارش دانش‌آموز و ثبت‌نام با اکسل ───── */
.student-card { margin-bottom: 16px; display: grid; gap: 10px; }
.sr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.sr-form select, .sr-form input { width: 100%; }
#sr-result .sess-stats { margin: 8px 0; flex-wrap: wrap; }
.sr-table { display: grid; gap: 0; }
.sr-row { display: grid; grid-template-columns: 1.1fr .8fr 1fr 1.3fr; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: .92rem; align-items: center; }
.sr-row.head { font-weight: 700; color: var(--ink-2); }
.sr-present { background: var(--ok-soft); } .sr-late { background: #fef3c7; } .sr-absent { background: var(--danger-soft); } .sr-wait { background: #eef1ef; }
.import-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.import-row input[type=file] { flex: 1; min-width: 160px; }
@media (max-width: 560px) { .sr-row { grid-template-columns: 1fr 1fr; } }

/* ───── دست بالا ───── */
.hands { border: 1px solid var(--gold); border-radius: 12px; padding: 6px 8px 8px; margin-bottom: 10px; background: rgba(250,204,21,.08); }
.hands .list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hands .list-head h4 { display: flex; align-items: center; gap: 6px; color: var(--gold); }
.hand-row .hand-no { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.hand-flag { color: var(--gold); display: inline-grid; flex: none; animation: handwave 1s ease-in-out infinite; }
@keyframes handwave { 50% { transform: rotate(-14deg); } }
#btn-hand.active { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.board-tools .bt.ins { border-style: dashed; }
.prow { flex-wrap: wrap; row-gap: 4px; }
.prow .pacts { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-inline-start: auto; }
