:root{
  --primary:#4f46e5;--primary-600:#4338ca;--primary-700:#3730a3;--primary-50:#eef2ff;--primary-100:#e0e7ff;
  --green:#16a34a;--green-600:#15803d;--green-50:#f0fdf4;--green-100:#dcfce7;
  --red:#dc2626;--red-50:#fef2f2;--red-100:#fee2e2;
  --amber:#b45309;--amber-50:#fffbeb;--amber-100:#fef3c7;
  --bg:#f5f6fa;--card:#fff;--text:#0f172a;--text-2:#334155;--muted:#64748b;--faint:#94a3b8;
  --border:#e5e7eb;--border-2:#eef0f4;
  --radius:14px;--radius-sm:10px;
  --shadow:0 1px 2px rgba(15,23,42,.04),0 6px 20px rgba(15,23,42,.05);
  --shadow-lg:0 20px 50px rgba(15,23,42,.18);
  --font:'Plus Jakarta Sans',ui-sans-serif,system-ui,sans-serif;
  --arab:'Noto Naskh Arabic','Amiri',serif;
  --mono:'JetBrains Mono',ui-monospace,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
a{color:var(--primary);text-decoration:none}
button{font-family:inherit}
h1,h2,h3,h4{margin:0;line-height:1.25;letter-spacing:-.01em;text-wrap:balance}
p{margin:0;text-wrap:pretty}
.arab{font-family:var(--arab);direction:rtl;unicode-bidi:plaintext;font-size:1.15em;line-height:1.9}
.mono{font-family:var(--mono);font-size:.9em}
.muted{color:var(--muted)}
.faint{color:var(--faint)}
.small{font-size:13px}
.xs{font-size:12px}
.bold{font-weight:700}
.semibold{font-weight:600}
.nowrap{white-space:nowrap}
.right{text-align:right}
.center{text-align:center}
.row{display:flex;align-items:center;gap:10px}
.row-wrap{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.between{justify-content:space-between}
.col{display:flex;flex-direction:column;gap:10px}
.grow{flex:1;min-width:0}
.gap-4{gap:4px}.gap-6{gap:6px}.gap-16{gap:16px}.gap-20{gap:20px}
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:1100px){.g4{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.g2,.g3{grid-template-columns:1fr}.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:10px;border:1px solid transparent;font-weight:600;font-size:14px;cursor:pointer;transition:background .15s,border-color .15s,color .15s,box-shadow .15s;white-space:nowrap;background:#fff;color:var(--text)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn-primary{background:var(--primary);color:#fff}
.btn-primary:hover:not(:disabled){background:var(--primary-600)}
.btn-green{background:var(--green);color:#fff}
.btn-green:hover:not(:disabled){background:var(--green-600)}
.btn-outline{border-color:var(--border);background:#fff}
.btn-outline:hover:not(:disabled){background:#f8fafc;border-color:#d4d8e0}
.btn-ghost{background:transparent}
.btn-ghost:hover:not(:disabled){background:#eef0f5}
.btn-danger{background:var(--red);color:#fff}
.btn-danger:hover:not(:disabled){background:#b91c1c}
.btn-soft{background:var(--primary-50);color:var(--primary-700)}
.btn-soft:hover:not(:disabled){background:var(--primary-100)}
.btn-sm{height:34px;padding:0 12px;font-size:13px;border-radius:9px}
.btn-lg{height:48px;padding:0 22px;font-size:15px;border-radius:12px}
.btn-icon{width:36px;padding:0;height:36px}
.btn-icon.btn-sm{width:32px;height:32px}
.btn-block{width:100%}
.icon-danger{color:var(--red)}

/* cards */
.card{background:var(--card);border:1px solid var(--border-2);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-pad{padding:20px}
.card-head{padding:16px 20px;border-bottom:1px solid var(--border-2);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.card-title{font-size:16px;font-weight:700}
.card-sub{font-size:13px;color:var(--muted)}

/* form */
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.label{font-size:13px;font-weight:600;color:var(--text-2)}
.label .req{color:var(--red);margin-left:2px}
.input,.select,.textarea{height:42px;border:1px solid var(--border);border-radius:10px;padding:0 12px;font:inherit;font-size:14px;color:var(--text);background:#fff;outline:none;transition:border-color .15s,box-shadow .15s;width:100%;min-width:0}
.textarea{height:auto;padding:10px 12px;min-height:90px;resize:vertical}
.input:focus,.select:focus,.textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-100)}
.input.err,.select.err{border-color:var(--red);box-shadow:0 0 0 3px var(--red-100)}
.input-sm,.select-sm{height:36px;font-size:13px}
.select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:34px}
.error-text{font-size:12.5px;color:var(--red)}
.hint{font-size:12.5px;color:var(--muted)}
.input-wrap{position:relative}
.input-wrap .input{padding-left:38px}
.input-wrap .lead{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--faint);display:flex}
.input-wrap .trail{position:absolute;right:6px;top:50%;transform:translateY(-50%)}
.check{display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-size:14px}
.check input{width:16px;height:16px;accent-color:var(--primary)}
.switch{position:relative;width:44px;height:24px;border-radius:99px;background:#cbd5e1;border:none;cursor:pointer;transition:background .2s;flex:none}
.switch::after{content:'';position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.switch.on{background:var(--green)}
.switch.on::after{transform:translateX(20px)}
.switch:disabled{opacity:.5}

/* badges */
.badge{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:99px;font-size:12px;font-weight:600;white-space:nowrap;background:#f1f5f9;color:#475569}
.b-green{background:var(--green-100);color:#166534}
.b-red{background:var(--red-100);color:#991b1b}
.b-amber{background:var(--amber-100);color:#92400e}
.b-indigo{background:var(--primary-100);color:var(--primary-700)}
.b-dot::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}

/* table */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
table.table{width:100%;border-collapse:collapse;font-size:14px}
.table th{text-align:left;font-size:12px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--muted);padding:11px 14px;background:#fafbfc;border-bottom:1px solid var(--border-2);white-space:nowrap}
.table td{padding:11px 14px;border-bottom:1px solid var(--border-2);vertical-align:middle}
.table tr:last-child td{border-bottom:none}
.table tbody tr:hover td{background:#fafbff}
.table .num{width:52px;color:var(--muted)}
.table .actions{text-align:right;white-space:nowrap}
.table td.link{cursor:pointer}
.link-text{color:var(--text);font-weight:600;cursor:pointer;background:none;border:none;padding:0;font:inherit;text-align:left}
.link-text:hover{color:var(--primary)}
.th-link{cursor:pointer}
.th-link:hover{color:var(--primary)}
.grade-input{width:78px;height:36px;text-align:center;font-weight:600}
.save-state{font-size:12px;display:inline-flex;align-items:center;gap:4px;min-width:84px}

/* pagination */
.pager{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-top:1px solid var(--border-2);flex-wrap:wrap}

/* toolbar */
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border-2)}
.toolbar .input-wrap{flex:1;min-width:200px}
.filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}

/* modal */
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);display:flex;align-items:flex-start;justify-content:center;padding:40px 16px;z-index:100;overflow-y:auto;animation:fade .15s}
.modal{background:#fff;border-radius:16px;box-shadow:var(--shadow-lg);width:100%;max-width:560px;animation:pop .18s ease-out}
.modal.lg{max-width:860px}.modal.xl{max-width:1080px}.modal.sm{max-width:420px}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--border-2);display:flex;align-items:center;justify-content:space-between;gap:12px}
.modal-title{font-size:17px;font-weight:700}
.modal-body{padding:22px}
.modal-foot{padding:14px 22px;border-top:1px solid var(--border-2);display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}
@keyframes fade{from{opacity:0}}
@keyframes pop{from{opacity:0;transform:translateY(8px) scale(.98)}}
@media (max-width:640px){.overlay{padding:0;align-items:flex-end}.modal{border-radius:16px 16px 0 0;max-height:94vh;overflow-y:auto}}

/* toast */
.toasts{position:fixed;bottom:20px;right:20px;display:flex;flex-direction:column;gap:10px;z-index:200;max-width:min(380px,calc(100vw - 40px))}
.toast{background:#0f172a;color:#fff;border-radius:12px;padding:12px 14px;box-shadow:var(--shadow-lg);display:flex;gap:10px;align-items:flex-start;font-size:14px;animation:pop .2s}
.toast.success .ti{color:#4ade80}.toast.error .ti{color:#f87171}.toast.info .ti{color:#a5b4fc}
.toast .ti{flex:none;margin-top:1px}

/* states */
.state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:48px 20px;gap:10px}
.state-icon{width:52px;height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:var(--primary-50);color:var(--primary)}
.state-icon.err{background:var(--red-50);color:var(--red)}
.state-icon.warn{background:var(--amber-50);color:var(--amber)}
.state h3{font-size:16px}
.state p{color:var(--muted);font-size:14px;max-width:420px}
.spinner{width:18px;height:18px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .7s linear infinite;display:inline-block;flex:none}
.spinner.lg{width:28px;height:28px;border-width:3px;color:var(--primary)}
@keyframes spin{to{transform:rotate(360deg)}}
.skel{background:linear-gradient(90deg,#eef0f4 25%,#f6f7fa 50%,#eef0f4 75%);background-size:200% 100%;animation:sk 1.2s infinite;border-radius:8px;height:14px}
@keyframes sk{to{background-position:-200% 0}}

/* alert */
.alert{display:flex;gap:12px;padding:14px 16px;border-radius:12px;font-size:14px;align-items:flex-start;border:1px solid}
.alert .ai{flex:none;margin-top:1px}
.alert-info{background:var(--primary-50);border-color:var(--primary-100);color:#312e81}
.alert-warn{background:var(--amber-50);border-color:var(--amber-100);color:#78350f}
.alert-err{background:var(--red-50);border-color:var(--red-100);color:#7f1d1d}
.alert-ok{background:var(--green-50);border-color:var(--green-100);color:#14532d}
.alert b{font-weight:700}

/* tabs */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);overflow-x:auto;scrollbar-width:none}
.tab{padding:10px 14px;font-weight:600;font-size:14px;color:var(--muted);border:none;background:none;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;display:inline-flex;align-items:center;gap:8px}
.tab:hover{color:var(--text)}
.tab.active{color:var(--primary);border-bottom-color:var(--primary)}
.seg{display:inline-flex;background:#eef0f5;border-radius:10px;padding:3px;gap:2px}
.seg button{border:none;background:none;padding:6px 12px;border-radius:8px;font-weight:600;font-size:13px;color:var(--muted);cursor:pointer}
.seg button.on{background:#fff;color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.08)}

/* ===== public ===== */
.pub-header{position:sticky;top:0;z-index:20;background:rgba(255,255,255,.88);backdrop-filter:blur(10px);border-bottom:1px solid var(--border-2)}
.pub-header-in{max-width:1160px;margin:0 auto;height:68px;padding:0 20px;display:flex;align-items:center;gap:24px}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;color:var(--text);font-size:15px;letter-spacing:-.01em}
.brand-mark{width:36px;height:36px;border-radius:10px;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;flex:none}
.brand small{display:block;font-weight:500;color:var(--muted);font-size:12px;letter-spacing:0}
.pub-nav{display:flex;gap:4px;margin-left:auto;align-items:center}
.pub-nav a.nl{padding:8px 12px;border-radius:8px;color:var(--text-2);font-weight:600;font-size:14px}
.pub-nav a.nl:hover,.pub-nav a.nl.active{background:#f1f3f8;color:var(--text)}
@media (max-width:640px){.pub-nav a.nl{display:none}.brand small{display:none}}
.pub-main{max-width:1160px;margin:0 auto;padding:0 20px 60px}
.hero{padding:64px 0 36px;display:grid;grid-template-columns:1.1fr .9fr;gap:40px;align-items:end}
.hero h1{font-size:clamp(34px,5vw,54px);font-weight:800;letter-spacing:-.03em;line-height:1.05}
.hero h1 em{font-style:normal;color:var(--primary)}
.hero p.lead{font-size:18px;color:var(--text-2);margin-top:18px;max-width:520px}
@media (max-width:860px){.hero{grid-template-columns:1fr;padding-top:40px}}
.entry-card{padding:28px;display:flex;flex-direction:column;gap:14px;position:relative;overflow:hidden}
.entry-card .ec-icon{width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center}
.entry-card h3{font-size:20px;font-weight:800}
.entry-card p{color:var(--muted)}
.portal-status{display:flex;align-items:center;gap:14px;padding:16px 20px}
.dot-live{width:10px;height:10px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px var(--green-100);flex:none}
.dot-off{width:10px;height:10px;border-radius:50%;background:var(--faint);box-shadow:0 0 0 4px #e2e8f0;flex:none}
.auth-wrap{min-height:calc(100vh - 68px);display:flex;align-items:center;justify-content:center;padding:32px 16px}
.auth-card{width:100%;max-width:420px;padding:32px}
.demo-ribbon{background:#1e1b4b;color:#e0e7ff;font-size:13px;padding:8px 16px;display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;text-align:center}
.demo-ribbon b{color:#fff}
.demo-ribbon a{color:#c7d2fe;text-decoration:underline}

/* ===== admin ===== */
.admin{display:flex;min-height:100vh}
.sidebar{width:248px;flex:none;background:linear-gradient(180deg,#26235e 0%,#1e1b4b 100%);color:#e0e7ff;border-right:1px solid #2e2a6b;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;transition:width .2s;z-index:40}
.sidebar.collapsed{width:72px}
.sb-head{height:64px;flex-shrink:0;display:flex;align-items:center;padding:0 18px;gap:10px;border-bottom:1px solid rgba(255,255,255,.08)}
.sb-head .brand-mark{background:#fff;color:var(--primary)}
.sb-head .bold{color:#fff}
.sb-head .muted{color:#a5b4fc!important}
.sb-head .btn-ghost{color:#c7d2fe}
.sb-head .btn-ghost:hover{background:rgba(255,255,255,.1)}
.sb-nav{flex:1;min-height:0;overflow-y:auto;padding:12px 10px;display:flex;flex-direction:column;gap:2px}
.sb-nav>*{flex-shrink:0}
.sb-group{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:rgba(199,210,254,.55);padding:12px 10px 6px}
.sb-link{display:flex;align-items:center;gap:12px;padding:0 12px;height:40px;min-height:40px;flex-shrink:0;border-radius:10px;color:#c7d2fe;font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;position:relative;font-family:inherit}
.sb-link:hover{background:rgba(255,255,255,.08);color:#fff}
.sb-link.active{background:rgba(255,255,255,.14);color:#fff}
.sb-link.active::before{content:'';position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:#4ade80}
.sb-link.active svg{color:#fff}
.sb-link svg{flex:none;color:#a5b4fc}
.sidebar.collapsed .sb-label,.sidebar.collapsed .sb-group,.sidebar.collapsed .brand-text{display:none}
.sidebar.collapsed .sb-link{justify-content:center;padding:0}
.sb-foot{flex-shrink:0;padding:12px;border-top:1px solid rgba(255,255,255,.08)}
.sb-nav::-webkit-scrollbar{width:6px}.sb-nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,.15);border-radius:6px}
.back-btn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px 0 8px;border-radius:9px;border:1px solid var(--border);background:#fff;color:var(--text-2);font-weight:600;font-size:13px;flex:none}
.back-btn:hover{background:var(--primary-50);border-color:var(--primary-100);color:var(--primary-700)}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{height:64px;background:rgba(255,255,255,.9);backdrop-filter:blur(8px);border-bottom:1px solid var(--border-2);display:flex;align-items:center;gap:12px;padding:0 24px;position:sticky;top:0;z-index:30}
.topbar h1{font-size:18px;font-weight:700}
.content{padding:24px;max-width:1360px;width:100%;margin:0 auto;display:flex;flex-direction:column;gap:20px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}
.page-head h2{font-size:24px;font-weight:800;letter-spacing:-.02em}
.page-head p{color:var(--muted);margin-top:4px}
.crumb{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px;margin-bottom:6px}
.crumb a{color:var(--muted)}.crumb a:hover{color:var(--primary)}
.sb-backdrop{display:none}
.mobile-only{display:none}
@media (max-width:900px){
  .sidebar{position:fixed;left:0;top:0;transform:translateX(-100%);transition:transform .22s;width:270px!important;box-shadow:var(--shadow-lg)}
  .sidebar.open{transform:none}
  .sidebar .sb-label,.sidebar .sb-group,.sidebar .brand-text{display:revert!important}
  .sidebar .sb-link{justify-content:flex-start!important;padding:0 12px!important}
  .sb-backdrop.show{display:block;position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:35}
  .desktop-only{display:none!important}
  .mobile-only{display:inline-flex}
  .content{padding:16px}
  .topbar{padding:0 14px}
}
.user-chip{display:flex;align-items:center;gap:10px;padding:4px 6px 4px 4px;border-radius:99px;border:1px solid var(--border);background:#fff;cursor:pointer}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--primary-100);color:var(--primary-700);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex:none}
.menu{position:absolute;right:0;top:calc(100% + 6px);background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);min-width:220px;padding:6px;z-index:50}
.menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border-radius:8px;border:none;background:none;font:inherit;font-size:14px;cursor:pointer;color:var(--text);text-align:left}
.menu-item:hover{background:#f3f4f8}

/* stat */
.stat{padding:18px;display:flex;flex-direction:column;gap:10px;cursor:default;transition:transform .15s,box-shadow .15s;text-align:left;font:inherit;color:inherit;border:1px solid var(--border-2)}
button.stat{cursor:pointer}
button.stat:hover{transform:translateY(-2px);box-shadow:0 10px 30px rgba(15,23,42,.08)}
.stat .s-top{display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:13px;font-weight:600}
.stat .s-ico{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.stat .s-val{font-size:28px;font-weight:800;letter-spacing:-.02em;line-height:1}
.stat .s-sub{font-size:12.5px;color:var(--muted)}
.ico-indigo{background:var(--primary-50);color:var(--primary)}
.ico-green{background:var(--green-50);color:var(--green)}
.ico-red{background:var(--red-50);color:var(--red)}
.ico-amber{background:var(--amber-50);color:var(--amber)}
.ico-slate{background:#f1f5f9;color:#475569}

/* charts */
.hbar{display:grid;grid-template-columns:minmax(90px,170px) 1fr 52px;gap:12px;align-items:center;font-size:13px;padding:5px 0}
.hbar .track{height:12px;border-radius:99px;background:#eef0f5;overflow:hidden;position:relative}
.hbar .fill{height:100%;border-radius:99px;background:var(--primary);transition:width .5s}
.hbar .kk{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--red);opacity:.6}
.vbars{display:flex;align-items:flex-end;gap:12px;height:190px;padding-top:10px}
.vbar{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.vbar .col-fill{width:100%;max-width:56px;border-radius:8px 8px 4px 4px;background:var(--primary);transition:height .5s;min-height:2px}
.vbar .vl{font-size:12px;color:var(--muted);white-space:nowrap}
.vbar .vv{font-size:13px;font-weight:700}
.donut{width:150px;height:150px;border-radius:50%;position:relative;flex:none}
.donut::after{content:'';position:absolute;inset:22px;background:#fff;border-radius:50%}
.donut .dc{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:1}
.legend{display:flex;flex-direction:column;gap:8px;font-size:14px}
.legend .sw{width:12px;height:12px;border-radius:4px;flex:none}

/* steps */
.steps{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px;font-weight:600;color:var(--muted)}
.steps .st{display:flex;align-items:center;gap:6px}
.steps .st .n{width:22px;height:22px;border-radius:50%;background:#eef0f5;display:flex;align-items:center;justify-content:center;font-size:12px}
.steps .st.on{color:var(--primary)}
.steps .st.on .n{background:var(--primary);color:#fff}
.steps .st.done .n{background:var(--green);color:#fff}
.dropzone{border:2px dashed #cbd5e1;border-radius:14px;padding:32px;text-align:center;cursor:pointer;transition:border-color .15s,background .15s;display:flex;flex-direction:column;align-items:center;gap:8px}
.dropzone:hover,.dropzone.drag{border-color:var(--primary);background:var(--primary-50)}
tr.row-err td{background:var(--red-50)!important}
tr.row-warn td{background:var(--amber-50)!important}

/* question */
.q-card{padding:16px 18px;border:1px solid var(--border-2);border-radius:12px;background:#fff}
.q-opts{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:6px;margin-top:10px}
.q-opt{display:flex;gap:8px;align-items:flex-start;padding:7px 10px;border-radius:8px;background:#f8fafc;font-size:14px}
.q-opt.ok{background:var(--green-50);color:#14532d;font-weight:600}
.q-opt .k{font-weight:700;color:var(--muted);flex:none}

/* kv */
.kv{display:grid;grid-template-columns:150px 1fr;gap:10px 16px;font-size:14px}
.kv dt{color:var(--muted)}
.kv dd{margin:0;font-weight:600}
@media (max-width:640px){.kv{grid-template-columns:1fr;gap:2px}.kv dd{margin-bottom:8px}}

/* guide */
.guide ol{padding-left:20px;margin:8px 0;display:flex;flex-direction:column;gap:8px}
.guide li{padding-left:4px}
.guide code,.code-inline{font-family:var(--mono);font-size:12.5px;background:#f1f5f9;padding:2px 6px;border-radius:6px}
.codeblock{font-family:var(--mono);font-size:12.5px;background:#0f172a;color:#e2e8f0;padding:14px 16px;border-radius:10px;overflow-x:auto;white-space:pre;line-height:1.6}

/* print preview */
.paper-stage{background:#e5e7eb;padding:24px;border-radius:12px;overflow:auto;max-height:70vh}
.paper{background:#fff;width:210mm;min-height:297mm;margin:0 auto;padding:16mm 15mm;box-shadow:0 4px 20px rgba(0,0,0,.12);color:#000;font-size:11pt}
.report h1{font-size:15pt;text-align:center;font-weight:800;text-transform:uppercase}
.report .r-school{text-align:center;font-size:11pt;margin-top:2px}
.report .r-rule{border:none;border-top:2px solid #000;margin:10px 0 14px}
.report .r-meta{display:grid;grid-template-columns:1fr 1fr;gap:2px 24px;font-size:10.5pt;margin-bottom:12px}
.report .r-meta div span{display:inline-block;min-width:120px}
.report table{width:100%;border-collapse:collapse;font-size:10pt}
.report th,.report td{border:1px solid #000;padding:4px 6px}
.report th{background:#f0f0f0;font-weight:700}
.report .r-sign{display:flex;justify-content:flex-end;margin-top:30px;font-size:10.5pt}
.report .r-sign div{text-align:center;min-width:220px}
.report .r-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0}
.report .r-stats div{border:1px solid #000;padding:6px 8px}
.report .r-stats b{display:block;font-size:13pt}
#print-root{display:none}
@media print{
  @page{size:A4;margin:12mm}
  body{background:#fff}
  #root,.overlay,.toasts{display:none!important}
  #print-root{display:block!important}
  #print-root .paper{box-shadow:none;width:auto;min-height:0;padding:0;margin:0}
  #print-root .page-break{page-break-after:always}
}

.content > *{flex-shrink:0}
.page-head > .row-wrap{justify-content:flex-end;flex:0 1 auto;max-width:100%}
.page-head > .grow{flex:1 1 280px}
/* ===== Sidebar theme v3: soft lavender (tidak terlalu putih, tidak terlalu gelap) ===== */
.sidebar{background:#eef0fb;color:#312e81;border-right:1px solid #dfe3f6}
.sb-head{border-bottom:1px solid #dfe3f6}
.sb-head .brand-mark{background:var(--primary);color:#fff;box-shadow:0 4px 12px rgba(79,70,229,.3)}
.sb-head .bold{color:#1e1b4b}
.sb-head .muted{color:#6366a8!important}
.sb-head .btn-ghost{color:#4338ca}
.sb-head .btn-ghost:hover{background:#e0e4fa}
.sb-group{color:#8b8fc4}
.sb-link{color:#3f4373}
.sb-link svg{color:#6c70b0}
.sb-link:hover{background:#e2e5f8;color:#1e1b4b}
.sb-link:hover svg{color:var(--primary)}
.sb-link.active{background:var(--primary);color:#fff;box-shadow:0 6px 16px rgba(79,70,229,.28)}
.sb-link.active svg{color:#fff}
.sb-link.active::before{display:none}
.sb-foot{border-top:1px solid #dfe3f6}
.sb-nav::-webkit-scrollbar-thumb{background:#cdd2ef}

/* ===== v4: grafik SVG, print rekap fleksibel ===== */
.chart-svg{width:100%;overflow:hidden}
.chart-svg svg{width:100%;height:auto;display:block}
.paper.landscape{width:297mm;min-height:210mm}
.paper.f4{width:215mm;min-height:330mm}
.paper.f4.landscape{width:330mm;min-height:215mm}
.report .r-chart{margin:14px 0;break-inside:avoid;page-break-inside:avoid}
.report .r-chart-title{font-weight:700;font-size:10.5pt;margin-bottom:4px}
.report .r-chart svg{width:100%;height:auto}
.report .r-sign{break-inside:avoid;page-break-inside:avoid}
.report table{page-break-inside:auto}
.report tr{break-inside:avoid;page-break-inside:avoid}
.report thead{display:table-header-group}
.gap-12{gap:12px}
@media print{ #print-root .paper.landscape,#print-root .paper.f4,#print-root .paper.f4.landscape{width:auto;min-height:0} }

/* ===== Portal akun siswa (Phase 1) ===== */
.student-portal{min-height:100vh;background:var(--bg);color:var(--text)}
.student-topbar{height:68px;padding:0 24px;background:#fff;border-bottom:1px solid var(--border-2);display:flex;align-items:center;justify-content:space-between;gap:16px}
.student-topbar .brand{display:flex;align-items:center;gap:10px;color:var(--text);font-weight:800}
.student-topbar .brand small{display:block;font-size:10px;color:var(--muted);font-weight:500}
.student-welcome{font-size:13px;color:var(--text-2);font-weight:600}
.student-wrap{max-width:1160px;margin:0 auto;padding:28px 20px 64px;display:flex;flex-direction:column;gap:18px}
.student-page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}
.student-page-head h1{margin:4px 0 0;font-size:clamp(25px,3vw,34px);font-weight:800;letter-spacing:-.025em}
.student-page-head .eyebrow{font-size:10px;color:var(--primary);font-weight:800;letter-spacing:.09em}
.student-nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.student-content{display:flex;flex-direction:column;gap:18px}
.student-hero{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.student-hero h2{margin:3px 0;font-size:22px}
.student-summary{align-items:stretch}
.student-stat-text{font-size:20px!important;overflow-wrap:anywhere}
.student-profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 24px;margin-top:8px}
.student-profile-grid>div{display:flex;justify-content:space-between;gap:14px;padding:13px 0;border-bottom:1px solid var(--border-2);font-size:13px}
.student-profile-grid span{color:var(--muted)}
.student-profile-grid b{text-align:right;overflow-wrap:anywhere}
.student-login-wrap{padding-top:52px}
.student-top-avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:var(--primary-50);color:var(--primary);font-size:11px;font-weight:800}
.student-main-nav{display:flex;align-items:center;gap:6px;padding:7px;background:#fff;border:1px solid var(--border-2);border-radius:14px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin}
.student-nav-link{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 13px;border-radius:10px;color:var(--text-2);font-size:13px;font-weight:700;white-space:nowrap;transition:background .15s,color .15s}
.student-nav-link:hover{background:var(--bg);color:var(--text)}
.student-nav-link.active{background:var(--primary-50);color:var(--primary)}
.student-content{min-width:0}
.student-dashboard-grid{align-items:start}
.student-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.student-section-head h2{margin:0;font-size:16px;font-weight:800}
.student-section-head p{margin:4px 0 0;color:var(--muted);font-size:12px}
.student-card-list{display:flex;flex-direction:column;gap:10px;min-width:0}
.student-record{min-width:0}
.student-record h3{margin:5px 0 8px;font-size:15px;line-height:1.4}
.student-record p{margin:9px 0;color:var(--text-2);font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.student-record-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-width:0}
.student-record-top>div{min-width:0}
.student-record-top .eyebrow{font-size:10px;color:var(--muted);font-weight:700}
.student-score{flex:none;min-width:54px;padding:8px 10px;border-radius:11px;background:var(--primary-50);color:var(--primary);text-align:center;font-size:20px}
.student-list-record{display:flex;align-items:center;gap:11px;min-width:0;padding:12px 0;border-bottom:1px solid var(--border-2)}
.student-list-record:last-child{border-bottom:0}
.student-list-record>.grow{min-width:0}
.student-list-record b{display:block;font-size:13px;overflow-wrap:anywhere}
.student-list-record .small{margin-top:3px}
.student-task-description{line-height:1.55;overflow-wrap:anywhere}
.student-list-icon,.student-empty-icon{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:11px;background:var(--primary-50);color:var(--primary)}
.student-empty{display:flex;align-items:flex-start;gap:12px;padding:14px 0;color:var(--text-2)}
.student-empty b{display:block;color:var(--text);font-size:13px}
.student-empty p{margin:4px 0 0;color:var(--muted);font-size:12px;line-height:1.6}
.student-info-line{display:flex;align-items:flex-start;gap:9px;padding:12px 14px;border:1px solid var(--primary-100);border-radius:12px;background:var(--primary-50);color:var(--primary);font-size:13px}
.student-timeline{display:flex;flex-direction:column}
.student-timeline-item{display:flex;align-items:flex-start;gap:11px;padding:12px 0;border-bottom:1px solid var(--border-2);min-width:0}
.student-timeline-item:last-child{border-bottom:0}
.student-timeline-item>.grow{min-width:0}
.student-timeline-item b{font-size:13px;display:block;overflow-wrap:anywhere}
.student-timeline-item time{flex:none;white-space:nowrap}
.student-timeline-dot{display:grid;place-items:center;flex:none;width:30px;height:30px;border:1px solid var(--border-2);border-radius:50%;background:#fff;color:var(--primary)}
.student-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.student-filter{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--text-2);font-size:12px;font-weight:700}
.student-material-body{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:12px;padding:14px;border:1px solid var(--border-2);border-radius:12px;background:var(--bg);font-family:'Noto Naskh Arabic',serif;font-size:18px;line-height:2}
.credential-card{border-color:var(--primary-100)}
.credential-table td,.credential-table th{white-space:nowrap}
.live-room-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:620px}
.live-room-check{display:flex;align-items:center;gap:9px;font-size:13px;color:var(--text-2)}
.live-room-check input{width:18px;height:18px;accent-color:var(--primary)}
.live-room-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.live-room-card{min-width:0}
.live-room-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-width:0}
.live-room-head>div{min-width:0}
.live-room-head h2,.live-student-room-details h3{margin:5px 0 7px;font-size:17px;overflow-wrap:anywhere}
.live-room-code{font-family:var(--mono);letter-spacing:.1em;color:var(--primary);font-size:15px}
.live-room-meta{display:flex;flex-wrap:wrap;gap:7px 14px;margin-top:13px;color:var(--muted);font-size:12px}
.live-room-roster{margin-top:14px;padding-top:12px;border-top:1px solid var(--border-2)}
.live-room-person{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:38px;padding:5px 0;border-bottom:1px solid var(--border-2);font-size:13px}
.live-room-person:last-child{border-bottom:0}
.live-student-room{display:flex;flex-direction:column;gap:12px}
.live-student-room .student-section-head{margin-bottom:0}
.live-student-join-form{display:flex;align-items:flex-end;gap:12px;max-width:520px}
.live-room-code-input{font-family:var(--mono);font-size:18px;letter-spacing:.14em;text-transform:uppercase}
.live-room-card .row-wrap{gap:8px}
@media(max-width:640px){
  .student-topbar{height:60px;padding:0 12px}.student-topbar .brand{gap:7px}.student-topbar .brand small{font-size:9px}.student-topbar>.row{gap:6px}.student-topbar .btn{min-height:34px;padding:0 9px;font-size:12px}.student-welcome{display:none}.student-wrap{padding:18px 12px 34px;gap:14px}.student-page-head{align-items:flex-start;flex-direction:column}.student-profile-grid{grid-template-columns:1fr}.student-hero{align-items:flex-start;padding:16px}.student-hero>.badge{margin-left:76px}.student-main-nav{margin:0 -2px;padding:5px;border-radius:12px}.student-nav-link{min-height:38px;padding:0 11px;font-size:12px}.student-dashboard-grid{grid-template-columns:minmax(0,1fr)}.student-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.student-summary .stat{padding:12px}.student-stat-text{font-size:17px!important}.student-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.student-section-head{align-items:flex-start}.student-timeline-item{flex-wrap:wrap}.student-timeline-item time{margin-left:41px}
}
@media(max-width:760px){.live-room-list{grid-template-columns:minmax(0,1fr)}}
@media(max-width:520px){.live-room-form-grid{grid-template-columns:minmax(0,1fr)}.live-student-join-form{align-items:stretch;flex-direction:column}.live-student-join-form .btn{width:100%}.live-room-head{flex-direction:column;align-items:flex-start}.live-room-meta{flex-direction:column;gap:5px}}
@media print{
  /* Perbaikan print kredensial (putaran 8): blok @media print global di atas
     menyembunyikan #root dengan display:none — kartu kredensial ada di dalam
     #root sehingga ikut tidak dirender dan hasil print kosong. Kembalikan
     #root di mode ini dan sembunyikan #print-root yang kosong pada alur ini.
     Perbaikan putaran 10: aturan tampil di bawah memakai prefix #root agar
     spesifisitasnya (1,2,1) mengalahkan aturan sembunyi (1,1,1) — tanpa ini
     kartu tetap visibility:hidden dan print kosong SELALU. */
  body.print-student-credentials #root{display:block!important}
  body.print-student-credentials #print-root{display:none!important}
  body.print-student-credentials #root *{visibility:hidden!important}
  body.print-student-credentials #root .credential-card,body.print-student-credentials #root .credential-card *{visibility:visible!important}
  body.print-student-credentials .credential-card{position:absolute;left:0;top:0;width:100%;border:0;box-shadow:none}
  body.print-student-credentials .credential-card .btn{display:none!important}
}
/* Phase 4: Arabic game authoring and responsive play surface */
.game-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
.game-question-editor{border:1px solid var(--border);border-radius:12px;padding:14px;margin:10px 0;background:#fbfcfe;display:grid;gap:10px}
.game-check{display:inline-flex;align-items:center;gap:7px;padding:8px 10px;border:1px solid var(--border);border-radius:9px;font-size:13px;cursor:pointer}
.game-hud{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.game-question-card{max-width:820px;margin:0 auto}
.student-progress{height:8px;background:#e9edf4;border-radius:20px;overflow:hidden}.student-progress>div{height:100%;background:var(--primary);transition:width .2s ease}
.game-prompt{font-family:'Noto Naskh Arabic',serif;font-size:clamp(1.5rem,4vw,2.2rem);line-height:1.8;text-align:center;white-space:pre-wrap;padding:22px 8px;overflow-wrap:anywhere}
.game-choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:14px}
.game-choice{min-height:62px;padding:14px;border:1px solid var(--border);border-radius:12px;background:#fff;font:inherit;font-size:16px;text-align:start;cursor:pointer;overflow-wrap:anywhere;touch-action:manipulation}
.game-choice:hover,.game-choice.selected{border-color:var(--primary);background:#eef4ff;box-shadow:0 0 0 2px rgba(45,91,168,.12)}
.game-choice.arab{font-family:'Noto Naskh Arabic',serif;font-size:1.4rem;text-align:center}
.game-answer-line,.game-token-bank{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;min-height:52px;margin:10px 0;padding:10px;border-radius:12px;background:#f5f7fb}
.game-token{border:1px solid #dbe2ee;background:#fff;border-radius:9px;padding:10px 14px;min-height:44px;font:inherit;font-size:1.15rem;touch-action:manipulation;cursor:pointer}.game-token.selected{background:#e8efff;border-color:var(--primary)}
.game-feedback{margin-top:16px;padding:14px;border-radius:12px}.game-feedback.good{background:#ecfdf3;color:#166534}.game-feedback.bad{background:#fff7ed;color:#9a3412}
.game-media{display:block;max-width:100%;max-height:280px;object-fit:contain;margin:0 auto 12px;border-radius:10px}
.game-result{text-align:center;max-width:600px;margin:20px auto}.game-score{font-size:clamp(3rem,14vw,6rem);font-weight:800;line-height:1.2;color:var(--primary);margin:14px}.game-score small{font-size:1rem;color:var(--muted)}
.memory-board{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:16px}.memory-game-card{min-height:96px;border:1px solid var(--border);border-radius:12px;background:#eaf0fb;color:var(--primary);font-family:'Noto Naskh Arabic',serif;font-size:1.6rem;font-weight:700;padding:10px;overflow-wrap:anywhere;touch-action:manipulation}.memory-game-card.revealed{background:#fff;color:var(--text)}.memory-game-card.matched{background:#ecfdf3;border-color:#86efac;color:#166534}
.game-live-results{margin-top:14px;border-top:1px solid var(--border);padding-top:12px}
.game-move-count{max-width:820px;margin:-4px auto 12px;padding:0 4px;font-size:14px;color:var(--muted)}
.game-exit-shade{position:fixed;inset:0;background:rgba(15,23,42,.48);display:grid;place-items:center;padding:20px;z-index:1000}.game-exit-shade>.card{max-width:440px;width:100%}
@media(max-width:700px){.game-form-grid{grid-template-columns:minmax(0,1fr)}.game-choice-grid{grid-template-columns:minmax(0,1fr)}.memory-board{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.memory-game-card{min-height:78px;font-size:1.3rem}.game-hud{padding:10px;font-size:13px}.game-question-editor{padding:10px}.game-prompt{padding:14px 4px}}

