:root{
  --bg:#070c18;--bg2:#0b1324;--panel:#0f1a30;--panel2:#13203b;--line:rgba(212,175,55,.16);--line2:rgba(255,255,255,.07);
  --gold:#d4af37;--gold2:#f3d77a;--gold3:#a8822a;--text:#e8ebf2;--muted:#8d97ad;--red:#e0574f;--ok:#4caf7a;
  --goldgrad:linear-gradient(135deg,#f3d77a,#d4af37 45%,#a8822a);
  --side:270px;--r:14px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:Tajawal,Tahoma,sans-serif;background:var(--bg);color:var(--text);line-height:1.7;
  background-image:radial-gradient(1200px 600px at 100% -10%,rgba(212,175,55,.07),transparent 60%),
  repeating-linear-gradient(45deg,rgba(255,255,255,.012) 0 2px,transparent 2px 14px)}
a{color:var(--gold2)}
h1,h2,h3,.kufi{font-family:"El Messiri",Tajawal,sans-serif;font-weight:700;letter-spacing:.2px}
h2{font-size:24px;margin:0 0 18px;display:flex;align-items:center;gap:10px}
h2::before{content:"";width:6px;height:24px;background:var(--goldgrad);border-radius:3px}
.card h3{margin:0 0 14px;color:var(--gold2);font-size:18px}

/* ===== القائمة الجانبية ===== */
#side{position:fixed;top:0;bottom:0;right:0;width:var(--side);background:linear-gradient(180deg,#0c1529,#070c18);
  border-left:1px solid var(--line);display:none;flex-direction:column;z-index:30;overflow-y:auto}
