/* هوية موقع حجز الشاشات — مدرسة نجد الثانوية */
:root{
  --ground:#EEF5F3; --surface:#FFFFFF; --ink:#14231F; --muted:#5D6E69; --line:#E1EBE8; --soft:#E8F2EF;
  --accent:#11977F; --accent-ink:#0B7563; --accent-soft:#E1F3EE; --accent-line:#BEE2D8;
  --grad:linear-gradient(145deg,#1DB59A 0%,#11977F 52%,#0B7A67 100%);
  --good:#178A57; --good-soft:#E2F4EA; --bad:#B3261E; --bad-soft:#FBE9E7; --warn:#8A5300; --warn-soft:#FFF3DC;
  --blue:#2E7DBA; --blue-soft:#E4EFF8;
  --navy:#0C4D44; --navy-2:#0F5F53; --navy-ink:#D8EEE9;
  --shadow:0 6px 22px rgba(12,77,68,.08);
  --font:'IBM Plex Sans Arabic', Tahoma, 'Segoe UI', sans-serif;
  --display:'Readex Pro', 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  color-scheme: light;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--ground);color:var(--ink);font-family:var(--font);font-size:15px;line-height:1.6;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.display{font-family:var(--display);font-weight:600}
.muted{color:var(--muted)}
.eyebrow{font-size:12px;color:var(--muted)}
.link{background:none;border:0;color:var(--accent);font-size:13px;padding:10px 4px}
[hidden]{display:none!important}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* ===== المعلم ===== */
body.teacher{min-height:100dvh}
.phone{max-width:560px;margin:0 auto;min-height:100dvh;display:flex;flex-direction:column}

/* الترويسة المتدرجة */
.hero{background:var(--grad);color:#fff;padding:calc(18px + env(safe-area-inset-top,0px)) 20px 22px;border-radius:0 0 28px 28px;display:flex;flex-direction:column;gap:16px;position:relative;overflow:hidden;box-shadow:0 10px 30px rgba(11,122,103,.25)}
.hero::after{content:"";position:absolute;inset:auto -60px -90px auto;width:220px;height:220px;border-radius:50%;background:rgba(255,255,255,.08);pointer-events:none}
.hero::before{content:"";position:absolute;inset:-70px auto auto -50px;width:180px;height:180px;border-radius:50%;background:rgba(255,255,255,.06);pointer-events:none}
.hero > *{position:relative;z-index:1}
.hero-top{display:flex;align-items:center;gap:12px}
.moe{height:58px;width:auto;background:#fff;border-radius:12px;padding:5px 8px;box-shadow:0 4px 12px rgba(0,0,0,.08)}
.brand-line{display:flex;flex-direction:column;line-height:1.35;flex:1;min-width:0}
.brand-line span{font-weight:600;font-size:14px}
.brand-line small{font-size:12px;color:rgba(255,255,255,.8)}
.icon-btn{width:42px;height:42px;border-radius:12px;border:0;background:rgba(255,255,255,.16);color:#fff;display:inline-flex;align-items:center;justify-content:center}
.icon-btn:hover{background:rgba(255,255,255,.26)}
.hero h1{margin:4px 0 0;font-size:28px}
.hero p{margin:-8px 0 0;color:rgba(255,255,255,.85);font-size:14px}
.search-wrap{display:flex;align-items:center;gap:10px;background:#fff;color:var(--muted);border-radius:14px;padding:0 14px;box-shadow:0 4px 14px rgba(0,0,0,.08)}
.search{font:inherit;font-size:16px;min-height:50px;border:0;outline:0;background:transparent;flex:1;color:var(--ink);width:100%}
.who{display:flex;align-items:center;gap:12px}
.avatar{width:48px;height:48px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-family:var(--display);font-weight:600;font-size:17px;background:rgba(255,255,255,.2);border:2px solid rgba(255,255,255,.55)}
.who > div{display:flex;flex-direction:column;min-width:0}
.tname{font-size:20px;line-height:1.3}
.who small{color:rgba(255,255,255,.85);font-size:13px}
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:4px;padding:4px;background:rgba(255,255,255,.16);border-radius:14px}
.seg button{border:0;border-radius:11px;padding:8px 6px;background:transparent;color:#fff;display:flex;flex-direction:column;align-items:center}
.seg button b{font-size:14px;font-weight:600}
.seg button small{font-size:11.5px;opacity:.85}
.seg button[aria-selected="true"]{background:#fff;color:var(--accent-ink);box-shadow:0 2px 8px rgba(0,0,0,.08)}
.seg button[aria-selected="true"] small{color:var(--muted);opacity:1}

/* مربعات الملخص */
.tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:18px 20px 0}
.tile{background:var(--surface);border-radius:16px;padding:12px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:2px;min-width:0}
.tile .ti{width:36px;height:36px;border-radius:11px;display:inline-flex;align-items:center;justify-content:center;margin-bottom:6px}
.tile b{font-family:var(--display);font-size:22px;line-height:1.1;font-variant-numeric:tabular-nums}
.tile small{font-size:11.5px;color:var(--muted);line-height:1.35}
.tile.t1 .ti{background:var(--accent-soft);color:var(--accent)}
.tile.t2 .ti{background:var(--blue-soft);color:var(--blue)}
.tile.t3 .ti{background:var(--good-soft);color:var(--good)}

.nowline{margin:18px 22px 2px;display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
.nowline .dot{width:8px;height:8px;border-radius:50%;background:var(--accent);flex:none;box-shadow:0 0 0 4px var(--accent-soft)}
.list{flex:1;padding:10px 20px 24px;display:flex;flex-direction:column;gap:10px}
.empty{background:var(--surface);border-radius:16px;padding:28px 20px;text-align:center;color:var(--muted);box-shadow:var(--shadow)}
.empty b{display:block;color:var(--ink);font-size:16px;margin-bottom:4px}

/* بطاقة الحصة */
.card{background:var(--surface);border-radius:16px;padding:12px;display:flex;flex-direction:column;gap:10px;box-shadow:var(--shadow);animation:rise .25s ease-out both}
@keyframes rise{from{transform:translateY(6px);opacity:.4}to{transform:none;opacity:1}}
.card .row{display:flex;gap:12px;align-items:center}
.pnum{width:50px;height:50px;flex:none;border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--accent-soft);color:var(--accent)}
.pnum b{font-family:var(--display);font-size:20px;font-weight:600;line-height:1}
.pnum small{font-size:10px;opacity:.8}
.what{flex:1;min-width:0;display:flex;flex-direction:column}
.what b{font-size:15px;font-weight:600}
.what small{font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.pill{font:inherit;font-size:11.5px;font-weight:600;padding:5px 10px;border-radius:999px;white-space:nowrap;border:0}
.pill.good{color:var(--good);background:var(--good-soft)}
.pill.mine{color:#fff;background:var(--accent)}
.pill.full{color:var(--muted);background:var(--soft);cursor:pointer}
.pill.live{color:var(--blue);background:var(--blue-soft)}
.pill.muted-pill{color:var(--muted);background:var(--soft)}
.card.ended{opacity:.6;box-shadow:none}
.card.ended .pnum{background:var(--soft);color:var(--muted)}
.card.running{outline:2px solid var(--blue-soft)}
.card.running .pnum{background:var(--blue-soft);color:var(--blue)}
.card.full .pnum{background:var(--soft);color:var(--muted)}
.card.mine{background:linear-gradient(0deg,var(--accent-soft),var(--accent-soft)),var(--surface);outline:1px solid var(--accent-line)}
.card.mine .pnum{background:var(--accent);color:#fff}
.note{font-size:12px;color:var(--accent-ink);padding-inline-start:62px}
.btn{border:0;border-radius:12px;min-height:46px;padding:0 18px;font-size:15px;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
.btn.primary{background:var(--grad);color:#fff;box-shadow:0 6px 16px rgba(17,151,127,.28)}
.btn.primary:hover{filter:brightness(1.05)}
.btn.dark{background:var(--ink);color:#fff}
.btn.ghost{background:var(--surface);color:var(--accent);border:1px solid var(--accent)}
.btn.danger-ghost{background:transparent;color:var(--bad);border:1px solid #E7B9B5}
.btn[disabled]{opacity:.6;cursor:wait}
.btn.small{min-height:40px;font-size:13.5px;padding:0 14px}
.card .btn.primary{width:100%}
.mine-actions{display:flex;justify-content:flex-end}

.bottom{position:sticky;bottom:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));background:var(--surface);border-top:1px solid var(--line);padding:6px 12px calc(10px + env(safe-area-inset-bottom,0px));box-shadow:0 -6px 20px rgba(12,77,68,.06)}
.nav{background:none;border:0;display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px;color:var(--muted);font-size:12.5px}
.nav.on{color:var(--accent);font-weight:600}

.section-title{font-size:14px;font-weight:600;color:var(--ink);margin:6px 2px 0}

/* اختيار الاسم */
.pick{max-width:560px;margin:0 auto;min-height:100dvh;display:flex;flex-direction:column}
.pick-body{padding:18px 20px 32px;display:flex;flex-direction:column;gap:12px}
.names{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.names .empty-li{grid-column:1/-1}
.names button{width:100%;height:100%;text-align:start;background:var(--surface);border:0;border-radius:16px;padding:12px;display:flex;align-items:center;gap:10px;box-shadow:var(--shadow);transition:transform .15s ease, box-shadow .15s ease}
.names button:hover{transform:translateY(-2px);box-shadow:0 10px 26px rgba(12,77,68,.12)}
.names .avatar{width:42px;height:42px;font-size:15px;border:0}
.names .nm{display:flex;flex-direction:column;min-width:0}
.names .nm b{font-size:14px;font-weight:600;line-height:1.35}
.names .nm small{font-size:11.5px;color:var(--muted);line-height:1.35;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
@media (max-width:340px){.names{grid-template-columns:1fr}}

/* النافذة السفلية */
.sheet-wrap{position:fixed;inset:0;z-index:20;display:flex;align-items:flex-end;justify-content:center}
.scrim{position:absolute;inset:0;background:rgba(10,40,35,.5)}
.sheet{position:relative;width:100%;max-width:560px;background:var(--surface);border-radius:24px 24px 0 0;padding:12px 22px calc(26px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:16px;animation:up .22s ease-out}
@keyframes up{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
.grip{align-self:center;width:40px;height:4px;border-radius:4px;background:#D3DEDB}
.sheet-head{display:flex;gap:14px;align-items:center}
.sheet-head h2{margin:0;font-size:20px}
.sheet-head .muted{font-size:13.5px}
.badge-icon{width:50px;height:50px;flex:none;border-radius:16px;display:flex;align-items:center;justify-content:center}
.badge-icon.bad{background:var(--bad-soft);color:var(--bad)}
.badge-icon.good{background:var(--good-soft);color:var(--good)}
.badge-icon.ask{background:var(--accent-soft);color:var(--accent)}
.sheet p{margin:0;line-height:1.7}
.taken{list-style:none;margin:0;padding:0;border:1px solid var(--line);border-radius:14px}
.taken li{display:flex;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line);font-size:13.5px}
.taken li:last-child{border-bottom:0}
.taken li b{font-size:14px}
.sheet-actions{display:flex;flex-direction:column;gap:8px}
.sheet-actions .btn{width:100%}

.toast{position:fixed;bottom:calc(84px + env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 18px;border-radius:12px;font-size:14px;z-index:30;max-width:calc(100% - 32px)}

/* ===== أمين المصادر ===== */
body.admin{min-height:100dvh}
.shell{display:flex;flex-wrap:wrap;min-height:100dvh}
.side{flex:1 1 220px;max-width:100%;background:linear-gradient(180deg,#0F6A5C,#0A4A41);color:var(--navy-ink);padding:28px 18px;display:flex;flex-direction:column;gap:24px}
.brand{display:flex;flex-direction:column;gap:2px;padding-inline:10px}
.brand .moe{align-self:flex-start;margin-bottom:10px}
.login-logo{align-self:flex-start;border:1px solid var(--line)}
.login{background:var(--grad)}
.login form{box-shadow:0 20px 50px rgba(0,0,0,.18)}
.brand b{font-family:var(--display);font-size:19px;font-weight:600;color:#fff}
.brand small{font-size:12.5px;color:#A8D6CC}
.menu{display:flex;flex-direction:column;gap:4px}
.menu a,.menu button{display:block;text-align:start;text-decoration:none;color:var(--navy-ink);padding:11px 12px;border-radius:10px;font-size:14.5px;background:none;border:0;width:100%}
.menu a[aria-current="page"]{background:rgba(255,255,255,.16);color:#fff;font-weight:600}
.menu a.soon{opacity:.55}
.menu a.soon small{font-size:11px;margin-inline-start:6px}
.side-foot{margin-top:auto;padding:12px;border-radius:10px;background:var(--navy-2);font-size:12.5px;color:#B7C0D6;display:flex;flex-direction:column;gap:2px}
.side-foot b{color:#fff}
.content{flex:999 1 560px;min-width:0;padding:28px clamp(16px,3vw,32px) 40px;display:flex;flex-direction:column;gap:22px}
.page-head{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between;align-items:flex-end}
.page-head h1{margin:0;font-size:30px}
.page-head .date-nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.date-nav input{font:inherit;min-height:42px;padding:0 10px;border:1px solid #C9D0DC;border-radius:10px;background:var(--surface)}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.kpi{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:16px 18px;display:flex;flex-direction:column;gap:2px}
.kpi span{font-size:13px;color:var(--muted)}
.kpi b{font-family:var(--display);font-size:24px;font-weight:600;font-variant-numeric:tabular-nums}
.kpi small{font-size:12.5px;color:var(--muted)}
.kpi.warn{background:var(--warn-soft)}
.kpi.warn span,.kpi.warn b,.kpi.warn small{color:var(--warn)}
.kpi.good b{color:var(--good)}
.cols{display:flex;flex-wrap:wrap;gap:20px;align-items:flex-start}
.panel{background:var(--surface);border-radius:18px;box-shadow:var(--shadow);padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}
.panel h2{margin:0;font-size:17px;font-weight:600}
.panel.grid{flex:999 1 520px}
.panel.feed{flex:1 1 260px}
.scroll{overflow-x:auto}
table.slots{width:100%;min-width:520px;border-collapse:separate;border-spacing:0 6px;font-size:14px}
table.slots th{text-align:start;font-weight:500;color:var(--muted);font-size:12.5px;padding:0 10px}
table.slots td{padding:0}
.pcell{padding:10px;white-space:nowrap}
.pcell small{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums}
tr.current .pcell{color:var(--accent)}
tr.ended{opacity:.5}
.cell{width:100%;text-align:start;border:0;padding:10px;background:#F5F6F9;border-radius:10px;min-height:44px;display:flex;flex-wrap:wrap;gap:4px 6px;align-items:center}
.cell small{color:var(--muted);font-size:12.5px}
.cell.free{background:var(--good-soft);color:var(--good);font-weight:600}
.cell.free:hover{background:#D3EDDF}
.cell.closed{background:#F5F6F9;color:var(--muted);cursor:default}
tr.current .cell{background:var(--accent-soft)}
tr.current .cell.free{background:var(--good-soft)}
.cell .tag{font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:999px}
.tag.urgent{color:var(--warn);background:var(--warn-soft)}
.tag.back{color:var(--muted);background:var(--soft)}
.breakrow td{padding:2px 10px;font-size:12px;color:var(--muted)}
.feed ul{list-style:none;margin:0;padding:0}
.feed li{padding:12px 0;border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:2px}
.feed li:last-child{border-bottom:0}
.feed .fr{display:flex;justify-content:space-between;gap:8px}
.feed .fr b{font-size:14px}
.feed .fr small,.feed .sub{font-size:13px;color:var(--muted)}
.feed .tag{align-self:flex-start}
.closed-day{background:var(--surface);border-radius:16px;padding:32px;text-align:center;color:var(--muted)}
.closed-day b{display:block;color:var(--ink);font-size:18px;margin-bottom:4px}

/* الدخول */
.login{min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px 16px}
.login form{background:var(--surface);border-radius:18px;padding:28px;width:100%;max-width:380px;display:flex;flex-direction:column;gap:14px}
.login h1{margin:0 0 4px;font-size:24px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:13px;font-weight:600}
.field input,.field select{font:inherit;font-size:15px;min-height:46px;padding:0 12px;border:1px solid #C9D0DC;border-radius:10px;background:var(--surface);width:100%}
.err{color:var(--bad);font-size:13.5px;margin:0}

/* نافذة الحجز (أمين المصادر) */
.modal-wrap{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:16px}
.modal{position:relative;background:var(--surface);border-radius:18px;padding:22px;width:100%;max-width:440px;display:flex;flex-direction:column;gap:14px;max-height:calc(100dvh - 32px);overflow:auto}
.modal h2{margin:0;font-size:19px}
#modal-body{display:flex;flex-direction:column;gap:12px}
.opts{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.opts button{width:100%;text-align:start;border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:10px 12px;display:flex;justify-content:space-between;gap:8px;min-height:46px;align-items:center}
.opts button:hover{border-color:var(--accent);background:var(--accent-soft)}
.opts button[disabled]{opacity:.5;cursor:not-allowed}
.opts small{color:var(--muted);font-size:12.5px}
.row-actions{display:flex;gap:8px;flex-wrap:wrap}
.row-actions .btn{flex:1}
