/* ============ قِطاف — التصميم العام (الهوية 1.3) ============
   brand = درجة solid آمنة للنص الأبيض (تباين ≥ 4.5)، وbrand-deco للزخرفة فقط. */
:root {
  --bg: #f8f3ff; --bg2: #ede4ff; --card: #ffffff; --ink: #4a2341; --muted: #7c3b66; --line: #e9d5ff;
  --brand: #9333ea; --brand-deep: #7e22ce; --brand-deco: #a855f7; --brand2: #be185d; --brand-ink: #ffffff; --accent: #d8b4fe; --soft: #faf5ff;
  --ok: #22c55e; --ok-ink: #15803d; --ok-text: #166534; --ok-bg: #dcfce7;
  --bad: #f43f5e; --bad-ink: #be123c; --bad-bg: #ffe4e6;
  --warn: #fb923c; --warn-ink: #c2410c;
  --c1: #ec4899; --c2: #a855f7; --c3: #fb923c; --c4: #22c55e; --c5: #60a5fa; --c6: #facc15;
  --radius: 20px; --shadow: 0 2px 0 #f3e8ff, 0 8px 24px rgba(74, 35, 65, .06);
  --font-display: "Baloo Bhaijaan 2", "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  --font-ui: "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  --font-read: "Noto Naskh Arabic", "Readex Pro", "Traditional Arabic", serif;
  --font: var(--font-ui);
}
[data-theme="lavender"] { --bg: #f8f3ff; --bg2: #ede4ff; --line: #e9d5ff; --brand: #9333ea; --brand-deep: #7e22ce; --brand-deco: #a855f7; --brand2: #be185d; --accent: #d8b4fe; --soft: #faf5ff; }
[data-theme="pink"] { --bg: #fff5fa; --bg2: #ffe4f1; --line: #f6d3e6; --brand: #be185d; --brand-deep: #9d174d; --brand-deco: #ec4899; --brand2: #9333ea; --accent: #f9a8d4; --soft: #fdf2f8; }
[data-theme="peach"] { --bg: #fff7f0; --bg2: #ffe7d6; --line: #fbd9c4; --brand: #c2410c; --brand-deep: #9a3412; --brand-deco: #fb923c; --brand2: #be185d; --accent: #fdba74; --soft: #fff7ed; }
[data-theme="mint"] { --bg: #f0fdf8; --bg2: #d5f7ea; --line: #c4ecdc; --brand: #047857; --brand-deep: #065f46; --brand-deco: #34d399; --brand2: #0f766e; --accent: #6ee7b7; --soft: #ecfdf5; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.7;
  background: var(--bg) radial-gradient(circle at 10% 0%, var(--bg2) 0, transparent 45%) no-repeat,
              radial-gradient(circle at 100% 100%, var(--bg2) 0, transparent 40%) no-repeat;
  background-attachment: fixed;
}
a { color: var(--brand); }
h1, h2, h3, h4, .logo b, .btn, .stat b, .score-big, .pts, .rk, .timer, .live-timer, .join-code, .code-input, .pinpad button, .pod .step { font-family: var(--font-display); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1280px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .92em; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* الرأس */
.top { padding: 18px 0 8px; }
.top .wrap { display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo .mark { width: 48px; height: 48px; display: grid; place-items: center; font-size: 28px; border-radius: 16px; background: var(--soft); border: 2px solid var(--line); box-shadow: none; }
.logo img.mark { width: 44px; height: 44px; border-radius: 0; background: none; border: 0; box-shadow: none; display: block; }
.logo b { font-size: 1.25rem; line-height: 1.2; display: block; }
.logo small { color: var(--muted); font-size: .8rem; }
.spacer { flex: 1; }

/* البطاقات */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 10px; font-size: 1.35rem; }
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.hero { text-align: center; padding: 26px 22px; }
.hero h1 { margin: 6px 0; font-size: clamp(1.6rem, 5vw, 2.3rem); background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.float { display: inline-block; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-4deg); } }

/* الأزرار والحقول */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  font: inherit; font-weight: 700; border: 0; border-radius: 16px; cursor: pointer; text-decoration: none;
  background: var(--soft); color: var(--ink); border: 2px solid var(--line); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border: 0; box-shadow: 0 4px 0 var(--brand-deep); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-deep); }
.btn.ok { background: var(--ok-ink); color: #fff; border: 0; }
.btn.danger { background: var(--bad-bg); color: var(--bad-ink); border-color: #fecdd3; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .85rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile:focus-visible, .opt:focus-visible { outline: 3px solid var(--brand2); outline-offset: 2px; }
label { display: block; font-weight: 700; margin: 12px 0 6px; font-size: .95rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: inherit; background: #fff; border: 2px solid var(--line);
  border-radius: 14px; padding: 10px 14px; min-height: 46px;
}
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); vertical-align: middle; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 8px 0; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.error { color: var(--bad-ink); font-weight: 700; margin: 10px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 12px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); font-size: .82rem; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); border-color: #bbf7d0; color: var(--ok-text); }
.chip.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.chip.bad { background: var(--bad-bg); border-color: #fecdd3; color: #be123c; }

/* دخول الطالبات */
.code-input { font-size: 2rem; letter-spacing: .3em; text-align: center; text-transform: uppercase; direction: ltr; font-weight: 800; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.name-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border-radius: 18px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.name-btn .av { font-size: 2rem; }
.name-btn:hover { border-color: var(--brand); transform: translateY(-2px); }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 14px 0; direction: ltr; }
.pin-dots span { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--brand); }
.pin-dots span.on { background: var(--brand); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; direction: ltr; }
.pinpad button { min-height: 64px; font: inherit; font-size: 1.6rem; font-weight: 800; border-radius: 18px; border: 2px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }
.pinpad button:active { background: var(--soft); }

/* لوحة الطالبة */
.me { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 99px; padding: 4px 14px 4px 6px; }
.me .av { font-size: 1.7rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); cursor: pointer; border: 0; }
.pts { font-weight: 800; color: var(--brand-deep); white-space: nowrap; }
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.comp { position: relative; display: flex; flex-direction: column; gap: 8px; text-align: start; padding: 20px; border-radius: var(--radius); background: #fff; border: 2px solid var(--line); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit; overflow: hidden; }
.comp::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: linear-gradient(90deg, var(--brand), var(--brand2)); }
.comp:nth-child(6n+2)::before { background: linear-gradient(90deg, var(--c2), var(--c5)); }
.comp:nth-child(6n+3)::before { background: linear-gradient(90deg, var(--c3), var(--c6)); }
.comp:nth-child(6n+4)::before { background: linear-gradient(90deg, var(--c4), var(--c5)); }
.comp:hover:not(:disabled) { transform: translateY(-3px); }
.comp:disabled { opacity: .6; cursor: not-allowed; }
.comp .em { font-size: 2.6rem; line-height: 1; }
.comp b { font-size: 1.15rem; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board li { display: grid; grid-template-columns: 2.4rem 2.2rem 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; background: var(--soft); border-radius: 16px; }
.board li.me-row { background: linear-gradient(90deg, var(--bg2), #fff); border: 2px solid var(--accent); }
.board .rk { font-weight: 800; text-align: center; font-size: 1.1rem; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.avatars button { font-size: 2rem; padding: 6px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; }

/* اللعب */
.game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress { flex: 1; height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 99px; transition: width .35s; }
.timer { font-weight: 800; min-width: 64px; text-align: center; padding: 2px 10px; border-radius: 99px; background: #fff; border: 2px solid var(--line); direction: ltr; }
.timer.low { color: var(--bad-ink); border-color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.passage { background: var(--soft); border: 2px dashed var(--accent); border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; }
.passage summary { cursor: pointer; font-weight: 800; }
.passage .body { white-space: pre-line; margin-top: 8px; line-height: 2; font-family: var(--font-read); font-size: 1.375rem; max-height: 45vh; overflow: auto; }
.qtext { font-family: var(--font-read); font-size: clamp(24px, .8vw + 20px, 30px); font-weight: 700; margin: 6px 0 14px; line-height: 2; }
.skill { color: var(--muted); font-size: .85rem; }
.opts { display: grid; gap: 12px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { width: 100%; min-height: 60px; padding: 12px 16px; border-radius: 18px; font: inherit; font-family: var(--font-read); font-size: 1.375rem; line-height: 1.7; font-weight: 700; text-align: start; cursor: pointer; border: 3px solid transparent; color: var(--ink); background: #fff; box-shadow: 0 3px 0 var(--line); transition: transform .08s; }
.opt:nth-child(4n+1) { border-color: #fbcfe8; } .opt:nth-child(4n+2) { border-color: #e9d5ff; } .opt:nth-child(4n+3) { border-color: #fed7aa; } .opt:nth-child(4n+4) { border-color: #bbf7d0; }
.opt:hover:not(:disabled) { transform: translateY(-2px); }
.opt.big { text-align: center; font-size: 1.5rem; min-height: 90px; }
.opt.right { background: var(--ok-bg); border-color: var(--ok) !important; color: var(--ok-text); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad) !important; color: #9f1239; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }
.feedback { margin-top: 14px; padding: 12px 16px; border-radius: 16px; font-weight: 700; }
.feedback.ok { background: var(--ok-bg); color: var(--ok-text); }
.feedback.no { background: var(--bad-bg); color: #9f1239; }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 64px; padding: 10px; border-radius: 18px; }
.tiles.target { background: var(--soft); border: 3px dashed var(--accent); }
.tile { min-width: 54px; min-height: 54px; padding: 8px 14px; border-radius: 14px; font: inherit; font-family: var(--font-read); font-size: 1.375rem; font-weight: 700; cursor: pointer; background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); color: var(--ink); }
.tile.sel { background: var(--brand); color: #fff; border-color: var(--brand); transform: translateY(-3px); }
.tile.letter { font-size: 1.8rem; min-width: 60px; }
.tile.right { background: var(--ok-bg); border-color: var(--ok); }
.tile.wrong { background: var(--bad-bg); border-color: var(--bad); }
.baskets { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 12px; }
.basket { min-height: 130px; border-radius: 20px; border: 3px dashed var(--accent); background: #fff; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.basket h4 { margin: 0; text-align: center; font-size: 1.05rem; }
.basket .in { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.basket.hot { border-style: solid; border-color: var(--brand); background: var(--soft); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.mitem { position: relative; padding: 12px; border-radius: 16px; font: inherit; font-family: var(--font-read); font-size: 1.25rem; line-height: 1.7; font-weight: 700; background: #fff; border: 2px solid var(--line); cursor: pointer; text-align: center; color: var(--ink); min-height: 54px; }
.mitem.sel { border-color: var(--brand); background: var(--soft); }
.mitem .tag { position: absolute; top: -10px; inset-inline-start: -8px; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: .8rem; display: grid; place-items: center; }
.memory { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.mcard { aspect-ratio: 1 / 1; border-radius: 18px; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 1rem; padding: 8px; color: #fff; background: var(--brand); box-shadow: var(--shadow); transition: transform .2s; }
.mcard::before { content: ""; display: block; width: 2rem; height: 2rem; margin: 0 auto; background: url(/img/icons/qitaf-icon-star.svg) center / contain no-repeat; }
.mcard.open { background: #fff; color: var(--ink); border: 3px solid var(--accent); }
.mcard.open::before, .mcard.done::before { content: none; }
.mcard.done { background: var(--ok-bg); color: var(--ok-text); border: 3px solid var(--ok); cursor: default; }
.result { text-align: center; }
.stars { font-size: 3rem; letter-spacing: .2em; }
.score-big { font-size: 3rem; font-weight: 900; background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
canvas#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* الإشعارات والنوافذ */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 99px; font-weight: 700; box-shadow: var(--shadow); max-width: 92vw; }
.toast.bad { background: var(--bad-ink); }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(74, 35, 65, .45); display: grid; place-items: center; padding: 16px; }
.modal > .card { width: min(720px, 100%); max-height: 92vh; overflow: auto; }

/* لوحة الإدارة */
.admin-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.side { position: sticky; top: 12px; display: grid; gap: 6px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px; }
.side button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: start; padding: 10px 12px; border-radius: 14px; border: 0; background: transparent; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.side button.on { background: var(--brand); color: #fff; }
.side button:hover:not(.on) { background: var(--soft); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px; text-align: center; }
.stat b { display: block; font-size: 1.8rem; color: var(--brand); line-height: 1.2; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; direction: ltr; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: .7rem; color: var(--muted); }
.bars i { display: block; width: 100%; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--brand), var(--brand2)); min-height: 3px; }
.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 80px; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.meter.mid > i { background: var(--warn); } .meter.low > i { background: var(--bad); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { color: var(--muted); font-weight: 700; white-space: nowrap; }
tr.off td { opacity: .5; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.filters select, .filters input { min-height: 40px; padding: 6px 10px; font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.code-badge { font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: .15em; background: var(--soft); padding: 2px 10px; border-radius: 10px; direction: ltr; display: inline-block; }
.print-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.print-card { border: 2px dashed var(--accent); border-radius: 16px; padding: 12px; text-align: center; break-inside: avoid; }
.list-edit { display: grid; gap: 6px; }
.list-edit .row input { flex: 1; }
footer.foot { text-align: center; color: var(--muted); padding: 24px 16px 32px; font-size: .9rem; }

@media (max-width: 820px) {
  .admin-layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .print-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .card { padding: 16px; }
  .opts.two { grid-template-columns: 1fr; }
  .avatars { grid-template-columns: repeat(4, 1fr); }
  .match-grid { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
body.no-anim *, body.no-anim *::before { animation: none !important; transition: none !important; }
@media print {
  body { background: #fff; } .no-print, .side, .top { display: none !important; }
  .admin-layout { display: block; } .card { box-shadow: none; border: 0; }
}
.emoji-xl { font-size: 3.2rem; line-height: 1.2; }
.narrow { max-width: 380px; margin: 0 auto; }
@media (max-width: 520px) { .hide-sm { display: none; } .logo b { font-size: 1.05rem; } }
.qtext:focus { outline: none; }
.memory { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.mcard { aspect-ratio: 4 / 3; font-size: .95rem; }
@media (max-width: 520px) { .memory { grid-template-columns: repeat(3, 1fr); } .mcard { font-size: .85rem; } }

.box-note { background: var(--soft); border: 2px dashed var(--accent); border-radius: 14px; padding: 8px 12px; margin: 8px 0; font-size: .92rem; }
.box-note.bad { background: var(--bad-bg); border-color: #fda4af; color: #9f1239; font-weight: 700; }

/* سجل العمليات */
table.audit td { vertical-align: top; }
table.audit .nowrap { white-space: nowrap; font-size: .85rem; }
table.changes { width: 100%; background: var(--soft); border-radius: 10px; font-size: .88rem; }
table.changes td.from { color: #be123c; text-decoration: line-through; text-decoration-color: #fecdd3; }
table.changes td.to { color: var(--ok-text); font-weight: 600; }

/* مصفوفة الصلاحيات */
.pm-tabs { margin: 18px 0 14px; }
table.pm { min-width: 640px; }
table.pm th, table.pm td { text-align: center; vertical-align: middle; }
table.pm .pm-name { text-align: start; min-width: 240px; }
table.pm .pm-name .muted { font-size: .8rem; font-weight: 400; }
table.pm thead th { position: sticky; top: 0; background: var(--card); z-index: 1; font-size: .88rem; }
table.pm .pm-def { background: var(--soft); }
table.pm tr.pm-group td { text-align: start; background: linear-gradient(90deg, var(--bg2), var(--soft)); font-weight: 800; color: var(--ink); padding: 10px 14px; }
.pm-cell { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 64px; min-height: 36px; padding: 4px 10px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: .9rem; white-space: nowrap; }
button.pm-cell { cursor: pointer; transition: transform .15s; }
button.pm-cell:hover:not(:disabled) { transform: scale(1.06); }
button.pm-cell:disabled { cursor: default; }
.pm-cell.yes { background: var(--ok-bg); border-color: #bbf7d0; color: var(--ok-text); }
.pm-cell.no { background: var(--bad-bg); border-color: #fecdd3; color: #be123c; }
.pm-cell.lock { background: #f5f3ff; border-color: #ddd6fe; color: #5b21b6; }
.pm-cell.lock.yes { background: var(--ok-bg); border-color: #bbf7d0; color: var(--ok-text); }
.pm-cell.lock.no { background: var(--bad-bg); border-color: #fecdd3; color: #be123c; }
.pm-cell.inh { opacity: .55; border-style: dashed; }
.pm-cell.ovr { border-width: 3px; font-weight: 800; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand2); }
.pm-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 10px 0 14px; font-size: .9rem; color: var(--muted); align-items: center; }
.pm-legend .pm-cell { min-width: 0; min-height: 28px; padding: 2px 8px; }
.pm-save { position: sticky; bottom: 12px; z-index: 20; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-top: 12px; border-radius: 18px; background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow); font-weight: 700; }
.perm-list { list-style: none; padding: 0; margin: 0; }
.perm-list li { padding: 4px 0; }
.perm-list li.no { color: var(--muted); }

/* المستخدمون والأجهزة */
.small-input { max-width: 140px; }
.alert-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.alert-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.alert-list li.new { background: #fff7ed; border-color: #fed7aa; }

/* الشهادات */
.cert-sheet { margin: 16px auto; max-width: 1200px; }
.cert-sheet img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); background: #fff; }
.verify-box { padding: 20px; border-radius: 20px; border: 2px solid var(--line); }
.verify-box.ok { background: var(--ok-bg); border-color: #a7f3d0; }
.verify-box.bad { background: var(--bad-bg); border-color: #fecdd3; }
.verify-box table { margin-top: 12px; text-align: start; }
.verify-box th { width: 38%; }
.cert-links { list-style: none; padding: 0; display: grid; gap: 8px; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body.cert-page { background: #fff !important; }
  body.cert-page .no-print { display: none !important; }
  body.cert-page .wrap { max-width: none; padding: 0; }
  body.cert-page .cert-sheet { margin: 0; max-width: none; }
  body.cert-page .cert-sheet img { width: 100vw; height: 100vh; object-fit: contain; border-radius: 0; box-shadow: none; }
  body.cert-page #cert-table { page-break-before: always; padding: 20mm; }
}

/* المسابقة المباشرة */
.live-banner { display: grid; gap: 8px; margin-bottom: 14px; }
.live-timer { font-weight: 800; font-size: 1.4rem; padding: 4px 14px; border-radius: 99px; background: var(--soft); border: 2px solid var(--line); }
.live-timer.big { font-size: 2rem; }
.live-timer.hurry { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.live-bar { margin: 10px 0 16px; }
.live-bar i { transition: width .2s linear; }
.live-opt { font-weight: 800; font-size: 1.15rem; color: #fff !important; border: 0 !important; min-height: 74px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-opt.c1 { background: #9333ea; } .live-opt.c2 { background: #be185d; } .live-opt.c3 { background: #0f766e; } .live-opt.c4 { background: #c2410c; }
.live-opt.right { outline: 5px solid #fde047; } .live-opt.dim { opacity: .35; }
.live-opt .dist { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.live-opt .dist i { display: block; height: 10px; border-radius: 6px; background: rgba(255,255,255,.85); }
.lobby-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.lobby-chip { padding: 6px 14px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); font-weight: 700; }
.join-code { font-size: clamp(3rem, 10vw, 6rem); font-weight: 800; letter-spacing: .3em; color: var(--brand); direction: ltr; }
.join-url { font-size: 1.1rem; color: var(--muted); margin-bottom: 8px; word-break: break-all; }
.host-controls { margin-bottom: 16px; }
.host-q { font-size: clamp(1.6rem, 3.4vw, 2.6rem); text-align: center; margin: 18px 0; }
.host-opts .live-opt { font-size: 1.5rem; min-height: 96px; padding: 16px 22px; border-radius: 22px; }
body.live-host .wrap { max-width: 1280px; }
.surprise { margin: 16px auto; max-width: 360px; }
.surprise-closed { width: 100%; padding: 22px; border-radius: 24px; border: 3px dashed var(--brand); background: #fff7fb; cursor: pointer; font: inherit; }
.surprise-closed .gift { animation: wiggle 1s ease-in-out infinite; }
.surprise-open { padding: 22px; border-radius: 24px; background: linear-gradient(135deg, #fef3c7, #fce7f3); border: 3px solid #fde68a; animation: pop .4s ease; }
.surprise-open.none { background: var(--soft); border-color: var(--line); }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 20px 0; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 120px; }
.pod .av { font-size: 2.4rem; }
.pod .step { width: 100%; border-radius: 14px 14px 0 0; color: var(--ink); font-weight: 800; font-size: 1.6rem; display: grid; place-items: center; }
.pod.p1 { order: 2; } .pod.p1 .step { height: 120px; background: linear-gradient(#facc15, #eab308); }
.pod.p2 { order: 1; } .pod.p2 .step { height: 90px; background: linear-gradient(#cbd5e1, #94a3b8); }
.pod.p3 { order: 3; } .pod.p3 .step { height: 70px; background: linear-gradient(#fdba74, #f97316); }
.qbars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 18px; }
.qbars > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: .75rem; }
.qbars i { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(var(--brand), var(--brand2)); }
@media (prefers-reduced-motion: reduce) { .surprise-closed .gift, .surprise-open { animation: none; } }

/* الدردشة في لوحة الإدارة */
.nav-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-inline-start: 6px; border-radius: 99px; background: #ef4444; color: #fff; font-size: .78rem; font-weight: 800; }
.chat-admin { display: grid; grid-template-columns: 320px 1fr; gap: 16px; margin-top: 12px; }
.chat-list { display: grid; gap: 8px; align-content: start; max-height: 70vh; overflow-y: auto; }
.chat-item { text-align: start; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.chat-item.on { border-color: var(--brand); background: var(--soft); }
.chat-item.off { opacity: .6; }
.chat-item .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { font-size: .78rem; }
.chat-pane { border: 1px solid var(--line); border-radius: 18px; padding: 14px; min-height: 300px; }
.chat-msgs { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 8px; background: var(--bg); border-radius: 14px; }
.chat-bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.chat-bubble.visitor { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.chat-bubble.staff { align-self: flex-end; background: var(--ok-bg); }
.chat-bubble.system { align-self: center; background: #f5f3ff; font-size: .85rem; }
.chat-pane textarea { flex: 1; }
@media (max-width: 800px) { .chat-admin { grid-template-columns: 1fr; } }

/* التحكم بالموقع التعريفي */
.cms-sections { display: grid; gap: 10px; margin-top: 12px; }
.cms-sec { border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.cms-sec.off { opacity: .55; background: var(--soft); }
.cms-sec.dragging { outline: 3px dashed var(--brand); }
.cms-sec > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; flex-wrap: wrap; }
.cms-sec .drag { cursor: grab; font-size: 1.2rem; color: var(--muted); }
.cms-fields { padding: 4px 14px 14px; display: grid; gap: 10px; }
.cms-field label { font-size: .82rem; color: var(--muted); }
.cms-item { font-size: .9rem; }
.cms-thumb { width: 54px; height: 90px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); }
.cms-page { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 10px; }

/* الاستيراد */
.stat.ok-stat b { color: #047857; } .stat.bad-stat b { color: #be123c; }
.check input[type=radio], .check input[type=checkbox] { flex: none; margin: 0; }

/* ===== الهوية 1.3 — المرحلة الثانية: أيقونات SVG وتوتة والنجوم ===== */
img.ico { display: inline-block; vertical-align: -0.25em; flex: none; }
.chip img.ico, .btn img.ico, h2 img.ico, h3 img.ico, .live-banner img.ico { margin-inline-end: 4px; }
.totah { display: block; margin: 0 auto 8px; height: auto; }
.hero .totah { margin-bottom: 6px; }
.timer::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-inline-end: 4px; vertical-align: -0.15em; background: url(/img/icons/qitaf-icon-timer.svg) center / contain no-repeat; }
.timer.speed::before { background-image: url(/img/icons/qitaf-icon-speed.svg); }
.result .totah { width: 150px; }
.stars { display: flex; justify-content: center; gap: 8px; font-size: 0; margin: 8px 0 4px; }
.stars img { width: 56px; height: 56px; }
.stars img.off { filter: grayscale(1) opacity(.35); }
.stars img.on { animation: starpop .4s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes starpop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result h2 { margin: 6px 0 4px; }
.result .sub { margin: 0 0 12px; color: var(--muted); }
.board .rk { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #fff; border: 2px solid var(--line); font-size: .95rem; }
.board .rk.r1 { background: #facc15; border-color: #eab308; color: #713f12; }
.board .rk.r2 { background: #e5e7eb; border-color: #cbd5e1; color: #374151; }
.board .rk.r3 { background: #fdba74; border-color: #fb923c; color: #7c2d12; }
.board li > .ico:first-child, .board li > span:nth-child(2) .ico { margin: 0 auto; }
.feedback.no { background: #fff7ed; color: #9a3412; border: 2px solid #fed7aa; }
.opt.wrong { background: #fff7ed; border-color: var(--warn) !important; color: #9a3412; }
.tile.wrong { background: #fff7ed; border-color: var(--warn); }
.mcard.open, .mcard.done { font-family: var(--font-read); font-size: 1.15rem; }
.live-banner .btn::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; margin-inline-end: 8px; animation: pulse 1s infinite; }
.comp .em .ico { width: 44px; height: 44px; }
.name-btn .av { font-size: 2rem; }

/* ===== الهوية 1.3 — المرحلة الثالثة: المسابقة المباشرة ===== */
.live-opt { justify-content: flex-start; gap: 12px; text-align: start; }
.live-opt .shape { flex: none; box-sizing: content-box; padding: 6px; background: rgba(255, 255, 255, .2); border-radius: 12px; }
.live-opt .lo-t { flex: 1; font-family: var(--font-read); font-size: 1.375rem; line-height: 1.7; }
.live-opt.big .lo-t { text-align: center; }
.live-opt .dist { margin-inline-start: auto; }
.live-timer::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-inline-end: 6px; vertical-align: -0.15em; background: url(/img/icons/qitaf-icon-timer.svg) center / contain no-repeat; }
.live-timer.big { width: 92px; height: 92px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 6px solid var(--brand); background: #fff; font-size: 2.4rem; }
.live-timer.big::before { content: none; }
.live-timer.big.hurry { border-color: var(--warn); }
.join-label { margin-top: 8px; font-weight: 700; color: var(--muted); }
.join-code { color: var(--brand-deep); }
.rank-circle { width: 96px; height: 96px; margin: 6px auto; border-radius: 50%; display: grid; place-items: center; font: 800 2.8rem var(--font-display); background: var(--soft); color: var(--brand-deep); border: 6px solid var(--accent); }
.rank-circle.r1 { background: #facc15; border-color: #eab308; color: #713f12; }
.rank-circle.r2 { background: #e5e7eb; border-color: #cbd5e1; color: #374151; }
.rank-circle.r3 { background: #fdba74; border-color: #fb923c; color: #7c2d12; }
#stage.live-ok { background: #15803d; border-color: #166534; color: #fff; }
#stage.live-ok .muted { color: #dcfce7; }
#stage.live-ok .board li { color: var(--ink); }
#stage.live-ok .board li .pts { color: var(--brand-deep); }
#stage.live-no { background: #fff7ed; border-color: #fed7aa; }
.surprise-closed, .surprise-open { color: var(--ink); }
.surprise-closed .gift { display: block; }
.sp-x2 { font: 800 3rem var(--font-display); color: var(--brand-deep); line-height: 1.2; }
.pod .av { font-size: 2.4rem; }
.podium .totah { margin-bottom: 0; }

/* التحقق من الشهادات */
.verify-box { text-align: center; }
.verify-box .totah { width: 110px; }
.verify-box.ok { background: var(--ok-bg); border-color: #bbf7d0; color: var(--ok-text); }
.verify-box.ok h2 { color: var(--ok-text); }
.verify-box.ok .muted { color: var(--ok-text); }
.verify-box.bad { background: #fff1f2; border-color: #fda4af; }
.verify-box.bad h2 { color: var(--bad-ink); }
.vb-icon { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--bad-ink); color: #fff; font: 800 2rem var(--font-display); }
.verify-box table { text-align: start; color: var(--ink); }

/* ===== الهوية 1.3 — المرحلة الرابعة: لوحة الأستاذة والمالكة (نسخة هادئة) ===== */
body[data-surface="dashboard"] { --bg: #faf7fa; background: var(--bg); }
[data-surface="dashboard"] .card { border-width: 1px; box-shadow: 0 1px 0 var(--line), 0 6px 20px rgba(74, 35, 65, .04); }
[data-surface="dashboard"] .stat { border-width: 1px; }
[data-surface="dashboard"] .toast { background: var(--ink); }
.toast { top: 20px; bottom: auto; }
.side button { gap: 10px; }
.side button img.ico { width: 22px; height: 22px; flex: none; }
.side button.on img.ico { background: #fff; border-radius: 8px; padding: 2px; box-sizing: content-box; }
/* التعديل 23: زر «خدمة العملاء» عبر واتساب في آخر القائمة (للأستاذة) */
.side .nav-support { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; min-height: 44px; border-radius: 14px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; text-decoration: none; line-height: 1.3; grid-column: 1 / -1; }
.side .nav-support:hover { background: #dcfce7; }
.side .nav-support:focus-visible { outline: 3px solid #15803d; outline-offset: 2px; }
.side .nav-support > span:last-child { display: grid; }
.side .nav-support b { font-weight: 700; }
.side .nav-support small { color: #166534; font-size: .78rem; }
.side .nav-support .wa-dot { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #15803d; display: grid; place-items: center; }
button img.ico, a.btn img.ico { margin-inline-end: 6px; }
.btn img.ico { vertical-align: -0.3em; }
th { color: var(--ink); background: var(--soft); position: sticky; top: 0; }
tbody tr:hover td { background: var(--soft); }
td img.ico, .stat img.ico { vertical-align: -0.25em; }
.modal > .card { border-radius: 28px; }
.modal h2 img.ico { margin-inline-end: 6px; }
.pm-cell img.ico { width: 16px; height: 16px; }
.nav-badge { background: var(--brand); color: #fff; }

/* ===== الهوية 1.3 — المرحلة الخامسة: الحالات الفارغة وصفحة 404 ===== */
.empty-totah { width: 84px; height: auto; margin: 10px auto 0; display: block; }
p.empty-state { text-align: center; padding: 4px 0 14px; }
.code404 { font: 800 4.5rem/1 var(--font-display); color: var(--brand-deep); margin: 4px 0 6px; }
.narrow-page { max-width: 460px; margin-inline: auto; }

/* ===== اشتراك الأستاذة ===== */
.sub-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; border-radius: 20px; border: 2px solid #fed7aa; background: #fff7ed; color: #9a3412; font-weight: 600; }
.sub-banner.first { border-color: #fde68a; background: #fefce8; color: #854d0e; }
.sub-banner.grace { border-color: #fdba74; background: #ffedd5; }
.sub-banner .totah { width: 56px; height: auto; margin: 0; }
.sub-banner .btn { flex: none; }
.sub-card .row + .row { margin-top: 6px; }
.main-col { min-width: 0; }

/* ===== التعديل 19: اللوحات على الحاسوب والآيباد والجوال ===== */
.mnav-toggle, .mnav-bar, .mnav-backdrop { display: none; }
.modal-body { min-width: 0; }
.modal .modal-x img.ico { width: 26px; height: 26px; margin: 0; }

/* أهداف لمس لا تقل عن 44 بكسل على الأجهزة اللمسية والشاشات المتوسطة والصغيرة */
@media (max-width: 1024px), (pointer: coarse) {
  .btn.small { min-height: 44px; padding: 6px 14px; }
  .btn.small { min-width: 44px; }
  .filters select, .filters input { min-height: 44px; }
  .side button { min-height: 44px; }
  .check { min-height: 44px; margin: 4px 0; }
  .pm-cell { min-height: 44px; min-width: 64px; }
  .chat-item { min-height: 44px; }
  td.td-check, th.th-check { min-width: 44px; height: 44px; cursor: pointer; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; }
  .avatars button { min-height: 52px; }
  .me .av { width: 44px; height: 44px; }
  .cms-sec > summary { min-height: 44px; }
  .pinpad button { min-height: 64px; }
  .table-wrap a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
}

/* الجوال والآيباد العمودي: قائمة منسدلة أعلى الصفحة + شريط سفلي */
@media (max-width: 900px) {
  body.has-mnav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  [data-surface="dashboard"] .top { padding: 10px 0 6px; }
  [data-surface="dashboard"] .top .wrap { gap: 8px; }
  [data-surface="dashboard"] .logo img.mark { width: 38px; height: 38px; }
  .top .who { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .admin-layout { display: block; }
  .mnav-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; margin: 0 0 12px; padding: 6px 16px;
    position: sticky; top: 0; z-index: 30; font: inherit; color: var(--ink); text-align: start; cursor: pointer;
    background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 14px rgba(74, 35, 65, .06);
  }
  .mnav-label { flex: 1; display: grid; line-height: 1.25; }
  .mnav-label small { color: var(--muted); font-size: .75rem; }
  .mnav-label b { font-family: var(--font-display); font-size: 1.1rem; }
  .mnav-chev { width: 12px; height: 12px; border: solid var(--brand); border-width: 0 3px 3px 0; transform: rotate(45deg); margin-top: -6px; transition: transform .15s; }
  .mnav-toggle[aria-expanded="true"] .mnav-chev { transform: rotate(-135deg); margin-top: 6px; }
  .side { display: none; }
  .side.open {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; position: fixed; z-index: 45; top: var(--mnav-top, 70px); inset-inline: 12px;
    max-height: calc(100dvh - var(--mnav-top, 70px) - 90px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
    padding: 10px; box-shadow: 0 18px 40px rgba(74, 35, 65, .22);
  }
  .side.open button { min-height: 48px; font-size: .95rem; line-height: 1.35; }
  .mnav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(74, 35, 65, .35); }
  .mnav-bar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset-inline: 0; bottom: 0; z-index: 46;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(74, 35, 65, .07);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .mnav-bar > a, .mnav-bar > button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: 4px 2px;
    font: inherit; font-size: .78rem; font-weight: 700; line-height: 1.2; color: var(--muted); text-decoration: none; background: none; border: 0; border-radius: 14px; cursor: pointer;
  }
  .mnav-bar img.ico { margin: 0; opacity: .75; }
  .mnav-bar .on { color: var(--brand-deep); background: var(--soft); }
  .mnav-bar .on img.ico { opacity: 1; }
  .mnav-bar .nav-badge { position: absolute; top: 4px; inset-inline-end: calc(50% - 26px); margin: 0; }
  .mnav-dots { display: flex; gap: 4px; height: 26px; align-items: center; }
  .mnav-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .pm-save { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.menu-open { overflow: hidden; }
  .card { padding: 18px; }
  .card h2 { font-size: 1.2rem; }

  /* النوافذ بملء الشاشة */
  .modal { padding: 0; place-items: stretch; z-index: 50; }
  .modal > .card { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; padding: 0 16px; display: flex; flex-direction: column; overflow: auto; }
  .modal .modal-head { position: sticky; top: 0; z-index: 2; background: var(--card); padding: 12px 0 10px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
  .modal .modal-head h2 { margin: 0; font-size: 1.15rem; }
  .modal .modal-x { min-width: 44px; flex: none; }
  .modal .modal-body { flex: 1; padding: 12px 0; }
  .modal .modal-actions { position: sticky; bottom: 0; z-index: 2; background: var(--card); margin: 0; padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .modal .modal-actions .btn { flex: 1 1 auto; }
  body.modal-open { overflow: hidden; }
  #avatar-modal > .card { border-radius: 0; padding: 16px; }
}

/* الجوال والآيباد: الجداول بطاقات (عمود واحد على الجوال، وعمودان على الآيباد عموديًا وأفقيًا) */
@media (max-width: 1100px) {
  table.rt, table.rt > tbody { display: block; width: 100%; min-width: 0; }
  table.rt > thead { display: none; }
  table.rt > tbody > tr { display: block; margin: 0 0 10px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
  table.rt > tbody > tr:hover td { background: none; }
  table.rt > tbody > tr > td { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 6px 0; border: 0; border-bottom: 1px dashed var(--line); min-width: 0; word-break: break-word; }
  table.rt > tbody > tr > td:last-child { border-bottom: 0; }
  table.rt > tbody > tr > td[data-label]::before { content: attr(data-label); flex: 0 0 7.5em; color: var(--muted); font-weight: 700; font-size: .85rem; }
  table.rt > tbody > tr > td.td-empty { display: none; }
  table.rt > tbody > tr > td:first-child:not(.td-check) { font-size: 1.02rem; font-weight: 700; }
  table.rt > tbody > tr > td:first-child:not(.td-check)::before { display: none; }
  table.rt.has-all > thead { display: block; position: static; }
  table.rt.has-all > thead > tr { display: flex; }
  table.rt.has-all > thead > tr > th { display: none; }
  table.rt.has-all > thead > tr > th.th-check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; position: static; background: none; font-weight: 700; }
  table.rt.has-all > thead > tr > th.th-check::after { content: "تحديد الكل"; }
  table.rt > tbody > tr > td > .row { flex: 1; }
  table.rt > tbody > tr > td .meter { flex: 1; }
  table.rt > tbody > tr > td.td-check { justify-content: flex-start; }
  table.rt.pm .pm-name { min-width: 0; }
  table.rt.pm > tbody > tr > td { justify-content: space-between; }
  table.rt.pm tr.pm-group { padding: 0; border: 0; background: none; }
  table.rt.pm tr.pm-group td { border-radius: 12px; }
  table.pm { min-width: 0; }
  .table-wrap { overflow-x: visible; }
}
@media (min-width: 601px) and (max-width: 1100px) {
  table.rt > tbody { display: grid; grid-template-columns: 1fr; gap: 12px; }
  table.rt > tbody > tr { margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  table.rt > tbody > tr > td:first-child, table.rt > tbody > tr > td:last-child, table.rt > tbody > tr > td.td-span { grid-column: 1 / -1; }
  table.rt > tbody > tr > td:last-child { border-bottom: 0; }
  table.rt > tbody > tr > td[data-label]::before { flex-basis: 6.5em; }
}
/* الجوال */
@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .row > h2.grow { flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .chat-admin { gap: 10px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .list-edit .row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .list-edit .row input:not([type=checkbox]), .list-edit .row select { flex: 1 1 100%; min-width: 0; }
  .list-edit .row .chip { order: -1; }
}

/* التعديل 25: زر «متاحون الآن» في قسم الدردشة (للمالكة) */
.avail-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.avail-btn .avail-dot { width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; flex: none; }
.avail-btn.on { background: var(--ok-bg); border-color: #86efac; color: var(--ok-text); }
.avail-btn.on .avail-dot { background: var(--ok-ink); box-shadow: 0 0 0 4px rgba(21, 128, 61, .18); }
.avail-note { margin: 6px 0 0; color: var(--ink); font-size: .92rem; }

/* التعديل 20: بطاقات دخول الطالبات */
.cards-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.cards-opts .btn { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 14px; min-height: 72px; }
.cards-opts .btn small { font-weight: 500; opacity: .9; }
.lc-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.lc-card { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 4px 16px rgba(74, 35, 65, .1); }
.lc-preview { max-width: 520px; margin: 0 auto 10px; }
@page cards { size: A4; margin: 8mm; }
@media print {
  .lc-sheet { page: cards; grid-template-columns: repeat(2, 92mm); gap: 4mm; justify-content: center; margin: 0; }
  .lc-card { width: 92mm; border-radius: 0; box-shadow: none; break-inside: avoid; outline: 1px dashed #bbb; }
  #sub-banner, .mnav-toggle, .mnav-bar { display: none !important; }
  .admin-layout, .main-col { display: block !important; }
}
/* باركود صفحة دخول الطالبات */
.login-qr { margin: 22px auto 0; text-align: center; }
.login-qr canvas { width: 150px; height: 150px; border: 3px solid var(--line); border-radius: 14px; background: #fff; }
.login-qr figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; }
/* صفحة الطالبة: عنوان لكل مادة */
.subj-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 1.15rem; color: var(--brand-deep); }