body.authed #side{display:flex}
body.authed #wrap{margin-right:var(--side)}
.side-head{padding:22px 20px;text-align:center;border-bottom:1px solid var(--line)}
.side-head img{width:62px;height:62px;filter:drop-shadow(0 4px 14px rgba(212,175,55,.35))}
.side-head .schoolName{display:block;font-family:"El Messiri";font-size:17px;color:var(--gold2);margin-top:6px}
.side-user{margin:16px;padding:14px;border:1px solid var(--line);border-radius:var(--r);background:rgba(212,175,55,.04);display:flex;gap:12px;align-items:center}
.side-user .ins{width:46px;flex:none}
.side-user b{display:block;font-size:15px}.side-user small{color:var(--muted)}
.side-nav{padding:6px 12px;flex:1}
.side-nav .sec{font-size:11px;color:var(--muted);padding:14px 12px 6px;letter-spacing:1px}
.side-nav a{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:10px;color:#c5cbd9;text-decoration:none;font-weight:500;margin-bottom:2px;position:relative;transition:.15s}
.side-nav a svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;flex:none}
.side-nav a:hover{background:rgba(255,255,255,.04);color:#fff}
.side-nav a.active{background:linear-gradient(90deg,transparent,rgba(212,175,55,.14));color:var(--gold2)}
.side-nav a.active::after{content:"";position:absolute;right:-12px;top:8px;bottom:8px;width:4px;border-radius:4px 0 0 4px;background:var(--goldgrad)}
.side-foot{padding:14px;border-top:1px solid var(--line)}
.side-foot button{width:100%}

/* ===== الشريط العلوي ===== */
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:14px;padding:10px 22px;background:rgba(7,12,24,.86);backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
.pub-brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--gold2);font-family:"El Messiri";font-size:18px;white-space:nowrap}
.pub-brand img{width:38px;height:38px}
body.authed .pub-brand{display:none}
.icon-btn{display:none;background:none;border:1px solid var(--line);color:var(--gold2);border-radius:10px;width:40px;height:40px;font-size:20px;cursor:pointer}
.ticker{flex:1;display:flex;align-items:center;min-width:0;border:1px solid var(--line);border-radius:30px;overflow:hidden;background:rgba(212,175,55,.05);height:38px}
.ticker-label{background:var(--goldgrad);color:#1a1405;font-weight:800;padding:0 16px;height:100%;display:flex;align-items:center;font-size:13px;white-space:nowrap}
.ticker-track{overflow:hidden;flex:1;height:100%;display:flex;align-items:center}
#tickerText{display:inline-block;white-space:nowrap;padding-inline-start:100%;animation:scroll 32s linear infinite;color:var(--gold2);font-weight:500}
.ticker:hover #tickerText{animation-play-state:paused}
@keyframes scroll{to{transform:translateX(100%)}}

main{max-width:1200px;margin:0 auto;padding:26px 22px 70px}
body:not(.authed) main{max-width:none;padding:0}

/* ===== عناصر عامة ===== */
.card{background:linear-gradient(180deg,var(--panel),var(--bg2));border:1px solid var(--line2);border-radius:var(--r);padding:20px;position:relative}
.card.gold-edge{border-color:var(--line)}
.grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.mt{margin-top:18px}.muted{color:var(--muted)}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.stat{display:flex;align-items:center;gap:16px}
.stat .ic{width:52px;height:52px;border-radius:14px;display:grid;place-items:center;background:rgba(212,175,55,.1);border:1px solid var(--line)}
.stat .ic svg{width:26px;height:26px;stroke:var(--gold2);fill:none;stroke-width:1.8}
.stat b{display:block;font-size:30px;font-family:"El Messiri";color:#fff;line-height:1.1}
.stat span{color:var(--muted);font-size:14px}
.btn{background:var(--goldgrad);color:#1a1405;border:0;border-radius:10px;padding:10px 20px;font:inherit;font-weight:800;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:8px;transition:.15s;box-shadow:0 4px 18px rgba(212,175,55,.18)}
.btn:hover{filter:brightness(1.08);transform:translateY(-1px)}
.btn.ghost{background:transparent;color:var(--gold2);border:1px solid var(--line);box-shadow:none}
.btn.danger{background:transparent;color:var(--red);border:1px solid rgba(224,87,79,.4);box-shadow:none}
.btn.sm{padding:4px 12px;font-size:13px;font-weight:700}
input,select,textarea{font:inherit;color:var(--text);padding:10px 12px;border:1px solid var(--line2);border-radius:10px;background:#0a1222;width:100%;transition:.15s}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(212,175,55,.15)}
input[type=checkbox]{width:18px;height:18px;accent-color:var(--gold)}
input[type=date]{color-scheme:dark}
select option{background:#0f1a30}
textarea{min-height:100px}
label{font-size:14px;color:var(--muted);display:block;margin-bottom:12px}
.form-row{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));align-items:end}
details summary{cursor:pointer;color:var(--gold2)}
.table-wrap{overflow-x:auto;border:1px solid var(--line2);border-radius:var(--r)}
table{width:100%;border-collapse:collapse}
th,td{padding:11px 14px;border-bottom:1px solid var(--line2);text-align:right;font-size:14px}
th{background:rgba(212,175,55,.07);color:var(--gold2);font-weight:700;white-space:nowrap}
tr:last-child td{border-bottom:0}
tbody tr:hover,table tr:hover td{background:rgba(255,255,255,.02)}
.badge{display:inline-block;padding:2px 12px;border-radius:20px;font-size:12px;font-weight:700;background:rgba(255,255,255,.06);color:#c5cbd9;border:1px solid var(--line2)}
.badge.rank{background:rgba(212,175,55,.12);color:var(--gold2);border-color:var(--line)}
.badge.neg{background:rgba(224,87,79,.12);color:#ff8a82;border-color:transparent}
.badge.pos{background:rgba(76,175,122,.12);color:#7ed3a4;border-color:transparent}
.tabs{display:flex;gap:8px;margin-bottom:16px;flex-wrap:wrap}
.tabs button{background:transparent;border:1px solid var(--line2);color:#c5cbd9;padding:7px 16px;border-radius:30px;cursor:pointer;font:inherit;font-weight:500}
.tabs button:hover{border-color:var(--line)}
.tabs button.on{background:var(--goldgrad);color:#1a1405;border-color:transparent;font-weight:800}
.notice{border-right:3px solid var(--gold);margin-bottom:14px}
.notice h3{margin:0!important}
.notice small{color:var(--muted)}
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--goldgrad);color:#1a1405;font-weight:800;padding:12px 24px;border-radius:12px;display:none;z-index:99;box-shadow:0 10px 30px rgba(0,0,0,.5)}
#toast.err{background:var(--red);color:#fff}

/* ===== الشارات والرتب ===== */
.ins svg{display:block;width:100%;height:auto}
.rank-card{text-align:center;background:radial-gradient(circle at 50% 0,rgba(212,175,55,.18),transparent 60%),linear-gradient(180deg,#121e38,#0a1222);border:1px solid var(--line)}
.rank-card .ins{width:120px;margin:0 auto 6px}
.rank-card .rank-name{font-family:"El Messiri";font-size:30px;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent}
.progress{height:8px;background:rgba(255,255,255,.08);border-radius:10px;overflow:hidden;margin:12px 0}
.progress div{height:100%;background:var(--goldgrad);border-radius:10px}
.ladder{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:12px}
.ladder .step{text-align:center;padding:14px 8px;border:1px solid var(--line2);border-radius:12px;background:rgba(255,255,255,.02);transition:.2s}
.ladder .step:hover{border-color:var(--gold);transform:translateY(-3px)}
.ladder .step.me{border-color:var(--gold);background:rgba(212,175,55,.08)}
.ladder .ins{width:64px;margin:0 auto 6px}
.ladder b{display:block;color:var(--gold2);font-size:14px}.ladder small{color:var(--muted)}
.mini-ins{display:inline-block;width:26px;vertical-align:middle;margin-left:6px}

/* ===== الجدول والحضور ===== */
.sched td{text-align:center;min-width:100px}
.sched .cell{font-weight:700;color:#fff}.sched .cell small{display:block;color:var(--muted);font-weight:400}
.sched td:hover{background:rgba(212,175,55,.05)}
.att-row{display:flex;align-items:center;gap:10px;padding:10px 4px;border-bottom:1px solid var(--line2);flex-wrap:wrap}
.att-row .nm{flex:1;min-width:150px;font-weight:500}
.period-box{display:inline-flex;gap:4px;flex-wrap:wrap}
.period-box label{margin:0;display:inline-flex;align-items:center;gap:4px;font-size:12px;background:rgba(255,255,255,.04);border:1px solid var(--line2);padding:4px 8px;border-radius:8px;cursor:pointer;color:#c5cbd9}
.period-box label:has(input:checked){border-color:var(--gold);background:rgba(212,175,55,.12);color:var(--gold2)}
.period-box input{width:15px;height:15px}

/* ===== الصفحة الرئيسية العامة ===== */
.hero{min-height:calc(100vh - 60px);display:grid;place-items:center;text-align:center;padding:60px 20px;position:relative;overflow:hidden;
  background:radial-gradient(800px 400px at 50% 30%,rgba(212,175,55,.14),transparent 70%)}
.hero::before{content:"";position:absolute;inset:0;background:repeating-conic-gradient(from 0deg at 50% 38%,rgba(212,175,55,.035) 0 6deg,transparent 6deg 12deg);mask:radial-gradient(circle at 50% 38%,#000 0,transparent 65%)}
.hero-in{position:relative;max-width:820px}
.hero .emblem{width:150px;filter:drop-shadow(0 10px 40px rgba(212,175,55,.4));animation:float 5s ease-in-out infinite}
@keyframes float{50%{transform:translateY(-8px)}}
.hero .eyebrow{color:var(--gold);letter-spacing:4px;font-size:13px;font-weight:700;margin-top:18px}
.hero h1{font-size:clamp(34px,6vw,62px);margin:8px 0;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent;line-height:1.3}
.hero p{color:#b7bfd0;font-size:18px;max-width:640px;margin:0 auto}
.hero .motto{display:inline-block;margin:22px 0;padding:8px 26px;border:1px solid var(--line);border-radius:30px;color:var(--gold2);font-family:"El Messiri";font-size:18px}
.hero .ctas{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
.hero .btn{padding:13px 30px;font-size:16px}
.divider{display:flex;align-items:center;gap:14px;justify-content:center;color:var(--gold);margin-bottom:10px}
.divider::before,.divider::after{content:"";height:1px;width:80px;background:linear-gradient(90deg,transparent,var(--gold))}
.divider::after{transform:scaleX(-1)}
.section{padding:70px 22px;max-width:1200px;margin:0 auto}
.section-title{text-align:center;margin-bottom:36px}
.section-title h2{justify-content:center;font-size:32px;margin:0}
.section-title h2::before{display:none}
.section-title p{color:var(--muted);margin:6px 0 0}
.pillars{display:grid;gap:18px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.pillar{text-align:center;padding:30px 22px}
.pillar .ic{width:64px;height:64px;margin:0 auto 14px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--line);background:rgba(212,175,55,.08)}
.pillar .ic svg{width:30px;height:30px;stroke:var(--gold2);fill:none;stroke-width:1.6}
.pillar h3{color:#fff!important;font-size:20px}
.pillar p{color:var(--muted);margin:0}
.statband{background:linear-gradient(90deg,transparent,rgba(212,175,55,.08),transparent);border-block:1px solid var(--line)}
.statband .in{max-width:1000px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));text-align:center;padding:36px 22px;gap:20px}
.statband b{display:block;font-family:"El Messiri";font-size:46px;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent;line-height:1.2}
.statband span{color:var(--muted)}
.honor{display:grid;gap:14px}
.honor .h{display:flex;align-items:center;gap:16px;padding:14px 18px}
.honor .pos{font-family:"El Messiri";font-size:26px;width:40px;text-align:center;color:var(--muted)}
.honor .h:nth-child(1) .pos{color:var(--gold2)}.honor .h:nth-child(2) .pos{color:#cfd6e4}.honor .h:nth-child(3) .pos{color:#d29a6a}
.honor .ins{width:54px}
.honor .nm{flex:1}.honor .nm b{display:block;font-size:17px}.honor .nm small{color:var(--muted)}
.honor .pts{font-family:"El Messiri";color:var(--gold2);font-size:20px}
footer.site{border-top:1px solid var(--line);padding:40px 22px;text-align:center;color:var(--muted);background:#050912}
footer.site .schoolName{color:var(--gold2);font-family:"El Messiri";font-size:20px;display:block;margin-bottom:6px}

/* ===== تسجيل الدخول ===== */
.login-wrap{min-height:calc(100vh - 60px);display:grid;place-items:center;padding:30px 16px}
.login{width:100%;max-width:420px;text-align:center;padding:36px 30px;border-color:var(--line);box-shadow:0 30px 80px rgba(0,0,0,.5)}
.login img{width:84px;filter:drop-shadow(0 6px 20px rgba(212,175,55,.35))}
.login h2{justify-content:center;margin:10px 0 4px}.login h2::before{display:none}
.login form{text-align:right;margin-top:22px}
.login .btn{width:100%;justify-content:center;padding:12px}

.welcome{display:flex;align-items:center;gap:20px;flex-wrap:wrap;background:radial-gradient(500px 200px at 0 0,rgba(212,175,55,.12),transparent),linear-gradient(180deg,var(--panel),var(--bg2));border-color:var(--line)}
.welcome h2{margin:0}.welcome h2::before{display:none}
.welcome .ins{width:70px}

@media (max-width:900px){
  body.authed #wrap{margin-right:0}
  #side{transform:translateX(100%);transition:.25s;display:flex!important;visibility:hidden}
  body.authed #side{visibility:visible}
  body.side-open #side{transform:none}
  body.side-open #scrim{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:25}
  body.authed .icon-btn{display:block}
  .topbar{padding:10px 14px}
  .pub-brand span{display:none}
  main{padding:18px 14px 60px}
}
html,body{overflow-x:clip}
.dash-grid{grid-template-columns:minmax(260px,1.2fr) 1fr}
.grid.one{grid-template-columns:1fr}
@media (max-width:900px){
  .dash-grid{grid-template-columns:1fr}
  .welcome{gap:12px}.welcome details{width:100%}
  .welcome .ins{width:54px}
  .stat b{font-size:26px}
}
/* ===== التنبيهات ===== */
#topRight{position:relative}
.icon-btn.bell{display:grid!important;place-items:center;position:relative}
.icon-btn.bell svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8}
#bellCount{position:absolute;top:-6px;left:-6px;background:var(--red);color:#fff;font-size:11px;font-weight:800;min-width:19px;height:19px;border-radius:10px;display:grid;place-items:center;padding:0 4px}
#alertsPanel{position:absolute;left:0;top:50px;width:min(360px,calc(100vw - 28px));max-height:70vh;overflow-y:auto;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);box-shadow:0 20px 50px rgba(0,0,0,.6);z-index:50}
.ap-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--panel)}
.ap-item{display:block;padding:12px 16px;border-bottom:1px solid var(--line2);text-decoration:none;color:var(--text)}
.ap-item:hover{background:rgba(255,255,255,.03)}
.ap-item.new{background:rgba(212,175,55,.07);border-right:3px solid var(--gold)}
.ap-item b{display:block;font-size:14px}.ap-item span{display:block;color:#c5cbd9;font-size:13px}.ap-item small{color:var(--muted);font-size:11px}
/* ===== الأخبار ===== */
.news-grid{display:grid;gap:18px;grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}
.card.news{padding:0;overflow:hidden;display:flex;flex-direction:column}
.card.news img{width:100%;aspect-ratio:16/10;object-fit:cover;display:block;border-bottom:1px solid var(--line)}
.card.news .nb{padding:16px 18px}.card.news h3{color:#fff!important;margin:4px 0 6px!important}
.card.news p{color:#b7bfd0;margin:0 0 10px;white-space:pre-wrap;font-size:14px}.card.news small{color:var(--gold)}
/* ===== التقرير ===== */
.report h3{margin-top:20px!important}
.rep-head{display:flex;align-items:center;gap:14px;padding-bottom:14px;border-bottom:2px solid var(--gold);margin-bottom:16px}
.rep-head img{width:54px}.rep-head>div{flex:1}.rep-head b{font-size:20px;color:var(--gold2)}.rep-head .ins{width:48px}
.rep-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.rep-grid>div{border:1px solid var(--line2);border-radius:10px;padding:10px 12px}
.rep-grid small{display:block;color:var(--muted);font-size:12px}.rep-grid b{font-size:17px}
.rep-sign{display:flex;justify-content:space-around;margin-top:40px;color:var(--muted)}
.rep-sign span{border-top:1px dashed var(--muted);padding-top:6px;min-width:160px;text-align:center}
@media print{
  #side,.topbar,.no-print,#toast{display:none!important}
  body,body.authed #wrap{background:#fff!important;color:#000;margin:0!important}
  main{padding:0!important;max-width:none}
  .report{background:#fff!important;border:0!important;page-break-after:always;color:#000;padding:0!important;margin:0!important}
  .report *{color:#000!important;border-color:#bbb!important}
  .rep-head{border-color:#000!important}
  .badge,th{background:#f2f2f2!important}
}
#bellCount[hidden]{display:none}
/* الكتّافيات (الشكل الأول) */
.ladder{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))}
.ladder .ins{width:74px}
.rank-card .ins{width:120px}
.side-user .ins{width:46px}
.welcome .ins{width:70px}
.honor .ins{width:54px}
.rep-head .ins{width:48px}
.mini-ins{width:26px}
@media (max-width:900px){.welcome .ins{width:54px}}
.subj-box{display:flex;flex-wrap:wrap;gap:6px}
.subj-box label{margin:0;display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border:1px solid var(--line2);border-radius:20px;cursor:pointer;color:#c5cbd9;font-size:13px}
.subj-box label:has(input:checked){border-color:var(--gold);background:rgba(212,175,55,.12);color:var(--gold2)}
.subj-box input{width:15px;height:15px}
[hidden]{display:none!important}
optgroup{background:#0f1a30;color:var(--gold2)}

/* ===== التجاوب مع كل الشاشات ===== */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{padding-bottom:env(safe-area-inset-bottom)}
.topbar{padding-top:max(10px,env(safe-area-inset-top))}
img,svg{max-width:100%}
button,a,label,summary{-webkit-tap-highlight-color:transparent}
.welcome details{max-width:100%}
.welcome details form{min-width:0!important;width:min(260px,100%)}
.sched-cards{display:none}
.day-card{padding:0;margin-bottom:10px;overflow:hidden}
.day-card summary{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;list-style:none;cursor:pointer}
.day-card summary::-webkit-details-marker{display:none}
.day-card summary b{color:var(--gold2);font-size:17px}
.day-card[open] summary{border-bottom:1px solid var(--line)}
.lesson{display:grid;grid-template-columns:34px 1fr;grid-template-rows:auto auto;column-gap:12px;padding:10px 18px;border-bottom:1px solid var(--line2);cursor:pointer}
.lesson:last-child{border-bottom:0}
.lesson .num{grid-row:span 2;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:rgba(212,175,55,.12);color:var(--gold2);font-weight:800;align-self:center}
.lesson .sub{font-weight:700}.lesson small{color:var(--muted)}
.table-wrap{-webkit-overflow-scrolling:touch}
/* شاشات كبيرة جداً */
@media (min-width:1600px){main{max-width:1400px}}
/* أجهزة لوحية */
@media (max-width:1024px){
  .dash-grid{grid-template-columns:1fr}
  .grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
}
/* جوالات */
@media (max-width:700px){
  input,select,textarea{font-size:16px}
  h2{font-size:21px}
  .card{padding:16px}
  .sched-wrap{display:none}
  .sched-cards{display:block}
  .table-wrap table{min-width:560px}
  th,td{padding:9px 10px;white-space:nowrap}
  .tabs{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tabs button{flex:none}
  .rep-grid{grid-template-columns:1fr 1fr}
  .rep-head b{font-size:16px}
  .rep-sign span{min-width:120px}
  .period-box label{padding:7px 10px;font-size:13px}
  .period-box input{width:18px;height:18px}
  .att-row .nm{min-width:100%}
  .form-row{grid-template-columns:1fr}
  .hero{min-height:auto;padding:50px 18px}
  .hero .emblem{width:110px}
  .hero p{font-size:16px}
  .section{padding:48px 16px}
  .section-title h2{font-size:26px}
  .statband b{font-size:36px}
  .statband .in{grid-template-columns:1fr 1fr}
  .stat .ic{width:44px;height:44px}
  .ticker-label{padding:0 10px}
  .btn{min-height:42px}
  .btn.sm{min-height:32px}
  #alertsPanel{position:fixed;top:64px;left:10px;right:10px;width:auto}
}
@media (max-width:380px){
  .rep-grid{grid-template-columns:1fr}
  .ladder{grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}
}
/* عند الطباعة لا تظهر بطاقات الجوال */
@media print{.sched-cards{display:none!important}.sched-wrap{display:block!important}}
/* ===== شريط التمرير بلون التصميم ===== */
:root{color-scheme:dark}
html{scrollbar-width:thin;scrollbar-color:rgba(212,175,55,.45) transparent}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#f3d77a,#a8822a);border-radius:8px;border:2px solid var(--bg)}
::-webkit-scrollbar-thumb:hover{background:#d4af37}
::-webkit-scrollbar-button{display:none;width:0;height:0}
::-webkit-scrollbar-corner{background:transparent}

/* ===== القائمة الجانبية: الخروج ظاهر دائماً والروابط فقط تتمرر ===== */
#side{height:100vh;height:100dvh;overflow:hidden;bottom:auto}
.side-head,.side-user,.side-foot{flex:none}
.side-nav{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(212,175,55,.35) transparent;
  -webkit-mask:linear-gradient(transparent,#000 10px,#000 calc(100% - 14px),transparent);mask:linear-gradient(transparent,#000 10px,#000 calc(100% - 14px),transparent)}
.side-nav::-webkit-scrollbar{width:4px}
.side-foot{padding-bottom:max(14px,env(safe-area-inset-bottom));background:#070c18}
@media (max-height:760px){
  .side-head{padding:12px 16px;display:flex;align-items:center;gap:10px;text-align:right}
  .side-head img{width:38px;height:38px}
  .side-head .schoolName{margin:0;font-size:15px}
  .side-user{margin:10px 12px;padding:10px}
  .side-nav a{padding:8px 14px}
  .side-nav .sec{padding:8px 12px 4px}
}

/* ===== نظام التحفيز ===== */
a.plain{color:inherit;text-decoration:none}a.plain:hover{color:var(--gold2)}
a.card.plain:hover{border-color:var(--line)}
.avatar{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:50%;object-fit:cover;background:linear-gradient(135deg,#1c2b4d,#0e1830);border:2px solid var(--gold);color:var(--gold2);font-weight:800;font-size:18px;flex:none}
.avatar.lg{width:96px;height:96px;font-size:38px;border-width:3px}
.avatar.xl{width:120px;height:120px;font-size:48px;border-width:3px;box-shadow:0 0 0 6px rgba(212,175,55,.12),0 10px 30px rgba(0,0,0,.4)}
.ic.fire,.ic.coin{font-size:24px;color:var(--gold2)}
.profile-head{display:flex;align-items:center;gap:22px;flex-wrap:wrap;background:radial-gradient(600px 220px at 100% 0,rgba(212,175,55,.14),transparent),linear-gradient(180deg,var(--panel),var(--bg2));border-color:var(--line)}
.ph-avatar{position:relative}
.ph-cam{position:absolute;bottom:0;left:0;width:36px;height:36px;border-radius:50%;background:var(--goldgrad);display:grid;place-items:center;cursor:pointer;margin:0;font-size:16px;box-shadow:0 4px 10px rgba(0,0,0,.4)}
.ph-main{flex:1;min-width:220px}.ph-main h2{margin-bottom:8px}.ph-main h2::before{display:none}
.ph-ins{width:64px}
.motto-badge{color:var(--gold2);font-family:"El Messiri";font-size:15px}
.prof-stats{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.medals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:14px}
.medal{text-align:center;padding:10px 6px;border-radius:12px;border:1px solid var(--line2);background:rgba(255,255,255,.02);transition:.2s}
.medal:not(.locked):hover{transform:translateY(-4px);border-color:var(--gold)}
.medal .medal-ic{width:58px;margin:0 auto 6px;position:relative;filter:drop-shadow(0 4px 8px rgba(0,0,0,.4))}
.medal.locked{opacity:.55}.medal.locked .medal-ic{filter:grayscale(1)}
.medal b{display:block;font-size:13px;color:var(--gold2)}.medal.locked b{color:var(--muted)}
.medal small{display:block;color:var(--muted);font-size:11px;line-height:1.5;margin-top:2px}
.mcount{position:absolute;top:-4px;left:-6px;background:var(--red);color:#fff;font-size:11px;font-weight:800;border-radius:10px;padding:0 6px}
.timeline{display:flex;flex-direction:column;gap:10px;border-right:2px solid var(--line);padding-right:16px;margin-right:6px}
.tl{display:flex;align-items:center;gap:14px;position:relative}
.tl::before{content:"";position:absolute;right:-23px;width:12px;height:12px;border-radius:50%;background:var(--goldgrad)}
.tl .ins{width:34px}.tl>div{flex:1}.tl b{display:block;color:var(--gold2)}.tl small{color:var(--muted)}
.ch-grid,.store-grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
.card.ch{position:relative;padding-top:24px}
.card.ch h3{color:#fff!important;padding-left:60px}.card.ch p{color:#b7bfd0;margin:0 0 8px;white-space:pre-wrap}
.card.ch.done{border-color:rgba(76,175,122,.5)}
.ch-pts{position:absolute;top:16px;left:16px;background:var(--goldgrad);color:#1a1405;font-weight:800;border-radius:20px;padding:2px 12px}
.wallet{display:flex;align-items:center;gap:18px;flex-wrap:wrap;border-color:var(--line);background:radial-gradient(400px 160px at 100% 0,rgba(212,175,55,.16),transparent),linear-gradient(180deg,var(--panel),var(--bg2))}
.wallet .coin-big{width:64px;height:64px;border-radius:50%;background:var(--goldgrad);display:grid;place-items:center;color:#5a4208;font-size:30px;box-shadow:0 6px 20px rgba(212,175,55,.35)}
.wallet b{display:block;font-size:34px;font-family:"El Messiri";color:var(--gold2);line-height:1}.wallet p{flex-basis:100%;margin:0}
.card.reward{display:flex;flex-direction:column}.card.reward h3{color:#fff!important;margin-bottom:4px!important}
.card.reward p{color:#b7bfd0;flex:1;margin:0 0 10px}.card.reward.off{opacity:.5}
.rw-ic{font-size:34px}.price{font-family:"El Messiri";font-size:20px;color:var(--gold2);font-weight:700}
.btn[disabled]{opacity:.45;cursor:not-allowed;transform:none;filter:grayscale(.5)}
.honor-grid{display:grid;gap:22px;grid-template-columns:repeat(auto-fit,minmax(260px,360px));justify-content:center}
.honor-card{text-align:center;padding:34px 20px 24px;border-color:var(--line);background:radial-gradient(300px 180px at 50% 0,rgba(212,175,55,.2),transparent),linear-gradient(180deg,var(--panel),var(--bg2))}
.hc-tag{position:absolute;top:-14px;left:50%;transform:translateX(-50%);background:var(--goldgrad);color:#1a1405;font-weight:800;padding:4px 18px;border-radius:20px;white-space:nowrap}
.honor-card .hc-ins{width:40px;margin:-24px auto 6px;position:relative}
.honor-card h3{color:#fff!important;margin:6px 0 2px!important}.honor-card p{color:#b7bfd0;margin:10px 0 0}
/* الشهادة */
.cert{background:#fdfaf0;color:#2a2210;padding:14px;border-radius:6px;max-width:1000px;margin:0 auto;aspect-ratio:1.414;box-shadow:0 20px 60px rgba(0,0,0,.5)}
.cert-in{height:100%;border:3px double #a8822a;outline:1px solid #d4af37;outline-offset:-10px;padding:28px 40px;display:flex;flex-direction:column;align-items:center;text-align:center;justify-content:space-between;
  background:radial-gradient(circle at 50% 45%,rgba(212,175,55,.08),transparent 60%)}
.cert-top{display:flex;align-items:center;gap:12px}.cert-top img{width:58px}
.cert-school{font-family:"El Messiri";font-size:22px;font-weight:700;color:#6b5110}
.cert-title{font-family:"El Messiri";font-size:clamp(28px,5vw,48px);font-weight:700;color:#8a6a14}
.cert-ins{width:70px}
.cert-name{font-family:"El Messiri";font-size:clamp(22px,4vw,38px);font-weight:700;border-bottom:2px solid #d4af37;padding:0 30px 4px}
.cert-body{font-size:clamp(14px,2vw,19px);line-height:2}.cert-rank{font-family:"El Messiri";font-size:1.5em;color:#8a6a14}
.cert-foot{display:flex;justify-content:space-between;width:100%;font-size:14px;color:#6b5110}
/* احتفال الترقية */
.celebrate{position:fixed;inset:0;z-index:200;display:grid;place-items:center;background:radial-gradient(circle,rgba(20,30,55,.97),rgba(3,6,14,.99));animation:fadeIn .4s;overflow:hidden;padding:20px}
.celebrate.out{opacity:0;transition:.4s}
@keyframes fadeIn{from{opacity:0}}
.confetti i{position:absolute;top:-20px;width:9px;height:14px;border-radius:2px;animation:fall linear infinite}
@keyframes fall{to{top:110%;transform:rotate(720deg) translateX(40px)}}
.cel-box{position:relative;text-align:center;max-width:420px}
.cel-sub{color:var(--gold);letter-spacing:2px;font-weight:700;animation:fadeIn 1s}
.cel-ins{width:130px;margin:18px auto;animation:pop 1s cubic-bezier(.2,1.6,.4,1) both;filter:drop-shadow(0 0 30px rgba(212,175,55,.6))}
@keyframes pop{0%{transform:scale(0) rotate(-20deg)}100%{transform:none}}
.cel-rank{font-family:"El Messiri";font-size:46px;font-weight:700;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent;animation:fadeIn 1.4s}
.cel-box p{color:#c5cbd9}
@media (max-width:700px){
  .profile-head{justify-content:center;text-align:center}.profile-head .row{justify-content:center}
  .ph-ins{display:none}
  .medals-grid{grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}
  .cert{aspect-ratio:auto}.cert-in{padding:20px 14px;gap:14px}
}
@media print{
  .cert{box-shadow:none;max-width:none;width:100%;aspect-ratio:auto;height:100vh;padding:0}
  .cert *{color:inherit}

}

/* =====================================================================
   المطبوعات: الشهادة الرسمية (A4 أفقي) والتقرير الشهري (A4 عمودي)
   ===================================================================== */
.print-bar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:16px}
.print-bar .muted{font-size:13px}
/* ---------- الشهادة ---------- */
.cert-wrap{container-type:inline-size;max-width:1123px;margin:0 auto}
.cert2{position:relative;width:100%;aspect-ratio:297/210;color:#2b2210;font-family:Amiri,serif;overflow:hidden;box-shadow:0 25px 70px rgba(0,0,0,.55);border-radius:4px;
  -webkit-print-color-adjust:exact;print-color-adjust:exact;font-size:calc(1.6cqi * var(--k,1))}
.cert2 .cert-frame{position:absolute;inset:0;width:100%;height:100%}
.cert2>div{position:absolute;left:0;right:0;text-align:center}
.c-head-r{right:13%!important;left:auto!important;top:9.5%;text-align:right!important;font-size:.95em;line-height:1.55;color:#4a3a14}
.c-head-r .big{font-weight:700;font-size:1.08em;color:#14213d}
.c-head-l{left:13%!important;right:auto!important;top:9.5%;text-align:left!important;font-size:.85em;line-height:1.75;color:#4a3a14}
.c-head-l b{color:#14213d}
.c-emblem{top:8%;display:flex;justify-content:center;align-items:flex-end;gap:.4em}
.c-emblem img{width:5em;filter:drop-shadow(0 .2em .4em rgba(0,0,0,.25))}
.laurel{width:2.4em;height:4.2em}.laurel.r{transform:scaleX(-1)}
.c-title{top:19.5%;font-family:"Aref Ruqaa",Amiri,serif;font-weight:700;font-size:4.2em;line-height:1.1;
  background:linear-gradient(180deg,#d9b24a 0%,#9c7419 55%,#6e500c 100%);-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 .03em 0 rgba(255,255,255,.6))}
.c-sub{top:32%;font-size:1.35em;font-weight:700;color:#14213d;letter-spacing:.05em}
.c-sub span{color:#b8892b;font-size:.8em;margin:0 .4em}
.c-to{top:38%;font-size:1.05em;color:#5a4818}
.c-name{top:42%;font-size:2.7em;font-weight:700;color:#14213d;line-height:1.2}
.c-name::after{content:"";display:block;width:34%;height:.06em;margin:.12em auto 0;background:linear-gradient(90deg,transparent,#b8892b,transparent)}
.c-meta{top:52%;font-size:1em;color:#7a6420}
.c-body{top:56%;left:16%!important;right:16%!important;font-size:1.06em;line-height:1.62;color:#3a2e10}
.c-body b{color:#14213d}
.c-motto{top:70%;bottom:auto;font-size:1em;color:#9c7419;font-style:italic}
.c-foot{top:auto;bottom:11.5%;left:20%!important;right:20%!important;align-items:flex-end;display:flex;justify-content:space-between;align-items:flex-start}
.c-sign{width:30%;text-align:center}
.c-sign-t{font-weight:700;color:#14213d;font-size:1em}
.c-sign-n{min-height:1.4em;font-size:.95em;color:#4a3a14}
.c-line{border-bottom:.08em dotted #6e500c;margin:1.3em .5em .2em}
.c-sign small{font-size:.72em;color:#8a7440}
.c-seal{width:15%;margin-bottom:-1.6em}
.seal{width:100%;filter:drop-shadow(0 .25em .35em rgba(60,40,0,.35))}
.seal-in{width:46px;height:50px;display:flex;align-items:center;justify-content:center}
.seal-in .seal-ins{width:22px}.seal-in .seal-medal{width:34px}
.seal-in svg{width:100%;height:auto;display:block}
.c-qr{left:12.5%!important;right:auto!important;top:auto!important;bottom:12%;width:6.6%;text-align:center}
.c-qr svg{width:100%;height:auto;background:#fffdf6;padding:.25em;border:.06em solid #b8892b;display:block}
.c-qr small{font-size:.6em;color:#7a6420;display:block;margin-top:.15em}
@media (max-width:700px){.cert2{box-shadow:0 10px 30px rgba(0,0,0,.5)}}

/* ---------- صفحة التحقق ---------- */
.verify .v-ok{margin-top:18px;padding:12px;border-radius:10px;background:rgba(76,175,122,.15);color:#7ed3a4;font-weight:800}
.verify .v-bad{margin-top:18px;padding:12px;border-radius:10px;background:rgba(224,87,79,.15);color:#ff8a82;font-weight:800}
.v-tab{margin-top:12px;background:transparent;text-align:right}.v-tab td{padding:6px 8px}.v-tab td:first-child{color:var(--muted);width:35%}

/* ---------- التقرير الشهري ---------- */
.sheets{display:flex;flex-direction:column;gap:28px;align-items:center}
.sheet{width:210mm;max-width:100%;min-height:297mm;background:#fff;color:#1d2433;padding:12mm 13mm 10mm;position:relative;font-family:Tajawal,sans-serif;font-size:12.5px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);border-radius:3px;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:flex;flex-direction:column;gap:10px}
.sheet h4{margin:0 0 8px;font-family:"El Messiri";font-size:14px;color:#14213d;display:flex;align-items:center;gap:6px}
.sheet h4::before{content:"";width:4px;height:14px;background:linear-gradient(#e3bb44,#a5781b);border-radius:2px}
.sh-band{position:absolute;top:0;left:0;right:0;height:7px;background:linear-gradient(90deg,#14213d 0 40%,#d4af37 40% 60%,#14213d 60%)}
.sh-head{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px;padding-bottom:10px;border-bottom:2px solid #14213d;position:relative}
.sh-head::after{content:"";position:absolute;bottom:-6px;left:0;right:0;border-bottom:1px solid #d4af37}
.sh-r{font-family:Amiri;line-height:1.45;color:#3a3a3a}.sh-r .b{font-weight:700;color:#14213d;font-size:14px}
.sh-c img{width:64px}
.sh-l{text-align:left;font-family:Amiri;line-height:1.5}.sh-t{font-family:"El Messiri";font-size:20px;font-weight:700;color:#14213d}
.sh-student{display:flex;gap:12px;align-items:stretch;margin-top:6px}
.sh-photo{width:84px;flex:none;border:2px solid #d4af37;border-radius:6px;overflow:hidden;display:grid;place-items:center;background:#f4f1e6}
.sh-photo img{width:100%;height:100%;object-fit:cover}.sh-photo span{font-size:36px;font-family:"El Messiri";color:#a5781b}
.sh-info{flex:1;border-collapse:collapse;background:#fff}
.sh-info th,.sh-info td{border:1px solid #d9d3bf;padding:6px 8px;font-size:12.5px;color:#1d2433;white-space:normal}
.sh-info th{background:#f6f1e0;color:#14213d;width:1%;white-space:nowrap;font-weight:700}
.sh-rank{width:96px;flex:none;text-align:center;border:1px solid #d9d3bf;border-radius:6px;padding:6px 4px;background:linear-gradient(#fbf7ea,#fff)}
.sh-rank .ins{width:34px;margin:0 auto 2px}.sh-rank b{display:block;color:#14213d;font-family:"El Messiri";font-size:14px}.sh-rank small{color:#7a6420}
.sh-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.sh-box{border:1px solid #e3dcc5;border-radius:8px;padding:10px 12px;background:#fffdf8}
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.cal-h{font-size:10px;text-align:center;color:#6b6450;font-weight:700}
.cal-d{height:24px;border-radius:4px;display:flex;align-items:center;justify-content:center;gap:2px;font-size:11px;font-weight:700;position:relative}
.cal-d small{font-size:8px;font-weight:800}
.cal-d.ok{background:#e3f3e8;color:#2e7d4f}.cal-d.abs{background:#c0392b;color:#fff}.cal-d.part{background:#f5b041;color:#4a2e00}
.cal-d.off{background:#efece4;color:#b0a890}.cal-d.future{background:#fff;color:#c9c3b0;border:1px dashed #e3dcc5}
.cal-legend{display:flex;gap:6px;align-items:center;flex-wrap:wrap;font-size:10px;color:#6b6450;margin-top:6px}
.cal-legend span{width:10px;height:10px;border-radius:2px;display:inline-block;margin-right:6px}
.cal-legend .ok{background:#e3f3e8}.cal-legend .part{background:#f5b041}.cal-legend .abs{background:#c0392b}.cal-legend .off{background:#efece4}
.sh-kpis{display:flex;gap:6px;margin-top:8px}
.sh-kpis div{flex:1;text-align:center;border:1px solid #e3dcc5;border-radius:6px;padding:5px 2px;background:#fff}
.sh-kpis b{display:block;font-size:18px;font-family:"El Messiri";color:#14213d}.sh-kpis span{font-size:10.5px;color:#6b6450}
.sh-kpis .pos b{color:#2e7d4f}.sh-kpis .neg b{color:#c0392b}
.bars{margin-top:10px;display:flex;flex-direction:column;gap:5px}
.bar{display:grid;grid-template-columns:52px 1fr 34px;align-items:center;gap:6px;font-size:11px}
.bt{height:9px;background:#f1ecdc;border-radius:5px;overflow:hidden}.bt i{display:block;height:100%;background:linear-gradient(90deg,#a5781b,#e3bb44);border-radius:5px}
.bt i.n{background:#c0392b}.bv{font-weight:800;text-align:left;color:#14213d}
.sh-prog{margin-top:10px;font-size:11px;color:#6b6450;display:grid;grid-template-columns:auto 1fr auto;gap:6px;align-items:center}
.sh-prog .pb{height:8px;border-radius:5px;background:#f1ecdc;overflow:hidden}.sh-prog .pb i{display:block;height:100%;background:#14213d}
.sh-medals .row{gap:14px}.sm{text-align:center;width:70px;font-size:10px;color:#14213d}.smi{width:34px;margin:0 auto 2px}
.sh-log{width:100%;border-collapse:collapse;background:#fff}
.sh-log th,.sh-log td{border-bottom:1px solid #eee6cf;padding:4px 6px;font-size:11.5px;color:#1d2433;white-space:normal;text-align:right}
.sh-log th{background:#f6f1e0;color:#14213d}.sh-log td.pos{color:#2e7d4f;font-weight:800}.sh-log td.neg{color:#c0392b;font-weight:800}
.sh-notes .nl{border-bottom:1px dotted #b8a978;height:24px}
.sh-sign{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:auto;padding-top:8px}
.sh-sign div{text-align:center}.sh-sign span{display:block;font-weight:800;color:#14213d}.sh-sign b{display:block;font-weight:400;min-height:18px;color:#3a3a3a}
.sh-sign i{display:block;border-bottom:1px solid #6b6450;margin:22px 10px 0}
.sh-foot{text-align:center;font-size:9.5px;color:#9a927a;border-top:1px solid #eee6cf;padding-top:5px}
@media screen and (max-width:820px){
  .sheet{min-height:auto;padding:16px 12px}
  .sh-grid{grid-template-columns:1fr}
  .sh-student{flex-wrap:wrap}.sh-info{min-width:100%;order:3}
}
/* ---------- إعدادات الطباعة ---------- */
@media print{
  html,body{background:#fff!important}
  body *{visibility:visible}
  .print-bar{display:none!important}
  .cert-wrap{max-width:none;width:297mm;margin:0}
  .cert2{width:297mm;height:210mm;aspect-ratio:auto;box-shadow:none;border-radius:0;font-size:calc(4.75mm * var(--k,1));break-inside:avoid}
  .sheets{display:block}
  .sheet{width:210mm;height:297mm;min-height:0;box-shadow:none;border-radius:0;margin:0;break-after:page;overflow:hidden}
  .sheet:last-child{break-after:auto}
}

.c-body .c-reason{display:block;color:#14213d;font-weight:700}
.cert2 .c-motto{font-size:.92em}

@media print{
  main,#wrap,body.authed #wrap{padding:0!important;margin:0!important;max-width:none!important}
  .cert-wrap,.cert2{overflow:hidden}
  .cert2{height:209.5mm}
  .sheet{height:296.5mm}
}

@media print{
  .sh-grid{grid-template-columns:1fr 1fr!important}
  .sh-student{flex-wrap:nowrap!important}.sh-info{min-width:0!important;order:0!important}
  .form-row{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
}
@media print{
  .sheet{padding:9mm 11mm 7mm;gap:6px;font-size:11.5px}
  .sh-head{padding-bottom:6px}.sh-c img{width:54px}
  .sh-photo{width:72px}.sh-rank{width:86px}
  .sh-info th,.sh-info td{padding:4px 7px}
  .sh-box{padding:7px 10px}
  .sheet h4{margin-bottom:5px;font-size:13px}
  .cal-d{height:19px;font-size:10px}
  .sh-kpis{margin-top:5px}.sh-kpis b{font-size:15px}
  .bars{margin-top:6px;gap:3px}.sh-prog{margin-top:6px}
  .smi{width:26px}.sm{width:60px}
  .sh-log th,.sh-log td{padding:2.5px 6px;font-size:10.5px}
  .sh-notes .nl{height:19px}
  .sh-sign i{margin-top:16px}
}

/* ---------- الشهادة: التخطيط الموحّد والسلّم الطباعي ---------- */
.cert2>.k-safe{position:absolute;top:7.2%;bottom:7.6%;left:10.2%;right:10.2%;display:flex;flex-direction:column;align-items:center;text-align:center;overflow:hidden}
.k-top{width:100%;display:grid;grid-template-columns:1fr auto 1fr;align-items:start;gap:1em;padding:0 7%;box-sizing:border-box}
.k-hr{text-align:right;font-size:.92em;line-height:1.6;color:#4a3a14;padding-top:.7em}
.k-hr div:first-child{font-weight:700;color:#14213d;font-size:1.06em}
.k-school{font-weight:700;color:#14213d;font-size:1.06em;margin-top:.1em}
.k-hl{text-align:left;font-size:.85em;line-height:1.75;color:#4a3a14;padding-top:.7em}
.k-hl div{display:flex;justify-content:flex-end;gap:.45em}
.k-hl span{color:#8a7440}.k-hl span::after{content:":"}
.k-hl b{color:#14213d;font-weight:700}
.k-emblem{display:flex;align-items:flex-end;justify-content:center;gap:.35em}
.k-emblem img{width:4.6em;height:4.6em;filter:drop-shadow(0 .15em .35em rgba(0,0,0,.28))}
.k-emblem .laurel{width:2.2em;height:3.9em}
.k-title{margin:.05em 0 0;font-family:"Aref Ruqaa",Amiri,serif;font-weight:700;font-size:4.3em;line-height:1.15;letter-spacing:0;
  background:linear-gradient(180deg,#dcb54d 0%,#a37a1b 52%,#6e500c 100%);-webkit-background-clip:text;background-clip:text;color:transparent}
.k-sub{display:flex;align-items:center;justify-content:center;gap:.7em;margin-top:.1em;font-size:1.4em;font-weight:700;color:#14213d}
.k-sub i{width:3.2em;height:.08em;background:linear-gradient(90deg,transparent,#b8892b)}
.k-sub i:last-child{background:linear-gradient(270deg,transparent,#b8892b)}
.k-sub span{white-space:nowrap}
.k-to{margin-top:.9em;font-size:1.08em;color:#5a4818}
.k-name{margin-top:.15em;font-size:2.9em;font-weight:700;color:#14213d;line-height:1.25;max-width:90%}
.k-name.long{font-size:2.35em}
.k-name::after{content:"";display:block;width:62%;height:.05em;margin:.08em auto 0;background:linear-gradient(90deg,transparent,#b8892b 20%,#b8892b 80%,transparent)}
.k-meta{margin-top:.35em;font-size:1.05em;color:#7a6420}
.k-meta span{color:#c9a54a;font-size:.6em;margin:0 .8em;vertical-align:middle}
.k-body{flex:1 1 0;display:flex;flex-direction:column;justify-content:center;max-width:78%;min-height:0;padding:.4em 0}
.k-body p{margin:0;font-size:1.16em;line-height:1.75;color:#3a2e10}
.k-body b{color:#14213d}
.k-body .k-reason{font-weight:700;color:#14213d;font-size:1.1em;margin:.15em 0}
.k-body .k-reason::before{content:"“ "}.k-body .k-reason::after{content:" ”"}
.k-body .k-close{font-size:1.05em;color:#5a4818}
.k-motto{font-size:.95em;color:#9c7419;font-style:italic;margin-bottom:.3em}
.k-foot{width:100%;display:grid;grid-template-columns:1fr 2.6fr auto 2.6fr 1fr;align-items:end;gap:.8em;padding:0 7%;box-sizing:border-box;flex:none}
.k-sign{text-align:center;padding-bottom:.4em}
.k-st{font-weight:700;color:#14213d;font-size:1.05em}
.k-sn{min-height:1.5em;font-size:1em;color:#4a3a14}
.k-line{border-bottom:.07em dotted #6e500c;margin:1.5em 1.2em .25em}
.k-sign small{font-size:.74em;color:#8a7440}
.k-seal{width:7.6em;align-self:end}
.k-qr{display:flex;flex-direction:column;align-items:center;justify-self:end;width:5.4em}
.k-qr svg{width:100%;height:auto;background:#fffdf6;padding:.22em;border:.06em solid #b8892b;display:block}
.k-qr small{font-size:.62em;color:#7a6420;margin-top:.2em;white-space:nowrap}
/* ---------- تصحيحات الشهادة: ترويسة موحّدة وتوسيط دقيق ---------- */
.k-top{align-items:center!important}
.k-hr{text-align:center!important;justify-self:end;padding-top:0!important;font-size:.95em!important;line-height:1.7!important}
.k-hr div,.k-hr div:first-child{font-weight:700!important;font-size:1em!important;color:#14213d!important}
.k-hl{justify-self:start;padding-top:0!important;font-size:.95em!important}
.k-hl table{border-collapse:collapse;background:transparent;direction:rtl}
.k-hl td{padding:.08em .35em;border:0;font-size:1em;line-height:1.7;white-space:nowrap;text-align:right;color:#14213d;font-weight:700}
.k-hl td:first-child{color:#8a7440;font-weight:400;padding-left:.6em}
.k-hl td:first-child::after{content:":"}
.k-code{font-family:Amiri,serif;direction:ltr;unicode-bidi:isolate;letter-spacing:.03em}
.k-emblem{position:relative;width:10.5em;height:6em;display:block!important;margin:0 auto}
.k-emblem .wreath{position:absolute;inset:0;width:100%;height:100%}
.k-emblem img{position:absolute;left:50%;top:44%;transform:translate(-50%,-50%);width:4.4em!important;height:4.4em!important}
.k-title{display:inline-block;padding:.05em .35em .1em;font-size:3.7em!important;margin:.15em 0 0!important;text-align:center}
.k-sub{margin-top:.05em!important}
.k-seal{width:7.4em!important}
.k-hr{justify-self:start!important}
.k-hl{justify-self:end!important}
.k-hl .k-code::after,.k-hl span.k-code::after{content:none!important}
.k-emblem .wreath{transform:scale(1.08)}
/* ---------- الشهادة: تكبير متناسق للمحتوى الأوسط ---------- */
.k-title{font-size:3.9em!important;line-height:1.4!important;padding:0 .35em .22em!important;margin:0!important;overflow:visible}
.k-sub{font-size:1.65em!important;margin-top:-.15em!important}
.k-sub i{width:4em!important}
.k-to{font-size:1.3em!important;margin-top:.55em!important}
.k-name{font-size:3.5em!important;margin-top:.05em!important}
.k-name.long{font-size:2.8em!important}
.k-name::after{width:70%!important;height:.045em!important}
.k-meta{font-size:1.28em!important;margin-top:.3em!important}
.k-body{max-width:82%!important}
.k-body p{font-size:1.42em!important;line-height:1.7!important}
.k-body .k-reason{font-size:1.38em!important;margin:.12em 0!important}
.k-body .k-close{font-size:1.28em!important}
.k-motto{font-size:1.15em!important}
.k-st{font-size:1.22em!important}
.k-sn{font-size:1.12em!important}
.k-sign small{font-size:.85em!important}
.k-seal{width:8em!important}
.k-hr,.k-hl{font-size:1.02em!important}
/* إفساح المجال للنص الأوسط: ترويسة وتذييل أكثر إحكاماً */
.cert2>.k-safe{top:6.4%!important;bottom:6.8%!important}
.k-emblem{width:9.6em!important;height:5.3em!important}
.k-emblem img{width:4em!important;height:4em!important}
.k-title{margin-top:-.15em!important}
.k-foot{align-items:end!important}
.k-seal{width:6.4em!important;margin-bottom:-.3em}
.k-line{margin:1.1em 1.2em .2em!important}
.k-motto{margin-bottom:.15em!important}
/* ---------- الترويسة في الزاويتين تحت الزخرفة الذهبية ---------- */
.k-top{display:flex!important;justify-content:center}
.cert2>.k-corner{position:absolute;top:23.5%;width:18%;text-align:center;font-family:Amiri,serif;color:#14213d;z-index:1}
.cert2>.k-cr{right:5%;left:auto}
.cert2>.k-cl{left:5%;right:auto}
.k-cr div{font-weight:700;font-size:1.02em;line-height:1.7}
.k-cl table{margin:0 auto;border-collapse:collapse;background:transparent;direction:rtl}
.k-cl td{padding:.06em .3em;border:0;font-size:1em;line-height:1.7;white-space:nowrap;text-align:right;color:#14213d;font-weight:700}
.k-cl td:first-child{color:#8a7440;font-weight:400}
.k-cl td:first-child::after{content:":"}
/* أسماء الموقّعين قابلة للكتابة قبل الطباعة */
.k-sn[contenteditable]{outline:none;border-radius:.2em;cursor:text}
@media screen{
  .k-sn[contenteditable]:hover,.k-sn[contenteditable]:focus{background:rgba(212,175,55,.14)}
  .k-sn[contenteditable]:empty::before{content:attr(data-ph);color:#b9a77a;font-style:italic}
}
/* ---------- مواضع الترويسة ورمز QR حسب طلب المدرسة ---------- */
.cert2>.k-corner{top:14.2%!important;width:21%!important}
.cert2>.k-cr{right:8.2%!important}
.cert2>.k-cl{left:8.2%!important}
.k-cr div{font-size:1.16em!important;line-height:1.75!important}
.k-cl td{font-size:1.12em!important;line-height:1.75!important}
.cert2>.k-qrbox{position:absolute;left:9.6%!important;right:auto!important;top:auto!important;bottom:12.8%;width:7.6%;display:flex;flex-direction:column;align-items:center;z-index:1}
.k-qrbox svg{width:100%;height:auto;background:#fffdf6;padding:.25em;border:.06em solid #b8892b;display:block}
.k-qrbox small{font-size:.72em;color:#7a6420;margin-top:.25em;white-space:nowrap;font-family:Amiri,serif}
/* الرقم والتاريخ: كل قيمة ملاصقة لعنوانها */
.k-cl{text-align:right!important}
.k-cl .k-ln{font-size:1.12em;line-height:1.75;white-space:nowrap}
.k-cl .k-ln span{color:#8a7440;font-weight:400}
.k-cl .k-ln b{color:#14213d;font-weight:700}
.k-cl .k-code{display:inline-block;direction:ltr;unicode-bidi:isolate;font-family:Amiri,serif}
.k-cl .k-code::after{content:none!important}

/* =====================================================================
   الهوية البصرية: الدرع الرسمي + الأيقونة + الشعار الأفقي، واسم المدرسة بخط الرقعة
   ===================================================================== */
.schoolName,.pub-brand span{font-family:"Aref Ruqaa","El Messiri",serif!important;font-weight:700}
/* القائمة الجانبية */
.side-head{padding:18px 16px 14px}
.side-head .side-crest{width:92px;height:auto;filter:drop-shadow(0 6px 16px rgba(0,0,0,.45))}
.side-head .schoolName{font-size:21px;margin-top:4px;line-height:1.4;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent}
@media (max-height:760px){
  .side-head .side-crest{width:46px}
  .side-head .schoolName{font-size:17px;margin:0}
}
/* الشريط العلوي للزوار */
.pub-brand img{width:40px;height:40px}
.pub-brand span{font-size:22px;background:var(--goldgrad);-webkit-background-clip:text;background-clip:text;color:transparent}
/* الواجهة الرئيسية */
.hero .emblem{width:200px;height:auto;animation:float 6s ease-in-out infinite;filter:drop-shadow(0 18px 40px rgba(0,0,0,.55)) drop-shadow(0 0 30px rgba(212,175,55,.25))}
.hero h1{font-family:"Aref Ruqaa","El Messiri",serif;font-size:clamp(42px,7vw,80px);line-height:1.35;margin:4px 0 8px}
.hero .eyebrow{margin-top:14px}
footer.site .foot-mark{width:min(440px,88%);height:auto;display:block;margin:0 auto 14px}
/* الدخول والتحقق */
.login img.login-crest{width:118px;height:auto;filter:drop-shadow(0 10px 24px rgba(0,0,0,.5))}
.login h2{margin-top:6px}
/* الشهادة: الدرع الرسمي أعلى الوسط */
.k-emblem.k-crest{width:auto!important;height:auto!important;display:flex!important;justify-content:center}
.k-emblem.k-crest img{position:static!important;transform:none!important;width:auto!important;height:7.4em!important;filter:drop-shadow(0 .15em .3em rgba(60,40,0,.3))}
/* التقرير الشهري */
.sh-c img{width:auto!important;height:78px}
@media print{.sh-c img{height:70px}}
@media (max-width:700px){
  .hero .emblem{width:150px}
  .side-head .side-crest{width:70px}
}
/* ===== الإحصائيات ===== */
.sbar{display:grid;grid-template-columns:120px 1fr 52px;align-items:center;gap:10px;margin:8px 0;font-size:14px}
.sbar .sl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sbar .st{height:12px;background:rgba(255,255,255,.06);border-radius:8px;overflow:hidden}
.sbar .st i{display:block;height:100%;background:#4caf7a;border-radius:8px}
.sbar .st i.mid{background:#e0a33a}.sbar .st i.bad{background:var(--red)}.sbar .st i.gold{background:var(--goldgrad)}
.sbar b{text-align:left;color:var(--gold2)}
.cols{display:flex;gap:10px;align-items:flex-end;height:170px;padding-top:10px}
.col{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;height:100%}
.col .cv{flex:1;width:100%;display:flex;align-items:flex-end;background:rgba(255,255,255,.03);border-radius:8px}
.col .cv i{display:block;width:100%;background:var(--goldgrad);border-radius:8px 8px 4px 4px;min-height:3px}
.col b{color:var(--gold2)}.col small{color:var(--muted);font-size:11px}
/* ===== الدليل ===== */
.guide{display:grid;gap:16px}.guide-sec h3{font-size:20px}.guide-sec p{margin-top:-6px}
.guide-sec ol{margin:0;padding-right:22px;line-height:2}.guide-sec li{margin-bottom:4px}
@media print{
  .guide-sec{background:#fff!important;color:#111!important;border:1px solid #bbb!important;break-inside:avoid;box-shadow:none}
  .guide-sec *{color:#111!important}.guide-sec h3{color:#14213d!important}
}
/* ===== تطبيق أندرويد ===== */
.app-banner{display:inline-flex;align-items:center;gap:8px;padding:12px 22px;border-radius:12px;border:1px solid var(--line);color:var(--gold2);text-decoration:none;font-weight:800;background:rgba(212,175,55,.08);flex-basis:100%;justify-content:center;margin-bottom:6px}
.app-banner.sm{margin-top:16px;width:100%;box-sizing:border-box}
html.in-app .topbar{padding-top:10px}
html.in-app .no-app{display:none!important}
