/* «نبض · أجهزتي» — هوية وزارة التعليم (الألوان والخط HNW23 من حزمة الهوية في بوابة المدرسة) — ٢٧ نوفمبر ٢٠٢٦ */
@font-face { font-family: "HNW23"; src: url("/fonts/HNW23-Regular.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "HNW23"; src: url("/fonts/HNW23-Bold.ttf") format("truetype"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/IBMPlexSansArabic-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }

:root {
  --navy: #12293a; --navy-2: #15445a; --teal: #0da9a6; --cyan: #69cee3; --gold: #d5c296; --moe-green: #07a869;
  --bg: #f2f4f6; --surface: #ffffff; --surface-2: #eef2f5; --line: rgba(18, 41, 58, .08);
  --text: #23404f; --muted: #5a7280; --faint: #93a5b0;
  --brand-soft: rgba(13, 169, 166, .10);
  --green: #07a869; --green-soft: rgba(7, 168, 105, .11); --amber: #b7791f; --amber-soft: rgba(213, 194, 150, .28);
  --red: #d0344f; --red-soft: rgba(208, 52, 79, .08);
  --shadow: 0 1px 2px rgba(18, 41, 58, .04), 0 8px 24px rgba(18, 41, 58, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1820; --surface: #11222e; --surface-2: #17303e; --line: rgba(255, 255, 255, .07);
    --text: #e8f0f4; --muted: #9fb6c2; --faint: #5f7a88; --brand-soft: rgba(13, 169, 166, .16);
    --green-soft: rgba(7, 168, 105, .16); --amber-soft: rgba(213, 194, 150, .16); --red-soft: rgba(208, 52, 79, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "HNW23", "IBM Plex Sans Arabic", -apple-system, "Segoe UI", Tahoma, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 340px; pointer-events: none; z-index: 0;
  background: radial-gradient(600px 240px at 85% -40px, rgba(13, 169, 166, .16), transparent 70%),
              radial-gradient(500px 220px at 10% -60px, rgba(213, 194, 150, .22), transparent 70%); }
button { font: inherit; }
bdi { unicode-bidi: isolate; }

/* الشعار: نبضة */
.mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--navy-2)); box-shadow: 0 6px 16px rgba(13, 169, 166, .3); }
.mark svg { width: 22px; height: 22px; }
.mark.big { width: 64px; height: 64px; border-radius: 18px; } .mark.big svg { width: 34px; height: 34px; }

/* الترويسة الكحلية + شريط الهوية */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 14px 32px; background: var(--navy); color: #fff; }
.top::after { content: ""; position: absolute; inset: auto 0 -4px 0; height: 4px; background: linear-gradient(to left, var(--teal), var(--cyan), var(--gold)); }
.title { font-size: 19px; font-weight: 800; }
.sub { font-size: 12.5px; color: var(--cyan); margin-top: 1px; }
.sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #d9e6ec; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 9px 15px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--navy-2), var(--teal)); color: #fff; border: none; box-shadow: 0 6px 16px rgba(21, 68, 90, .25); }
.top .btn.primary { background: var(--teal); box-shadow: none; }
.top .btn.ghost { background: transparent; color: #d9e6ec; border-color: rgba(255,255,255,.18); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.danger { color: var(--red); background: var(--red-soft); border-color: transparent; }

main { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 28px 32px 48px; }
.hello h1 { margin: 0; font-size: 28px; font-weight: 800; }
.hello p { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat .si { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 19px; background: var(--surface-2); }
.stat b { display: block; font-size: 24px; line-height: 1.15; }
.stat span { font-size: 12.5px; color: var(--muted); }
.c-green { color: var(--green); } .c-amber { color: var(--amber); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.empty { text-align: center; color: var(--muted); padding: 42px; background: var(--surface); border: 1px dashed var(--line); border-radius: 22px; line-height: 1.8; }
.note { text-align: center; font-size: 12px; color: var(--faint); margin-top: 22px; }

/* بطاقة الجهاز */
.dev { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.hd { display: flex; align-items: center; gap: 14px; padding: 18px 20px 14px; }
.avatar { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; position: relative; background: var(--surface-2); flex-shrink: 0; }
.avatar i { position: absolute; bottom: -2px; left: -2px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--faint); }
.avatar i.on { background: var(--green); }
.dname { font-size: 17px; font-weight: 800; }
.dmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.g { background: var(--green-soft); color: var(--green); }
.chip.t { background: var(--brand-soft); color: var(--teal); }
.chip.gold { background: var(--amber-soft); color: #7a6533; }
@media (prefers-color-scheme: dark) { .chip.gold { color: var(--gold); } }

.power { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.power small { font-size: 11px; font-weight: 700; color: var(--muted); }
.sw { width: 52px; height: 30px; border-radius: 999px; background: #cfd8de; position: relative; flex-shrink: 0; border: none; padding: 0; cursor: pointer; }
@media (prefers-color-scheme: dark) { .sw:not(.on) { background: #2a4252; } }
.sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: right .15s; }
.sw.on { background: linear-gradient(135deg, var(--teal), var(--moe-green)); } .sw.on::after { right: 25px; }
.sw.s { width: 38px; height: 22px; } .sw.s::after { width: 16px; height: 16px; } .sw.s.on::after { right: 19px; }
.sw.wait { outline: 2px dashed var(--gold); outline-offset: 2px; }
.sw:disabled { opacity: .45; cursor: default; }

.live { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px 14px; }
.tile { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.tile .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 14px; font-weight: 700; margin-top: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--faint); }
.dot.g { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); } .dot.r { background: var(--red); }

.sec { padding: 4px 20px 0; font-size: 12px; font-weight: 700; color: var(--faint); }
.svcs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 20px 14px; }
.svc { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 13px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; min-width: 0; }
.svc .e { font-size: 15px; }
.svc .sw { margin-inline-start: auto; }

.row { display: flex; align-items: center; gap: 10px; padding: 4px 20px 12px; flex-wrap: wrap; }
.row .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; min-width: 84px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button, .seg span { padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-radius: 9px; border: none; background: transparent; cursor: pointer; }
.seg .on { background: var(--surface); color: var(--navy-2); box-shadow: 0 1px 3px rgba(18, 41, 58, .14); }
@media (prefers-color-scheme: dark) { .seg .on { background: #24485a; color: #fff; } }
.seg .wait { box-shadow: inset 0 -3px 0 var(--gold); }

.sched { margin: 2px 20px 16px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; font-size: 13px;
  background: linear-gradient(135deg, var(--amber-soft), transparent); border: 1px solid rgba(213, 194, 150, .45); }
.sched .t { font-size: 18px; font-weight: 800; }
.sched.off { background: var(--surface-2); border-color: transparent; color: var(--muted); }
.pend { margin: 0 20px 16px; padding: 10px 14px; border-radius: 16px; background: var(--brand-soft); font-size: 13px; }
.pend div { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.pend button { margin-inline-start: auto; }
.msgline { margin: 0 20px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.ft { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 45%, transparent); flex-wrap: wrap; }
.dev.off .live, .dev.off .svcs, .dev.off .row, .dev.off .sched { opacity: .45; }

/* الدخول */
.login { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 34px 28px 28px; width: 100%; max-width: 400px; text-align: center; box-shadow: var(--shadow); }
.login-box .mark { margin: 0 auto; }
.login-box h1 { margin: 14px 0 6px; font-size: 24px; font-weight: 800; }
.login-box p { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; line-height: 1.8; }
.digits { display: flex; gap: 7px; justify-content: center; direction: ltr; margin-bottom: 18px; }
.digits input { width: 44px; height: 54px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
  text-align: center; font-size: 24px; font-weight: 800; font-family: ui-monospace, Menlo, monospace; outline: none; }
.digits input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--brand-soft); }
.digits .gap { width: 8px; }
.login-box .btn.primary { width: 100%; padding: 12px; font-size: 15px; border-radius: 14px; }
.msg { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }
.hint { margin-top: 14px; font-size: 12px; color: var(--faint); line-height: 1.8; }

/* النوافذ */
.veil { position: fixed; inset: 0; background: rgba(11, 24, 32, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.dlg { width: 560px; max-width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.dlg.small { width: 440px; }
.dlg h2 { margin: 0; font-size: 17px; padding: 18px 22px; border-bottom: 1px solid var(--line); font-weight: 800; }
.dlg .in { padding: 16px 22px; display: grid; gap: 14px; }
.f { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.f > span:first-child { color: var(--muted); font-weight: 600; }
.inp { border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; font-size: 14px; background: var(--bg); color: var(--text); width: 100%; font-family: inherit; }
.icons { display: flex; gap: 6px; flex-wrap: wrap; }
.icons button { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; }
.icons .on { border: 2px solid var(--teal); background: var(--brand-soft); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill2 { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 600; }
.pill2.on { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.mem { display: grid; gap: 6px; }
.opt { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; border: 1px solid var(--line); border-radius: 13px; padding: 9px 11px; cursor: pointer; }
.opt.on { border-color: var(--green); background: var(--green-soft); }
.radio { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--faint); margin-top: 2px; flex-shrink: 0; }
.opt.on .radio { border: 5px solid var(--green); }
.opt small { display: block; color: var(--muted); margin-top: 2px; }
.ready { margin: 0 22px 16px; padding: 14px; border-radius: 16px; background: var(--green-soft); border: 1px solid rgba(7, 168, 105, .3); font-size: 13px; line-height: 1.9; }
.ready b { color: var(--green); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 800; letter-spacing: 2px; direction: ltr; display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; margin: 4px 0; }
.dlg .act { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days button { font-size: 12px; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.days .on { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 700; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 13px; z-index: 30; max-width: 90vw; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .top { padding: 12px 16px; } .top .sub, .top .pill, #btn-logout { display: none; }
  main { padding: 18px 14px 40px; }
  .hello h1 { font-size: 23px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; } .stat .si { width: 36px; height: 36px; font-size: 16px; } .stat b { font-size: 20px; }
  .svcs, .live { grid-template-columns: 1fr 1fr; }
  .f { grid-template-columns: 1fr; gap: 6px; }
}
