/* ==========================================================================
   Ditari 2 – design system
   Brand colour comes from settings via --brand / --brand-rgb (set in <head>)
   ========================================================================== */
@font-face{font-family:"Plus Jakarta Sans";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/PlusJakartaSans-400.woff2) format("woff2")}
@font-face{font-family:"Plus Jakarta Sans";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/PlusJakartaSans-500.woff2) format("woff2")}
@font-face{font-family:"Plus Jakarta Sans";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/PlusJakartaSans-600.woff2) format("woff2")}
@font-face{font-family:"Plus Jakarta Sans";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/PlusJakartaSans-700.woff2) format("woff2")}
@font-face{font-family:"Plus Jakarta Sans";font-style:normal;font-weight:800;font-display:swap;src:url(../fonts/PlusJakartaSans-800.woff2) format("woff2")}
:root{
  --brand:#5b4fe0; --brand-rgb:91,79,224;
  --brand-50:rgba(var(--brand-rgb),.07);
  --brand-100:rgba(var(--brand-rgb),.13);
  --brand-200:rgba(var(--brand-rgb),.24);
  --brand-dark:color-mix(in srgb,var(--brand) 78%,#000);
  --bg:#f3f4f8; --surface:#fff; --surface-2:#f7f8fb;
  --border:#e9ebf1; --border-strong:#dcdfe8;
  --text:#161a26; --text-2:#4a5163; --muted:#80879a;
  --green:#16a34a; --green-bg:#eaf8ef; --red:#dc2e3b; --red-bg:#fdecee;
  --amber:#b7791f; --amber-bg:#fdf4e3; --blue:#2563eb; --blue-bg:#eaf1fe;
  --purple:#8e4ec6; --purple-bg:#f5eefc; --pink:#c2338a; --pink-bg:#fcedf5; --teal:#0f8f80; --teal-bg:#e6f7f4;
  --radius:16px; --radius-sm:10px; --radius-xs:8px;
  --shadow-sm:0 1px 2px rgba(20,24,40,.04);
  --shadow:0 1px 2px rgba(20,24,40,.04),0 6px 24px -8px rgba(20,24,40,.08);
  --shadow-lg:0 20px 50px -12px rgba(20,24,40,.25);
  --sidebar-w:252px;
  --font:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;font-family:var(--font);font-size:14.5px;line-height:1.5;color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:none}
img{max-width:100%}
h1,h2,h3,h4{margin:0;line-height:1.25;letter-spacing:-.01em;color:var(--text)}
h1{font-size:24px;font-weight:700}
h2{font-size:19px;font-weight:700}
h3{font-size:16px;font-weight:700}
h4{font-size:14.5px;font-weight:600}
p{margin:0 0 .75em}
hr{border:0;border-top:1px solid var(--border);margin:18px 0}
.muted{color:var(--muted)} .text-2{color:var(--text-2)}
.small{font-size:12.5px} .tiny{font-size:11.5px}
.strong{font-weight:600}
.ico{flex:none;vertical-align:middle}
.hidden,[hidden]{display:none!important}
.nowrap{white-space:nowrap}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pad{padding:16px}
.mt-0{margin-top:0}.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:24px}
.mb-0{margin-bottom:0}.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}
.flex{display:flex;align-items:center;gap:10px}.flex-wrap{flex-wrap:wrap}.between{justify-content:space-between}.grow{flex:1;min-width:0}.col-flex{display:flex;flex-direction:column;gap:10px}
.gap-sm{gap:6px}.gap-lg{gap:18px}
.right{text-align:right}.center{text-align:center}
.inline{display:inline}

/* ---------- Shell ---------- */
.shell{display:flex;min-height:100vh}
.sidebar{width:var(--sidebar-w);flex:none;background:var(--surface);border-right:1px solid var(--border);position:sticky;top:0;height:100vh;display:flex;flex-direction:column;padding:22px 16px 14px;z-index:40}
.app-brand{display:flex;align-items:center;gap:10px;padding:2px 10px 18px;color:var(--text);min-height:44px}
.brand-logo{max-height:38px;max-width:190px;width:auto;display:block;object-fit:contain}
.brand-mark{width:34px;height:34px;border-radius:10px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:800;font-size:17px}
.brand-mark-img{width:34px;height:34px;border-radius:9px;object-fit:contain}
.brand-name{font-weight:800;font-size:20px;letter-spacing:-.02em}
.nav{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:2px;margin:0 -4px;padding:0 4px;scrollbar-width:thin}
.nav-label{font-size:10.5px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);padding:14px 12px 6px}
.nav-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:11px;color:var(--text-2);font-weight:500;transition:background .15s,color .15s}
.nav-item:hover{background:var(--surface-2);color:var(--text)}
.nav-item.active{background:var(--brand-50);color:var(--brand);font-weight:600}
.nav-item.active .ico{color:var(--brand)}
.nav-item span{flex:1}
.nav-count{flex:none!important;background:var(--brand);color:#fff;font-size:11px;font-weight:700;border-radius:20px;padding:1px 7px}
.sidebar-foot{display:flex;align-items:center;gap:10px;padding:14px 8px 0;border-top:1px solid var(--border);margin-top:10px}
.sf-text{display:flex;flex-direction:column;min-width:0;line-height:1.25}
.sf-text strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sf-text span{font-size:11.5px;color:var(--muted)}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{height:68px;display:flex;align-items:center;gap:14px;padding:0 28px;background:var(--surface);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:30}
.search{display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--border-strong);border-radius:11px;padding:0 12px;height:40px;width:min(380px,100%);color:var(--muted)}
.search:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-100)}
.search input{border:0;outline:0;background:transparent;font:inherit;flex:1;min-width:0;color:var(--text);padding:0}
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:6px}
.icon-btn{position:relative;width:40px;height:40px;border-radius:11px;border:0;background:transparent;display:grid;place-items:center;color:var(--text-2);cursor:pointer}
.icon-btn:hover{background:var(--surface-2);color:var(--text)}
.dot-badge{position:absolute;top:4px;right:3px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--red);color:#fff;font-size:10px;font-weight:700;display:grid;place-items:center;border:2px solid var(--surface)}
.user-chip{display:flex;align-items:center;gap:8px;border:0;background:transparent;padding:4px 8px 4px 4px;border-radius:12px;cursor:pointer;font:inherit;color:var(--text);font-weight:600}
.user-chip:hover{background:var(--surface-2)}
.content{padding:26px 28px 48px;max-width:1440px;width:100%}
@media (min-width:961px){.only-mobile{display:none!important}}
.sidebar-backdrop{display:none}
.mobile-brand{display:flex;align-items:center;gap:8px;color:var(--text)}
.mobile-brand img{height:32px;width:auto;max-width:140px;object-fit:contain}
.mobile-brand .brand-logo{max-height:30px}
.mobile-brand .brand-name{font-size:17px}

/* ---------- Dropdown ---------- */
.dropdown{position:relative}
.dropdown-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:230px;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow-lg);padding:6px;display:none;z-index:50}
.dropdown.open .dropdown-menu{display:block;animation:pop .14s ease-out}
@keyframes pop{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.dropdown-menu>a{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:9px;color:var(--text-2);font-weight:500}
.dropdown-menu>a:hover{background:var(--surface-2);color:var(--text)}
.dm-user{display:flex;flex-direction:column;gap:2px;padding:10px 10px 12px;border-bottom:1px solid var(--border);margin-bottom:6px}
.dm-user .chip{align-self:flex-start;margin-top:6px}
.notif-menu{width:360px;max-width:calc(100vw - 24px);padding:0}
.dm-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--border)}
.dm-foot{justify-content:center;border-top:1px solid var(--border);border-radius:0 0 14px 14px!important;color:var(--brand)!important;font-weight:600!important;padding:12px!important}
.notif-list{max-height:380px;overflow-y:auto}
.notif{display:flex;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);color:var(--text)}
.notif:last-child{border-bottom:0}
.notif:hover{background:var(--surface-2)}
.notif.unread{background:var(--brand-50)}
.notif-ico{width:34px;height:34px;flex:none;border-radius:10px;display:grid;place-items:center;background:var(--surface-2);color:var(--text-2)}
.notif-ico.t-payment{background:var(--amber-bg);color:var(--amber)}
.notif-ico.t-assignment{background:var(--blue-bg);color:var(--blue)}
.notif-ico.t-event{background:var(--pink-bg);color:var(--pink)}
.notif-ico.t-class{background:var(--teal-bg);color:var(--teal)}
.notif-ico.t-announcement{background:var(--brand-100);color:var(--brand)}
.notif-ico.t-grade,.notif-ico.t-certificate{background:var(--green-bg);color:var(--green)}
.notif-ico.t-material{background:var(--purple-bg);color:var(--purple)}
.notif b{font-weight:600;font-size:13.5px;display:block}
.notif p{margin:2px 0 0;font-size:12.5px;color:var(--text-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.notif time{font-size:11.5px;color:var(--muted)}
.link-btn{border:0;background:none;color:var(--brand);font:inherit;font-weight:600;font-size:12.5px;cursor:pointer;padding:0}

/* ---------- Page head ---------- */
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.page-head p{margin:4px 0 0}
.page-actions{display:flex;gap:8px;flex-wrap:wrap}
.back-link{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-weight:500;font-size:13px;margin-bottom:8px}
.back-link:hover{color:var(--text)}

/* ---------- Cards & grids ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow-sm);min-width:0}
.card+.card{margin-top:0}
.card-flush{padding:0;overflow:hidden}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}
.card-head h3{display:flex;align-items:center;gap:8px}
.card-head .see-more{font-size:13px;font-weight:600}
.card-flush .card-head{padding:18px 20px 0}
.card-sub{background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:14px}
.grid{display:grid;gap:18px}
.g-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.g-main{grid-template-columns:minmax(0,1fr) 340px;align-items:start}
.g-main-wide{grid-template-columns:minmax(0,1fr) 380px;align-items:start}
.stack{display:flex;flex-direction:column;gap:18px;min-width:0}
.fill-grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}

/* ---------- Stats ---------- */
.stat{display:flex;gap:14px;align-items:center}
.stat-ico{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;flex:none;background:var(--brand-50);color:var(--brand)}
.stat-ico.green{background:var(--green-bg);color:var(--green)}.stat-ico.amber{background:var(--amber-bg);color:var(--amber)}
.stat-ico.red{background:var(--red-bg);color:var(--red)}.stat-ico.blue{background:var(--blue-bg);color:var(--blue)}
.stat-ico.pink{background:var(--pink-bg);color:var(--pink)}.stat-ico.teal{background:var(--teal-bg);color:var(--teal)}
.stat-val{font-size:24px;font-weight:700;letter-spacing:-.02em;line-height:1.1}
.stat-label{color:var(--muted);font-size:12.5px;font-weight:500}
.stat-foot{font-size:12px;margin-top:2px}

/* ---------- Hero (brand) ---------- */
.hero{position:relative;overflow:hidden;border-radius:var(--radius);padding:22px;color:#fff;background:linear-gradient(135deg,var(--brand) 0%,color-mix(in srgb,var(--brand) 70%,#1b1340) 100%);box-shadow:0 12px 30px -12px rgba(var(--brand-rgb),.55)}
.hero::after{content:"";position:absolute;right:-60px;top:-60px;width:220px;height:220px;border-radius:50%;background:rgba(255,255,255,.08)}
.hero::before{content:"";position:absolute;right:40px;bottom:-90px;width:180px;height:180px;border-radius:50%;background:rgba(255,255,255,.06)}
.hero>*{position:relative;z-index:1}
.hero h2,.hero h3{color:#fff}
.hero .hero-kicker{font-size:12px;font-weight:600;opacity:.85;text-transform:uppercase;letter-spacing:.08em}
.hero .hero-meta{display:flex;flex-wrap:wrap;gap:14px;font-size:13px;opacity:.92;margin:10px 0 16px}
.hero .hero-meta span{display:inline-flex;align-items:center;gap:6px}
.hero .btn-white{background:#fff;color:var(--brand)}
.hero .btn-white:hover{background:#f3f1ff}
.hero .hero-logo{max-height:28px;opacity:.95;margin-bottom:14px}
.live-dot{display:inline-flex;align-items:center;gap:6px;background:rgba(255,255,255,.18);padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600}
.live-dot::before{content:"";width:7px;height:7px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 3px rgba(74,222,128,.3);animation:pulse 1.6s infinite}
@keyframes pulse{50%{box-shadow:0 0 0 6px rgba(74,222,128,0)}}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:11px;border:1px solid transparent;background:var(--brand);color:#fff;font:inherit;font-weight:600;font-size:13.5px;cursor:pointer;white-space:nowrap;transition:background .15s,box-shadow .15s,transform .05s;text-decoration:none}
.btn:hover{background:var(--brand-dark)}
.btn:active{transform:translateY(1px)}
.btn:focus-visible{outline:0;box-shadow:0 0 0 3px var(--brand-200)}
.btn-sm{height:32px;padding:0 11px;font-size:12.5px;border-radius:9px;gap:6px}
.btn-lg{height:48px;padding:0 22px;font-size:15px;border-radius:13px}
.btn-block{width:100%}
.btn-light{background:var(--surface);color:var(--text);border-color:var(--border-strong)}
.btn-light:hover{background:var(--surface-2)}
.btn-soft{background:var(--brand-50);color:var(--brand)}
.btn-soft:hover{background:var(--brand-100)}
.btn-ghost{background:transparent;color:var(--text-2)}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-dark{background:#111;color:#fff}.btn-dark:hover{background:#2a2a2a}
.btn-green{background:var(--green)}.btn-green:hover{background:#15803d}
.btn-danger{background:var(--red)}.btn-danger:hover{background:#b91c1c}
.btn.danger,.btn-ghost.danger{color:var(--red)}
.btn-ghost.danger:hover{background:var(--red-bg)}
.btn-icon{width:34px;padding:0}
.btn[disabled]{opacity:.55;pointer-events:none}
.btn-ghost span:empty{display:none}
.btn-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ---------- Forms ---------- */
.form{display:flex;flex-direction:column;gap:14px}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-grid .span-2{grid-column:span 2}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field>label,.label{font-size:12.5px;font-weight:600;color:var(--text-2)}
.hint{font-size:12px;color:var(--muted)}
.input,input:not([type]),input[type=text],input[type=email],input[type=password],input[type=number],input[type=date],input[type=time],input[type=datetime-local],input[type=url],input[type=tel],input[type=search]:not(.search input),input[type=color],select,textarea{
  width:100%;height:42px;padding:0 12px;border:1px solid var(--border-strong);border-radius:10px;background:var(--surface);font:inherit;font-size:14px;color:var(--text);outline:0;transition:border-color .15s,box-shadow .15s}
textarea{height:auto;min-height:92px;padding:10px 12px;resize:vertical;line-height:1.5}
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='%2380879a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:34px}
select[multiple]{height:auto;min-height:110px;padding:6px;background-image:none}
input[type=color]{padding:4px;width:56px;cursor:pointer}
input:focus,select:focus,textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-100)}
input[type=file]{font:inherit;font-size:13px;width:100%;padding:10px;border:1.5px dashed var(--border-strong);border-radius:12px;background:var(--surface-2);cursor:pointer}
input[type=file]::file-selector-button{font:inherit;font-weight:600;font-size:12.5px;border:0;border-radius:8px;padding:7px 12px;margin-right:10px;background:var(--brand-50);color:var(--brand);cursor:pointer}
.check{display:flex;align-items:flex-start;gap:10px;cursor:pointer;font-weight:500;color:var(--text)}
.check input{width:18px;height:18px;accent-color:var(--brand);margin:1px 0 0;flex:none}
.switch{position:relative;display:inline-flex;align-items:center;gap:12px;cursor:pointer}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch .track{width:40px;height:23px;background:var(--border-strong);border-radius:20px;position:relative;transition:background .15s;flex:none}
.switch .track::after{content:"";position:absolute;left:3px;top:3px;width:17px;height:17px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .15s}
.switch input:checked+.track{background:var(--brand)}
.switch input:checked+.track::after{transform:translateX(17px)}
.switch input:focus-visible+.track{box-shadow:0 0 0 3px var(--brand-200)}
.input-group{display:flex;gap:8px}
.input-icon{position:relative}
.input-icon .ico{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted)}
.input-icon input{padding-left:38px}
.form-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:4px}
.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.filters select,.filters input{width:auto;min-width:160px;height:38px}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:14px;background:var(--surface)}
.card .table-wrap{border-radius:12px}
.card-flush .table-wrap{border:0;border-radius:0}
table.table{width:100%;border-collapse:collapse;font-size:13.5px}
.table th{text-align:left;font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;font-weight:700;color:var(--muted);background:var(--surface-2);padding:11px 14px;border-bottom:1px solid var(--border);white-space:nowrap}
.table td{padding:12px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
.table tr:last-child td{border-bottom:0}
.table tbody tr:hover td{background:#fbfbfd}
.table .actions{text-align:right;white-space:nowrap}
.table .actions>*{margin-left:2px}
.cell-user{display:flex;align-items:center;gap:10px;min-width:180px}
.cell-user .meta{display:flex;flex-direction:column;line-height:1.3;min-width:0}
.cell-user .meta span{font-size:12px;color:var(--muted)}

/* ---------- Chips ---------- */
.chip{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600;line-height:1.5;white-space:nowrap;background:var(--surface-2);color:var(--text-2)}
.chip-brand{background:var(--brand-50);color:var(--brand)}
.chip-green{background:var(--green-bg);color:var(--green)}
.chip-red{background:var(--red-bg);color:var(--red)}
.chip-amber{background:var(--amber-bg);color:var(--amber)}
.chip-blue{background:var(--blue-bg);color:var(--blue)}
.chip-purple{background:var(--purple-bg);color:var(--purple)}
.chip-pink{background:var(--pink-bg);color:var(--pink)}
.chip-teal{background:var(--teal-bg);color:var(--teal)}
.chip-gray{background:#f1f2f5;color:#5d6475}
.chip-outline{background:transparent;border:1px solid var(--border-strong)}
.chips{display:flex;gap:6px;flex-wrap:wrap}

/* ---------- Progress ---------- */
.progress{height:7px;background:#eef0f5;border-radius:20px;overflow:hidden}
.progress span{display:block;height:100%;background:var(--brand);border-radius:20px;transition:width .4s}
.progress.green span{background:#34c77b}
.progress.thin{height:5px}
.progress-row{display:flex;align-items:center;gap:10px}
.progress-row .progress{flex:1}
.progress-row b{font-size:12.5px;min-width:36px;text-align:right}

/* ---------- Avatar ---------- */
.avatar{border-radius:50%;object-fit:cover;flex:none;display:inline-grid;place-items:center}
.avatar-initials{background:hsl(var(--h) 70% 93%);color:hsl(var(--h) 45% 35%);font-weight:700;letter-spacing:.02em}
.avatars{display:flex}.avatars .avatar{border:2px solid #fff;margin-left:-8px}.avatars .avatar:first-child{margin-left:0}

/* ---------- Alerts ---------- */
.alert{display:flex;align-items:center;gap:10px;padding:12px 14px;border-radius:12px;margin-bottom:18px;font-weight:500;border:1px solid transparent}
.alert span{flex:1}
.alert-success{background:var(--green-bg);color:#166534;border-color:#cdeed8}
.alert-error{background:var(--red-bg);color:#991b1b;border-color:#f8d3d7}
.alert-info{background:var(--blue-bg);color:#1e40af;border-color:#d3e2fd}
.alert-warn{background:var(--amber-bg);color:#92400e;border-color:#f6e2bb}
.alert-x{border:0;background:none;color:inherit;opacity:.6;cursor:pointer;padding:2px;display:grid}
.alert-x:hover{opacity:1}
.callout{display:flex;gap:12px;padding:14px;border-radius:12px;background:var(--surface-2);border:1px solid var(--border);font-size:13.5px}
.callout.brand{background:var(--brand-50);border-color:var(--brand-100)}
.callout.warn{background:var(--amber-bg);border-color:#f6e2bb}
.callout.danger{background:var(--red-bg);border-color:#f8d3d7}

/* ---------- Lists ---------- */
.list{display:flex;flex-direction:column}
.list-item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border);min-width:0}
.list-item:last-child{border-bottom:0;padding-bottom:0}
.list-item:first-child{padding-top:0}
.list-item .li-body{flex:1;min-width:0}
.list-item .li-title{font-weight:600;color:var(--text);display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.list-item .li-sub{font-size:12.5px;color:var(--muted);display:flex;align-items:center;gap:6px;flex-wrap:wrap}
a.list-item:hover .li-title{color:var(--brand)}
.boxed-list{display:flex;flex-direction:column;gap:10px}
.boxed{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);transition:border-color .15s,background .15s}
a.boxed:hover{border-color:var(--brand-200);background:var(--brand-50)}
.date-tile{width:46px;flex:none;border-radius:11px;border:1px solid var(--border);overflow:hidden;text-align:center;background:#fff}
.date-tile b{display:block;font-size:17px;line-height:1.1;padding:5px 0 3px}
.date-tile span{display:block;font-size:10px;font-weight:700;text-transform:uppercase;background:var(--red);color:#fff;padding:2px 0}
.date-tile.is-brand span{background:var(--brand)}

/* ---------- Tabs ---------- */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:20px;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{display:inline-flex;align-items:center;gap:7px;padding:10px 14px;color:var(--muted);font-weight:600;font-size:13.5px;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap}
.tab:hover{color:var(--text)}
.tab.active{color:var(--brand);border-bottom-color:var(--brand)}
.tab .count{background:var(--surface-2);border-radius:10px;padding:0 7px;font-size:11.5px;color:var(--text-2)}
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:11px;padding:3px;gap:2px;flex-wrap:wrap}
.seg a{padding:6px 12px;border-radius:8px;color:var(--text-2);font-weight:600;font-size:12.5px}
.seg a.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}

/* ---------- Modal ---------- */
dialog.modal{border:0;padding:0;border-radius:18px;width:min(560px,calc(100vw - 24px));max-height:calc(100vh - 40px);box-shadow:var(--shadow-lg);color:var(--text)}
dialog.modal.wide{width:min(780px,calc(100vw - 24px))}
dialog.modal::backdrop{background:rgba(17,20,33,.45);backdrop-filter:blur(2px)}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 22px;border-bottom:1px solid var(--border);position:sticky;top:0;background:#fff;z-index:1}
.modal-body{padding:20px 22px}
.modal-foot{display:flex;justify-content:flex-end;gap:8px;padding:14px 22px;border-top:1px solid var(--border);background:var(--surface-2)}
dialog.modal[open]{animation:modalIn .18s ease-out}
@keyframes modalIn{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}

/* ---------- Empty ---------- */
.empty-state{text-align:center;padding:36px 16px;color:var(--text-2)}
.empty-state h2,.empty-state h3{margin:12px 0 4px}
.empty-state .btn{margin-top:14px}
.empty-ico{width:56px;height:56px;border-radius:16px;background:var(--brand-50);color:var(--brand);display:inline-grid;place-items:center}
.card.empty-state{max-width:520px;margin:40px auto}

/* ---------- Course cards ---------- */
.course-thumb{border-radius:12px;display:inline-grid;place-items:center;flex:none;background:color-mix(in srgb,var(--cc) 13%,#fff);color:var(--cc);font-weight:800;overflow:hidden}
.course-thumb img{width:78%;height:78%;object-fit:contain}
.course-card{display:flex;flex-direction:column;gap:14px;padding:18px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);color:var(--text);transition:border-color .15s,box-shadow .15s,transform .15s;position:relative;overflow:hidden}
.course-card::before{content:"";position:absolute;inset:0 0 auto 0;height:4px;background:var(--cc)}
a.course-card:hover{border-color:var(--border-strong);box-shadow:var(--shadow);transform:translateY(-2px)}
.course-card h3{font-size:15.5px}
.course-card .cc-top{display:flex;gap:12px;align-items:flex-start}
.course-card .cc-meta{display:flex;flex-wrap:wrap;gap:12px;font-size:12.5px;color:var(--muted)}
.course-card .cc-meta span{display:inline-flex;align-items:center;gap:5px}
.course-banner{border-radius:var(--radius);padding:24px;background:linear-gradient(120deg,color-mix(in srgb,var(--cc) 12%,#fff),#fff 70%);border:1px solid var(--border);display:flex;gap:18px;align-items:center;flex-wrap:wrap;margin-bottom:20px}
.course-banner .cb-body{flex:1;min-width:240px}
.course-banner h1{font-size:23px}

/* ---------- Lesson timeline (progress) ---------- */
.lessons{display:flex;flex-direction:column}
.lesson{display:flex;gap:14px;align-items:flex-start;position:relative;padding:0 0 18px}
.lesson:not(:last-child)::before{content:"";position:absolute;left:12px;top:28px;bottom:2px;border-left:2px dashed var(--border-strong)}
.lesson.done:not(:last-child)::before{border-left-color:#8ddcb1}
.lesson-dot{width:26px;height:26px;border-radius:50%;border:2px solid var(--border-strong);background:#fff;display:grid;place-items:center;flex:none;color:#fff;cursor:default}
.lesson.done .lesson-dot{background:#34c77b;border-color:#34c77b}
button.lesson-dot{cursor:pointer;padding:0}
button.lesson-dot:hover{border-color:var(--brand)}
.lesson-body{flex:1;min-width:0;padding-top:2px}
.lesson-body b{font-weight:600;display:block}
.lesson.done .lesson-body b{color:var(--text-2)}

/* ---------- Files ---------- */
.file-badge{width:40px;height:46px;border-radius:9px;flex:none;display:grid;place-items:end center;padding-bottom:6px;font-size:9.5px;font-weight:800;letter-spacing:.03em;color:#fff;background:var(--fc);position:relative;clip-path:polygon(0 0,70% 0,100% 22%,100% 100%,0 100%)}
.file-badge::after{content:"";position:absolute;right:0;top:0;width:30%;height:22%;background:rgba(255,255,255,.35);border-bottom-left-radius:5px}
.file-card{display:flex;gap:14px;align-items:flex-start;padding:16px;border:1px solid var(--border);border-radius:14px;background:var(--surface);min-width:0}
.file-card:hover{border-color:var(--border-strong);box-shadow:var(--shadow)}
.file-card .fc-body{flex:1;min-width:0}
.file-card .fc-title{font-weight:600;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.file-card .fc-meta{font-size:12px;color:var(--muted);display:flex;flex-wrap:wrap;gap:4px 10px;margin-top:2px}
.file-card .chips{margin-top:8px}
.file-card .fc-actions{display:flex;gap:4px;flex:none}

/* ---------- Bar chart ---------- */
.bars{display:flex;align-items:flex-end;gap:12px;height:190px;padding:10px 0 0;border-bottom:1px solid var(--border);position:relative}
.bars .bar{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:6px;position:relative}
.bars .bar i{display:block;width:100%;max-width:46px;border-radius:9px 9px 4px 4px;background:#e6e8f0;min-height:4px;transition:background .15s}
.bars .bar.hl i,.bars .bar:hover i{background:var(--brand)}
.bars .bar em{position:absolute;top:-4px;transform:translateY(-100%);font-style:normal;font-size:11px;font-weight:700;background:#111;color:#fff;border-radius:6px;padding:2px 7px;white-space:nowrap;opacity:0;transition:opacity .15s;pointer-events:none}
.bars .bar:hover em,.bars .bar.hl em{opacity:1}
.bar-labels{display:flex;gap:12px;margin-top:8px}
.bar-labels span{flex:1;text-align:center;font-size:12px;color:var(--muted);font-weight:500}
.bar-labels span.hl{color:var(--text);font-weight:700}

/* ---------- Chat ---------- */
.chat{display:grid;grid-template-columns:320px minmax(0,1fr);height:calc(100vh - 68px - 26px - 48px - 70px);min-height:480px;padding:0;overflow:hidden}
.chat-side{border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0}
.chat-side .cs-head{padding:16px;border-bottom:1px solid var(--border)}
.chat-list{overflow-y:auto;flex:1}
.chat-contact{display:flex;gap:11px;align-items:center;padding:12px 16px;color:var(--text);border-bottom:1px solid var(--border);position:relative}
.chat-contact:hover{background:var(--surface-2)}
.chat-contact.active{background:var(--brand-50)}
.chat-contact.active::before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:3px;border-radius:3px;background:var(--brand)}
.chat-contact .cc-body{flex:1;min-width:0}
.chat-contact .cc-name{font-weight:600;display:flex;justify-content:space-between;gap:8px}
.chat-contact .cc-name time{font-weight:500;font-size:11px;color:var(--muted)}
.chat-contact .cc-last{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-contact .cc-course{font-size:11px;color:var(--brand);font-weight:600}
.chat-contact .unread{background:var(--brand);color:#fff;font-size:11px;font-weight:700;border-radius:10px;padding:0 7px}
.chat-main{display:flex;flex-direction:column;min-height:0;background:linear-gradient(#fafbfd,#f6f7fb)}
.chat-head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--border);background:#fff}
.chat-msgs{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:6px}
.msg{max-width:72%;display:flex;flex-direction:column;align-items:flex-start}
.msg .bubble{padding:9px 13px;border-radius:16px 16px 16px 5px;background:#fff;border:1px solid var(--border);white-space:pre-wrap;word-wrap:break-word;overflow-wrap:anywhere;font-size:14px}
.msg time{font-size:10.5px;color:var(--muted);margin:2px 6px 6px}
.msg.me{align-self:flex-end;align-items:flex-end}
.msg.me .bubble{background:var(--brand);color:#fff;border-color:transparent;border-radius:16px 16px 5px 16px}
.msg.me .bubble a{color:#fff;text-decoration:underline}
.msg-day{align-self:center;font-size:11.5px;font-weight:600;color:var(--muted);background:#fff;border:1px solid var(--border);border-radius:20px;padding:2px 12px;margin:10px 0}
.chat-input{display:flex;gap:10px;padding:14px;border-top:1px solid var(--border);background:#fff;align-items:flex-end}
.chat-input textarea{min-height:44px;height:44px;max-height:140px;resize:none;border-radius:12px}
.chat-input .btn{height:44px;width:44px;padding:0;flex:none}
.chat-empty{margin:auto;text-align:center;color:var(--muted);padding:30px}

/* ---------- Calendar ---------- */
.week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px}
.day-col{background:var(--surface);border:1px solid var(--border);border-radius:14px;min-height:220px;display:flex;flex-direction:column;overflow:hidden}
.day-col.today{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-50)}
.day-head{padding:10px 12px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:baseline}
.day-head b{font-size:13px}.day-head span{font-size:20px;font-weight:700}
.day-col.today .day-head span{color:var(--brand)}
.day-items{padding:8px;display:flex;flex-direction:column;gap:6px}
.cal-item{display:block;border-radius:9px;padding:7px 9px;font-size:12px;line-height:1.35;background:var(--surface-2);color:var(--text);border-left:3px solid var(--cc,var(--brand))}
.cal-item b{display:block;font-weight:600;font-size:12.5px}
.cal-item.k-class{background:color-mix(in srgb,var(--cc) 9%,#fff)}
.cal-item.k-deadline{--cc:#2563eb;background:var(--blue-bg)}
.cal-item.k-event{--cc:#c2338a;background:var(--pink-bg)}
.cal-item.k-payment{--cc:#b7791f;background:var(--amber-bg)}

/* ---------- Quiz ---------- */
.quiz-q{padding:20px;border:1px solid var(--border);border-radius:16px;background:var(--surface)}
.quiz-q+.quiz-q{margin-top:14px}
.quiz-q .qn{font-size:12px;font-weight:700;color:var(--brand);text-transform:uppercase;letter-spacing:.06em}
.quiz-q h3{margin:6px 0 14px;font-weight:600;font-size:16px;line-height:1.45;white-space:pre-wrap}
.opt{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1.5px solid var(--border);border-radius:12px;cursor:pointer;margin-top:8px;transition:border-color .12s,background .12s}
.opt:hover{border-color:var(--brand-200)}
.opt input{accent-color:var(--brand);width:18px;height:18px;flex:none;margin:0}
.opt:has(input:checked){border-color:var(--brand);background:var(--brand-50)}
.letter{width:26px;height:26px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center;font-weight:700;font-size:12px;color:var(--text-2);flex:none}
.opt:has(input:checked) .letter{background:var(--brand);color:#fff}
.opt.correct{border-color:#34c77b;background:var(--green-bg)}
.opt.wrong{border-color:#f19ca3;background:var(--red-bg)}
.quiz-bar{position:sticky;top:68px;z-index:5;background:rgba(243,244,248,.97);backdrop-filter:blur(6px);padding:12px 0;margin-bottom:12px;display:flex;align-items:center;gap:14px}
.timer{display:inline-flex;align-items:center;gap:6px;font-weight:700;background:#fff;border:1px solid var(--border);border-radius:10px;padding:6px 12px;font-variant-numeric:tabular-nums}
.timer.low{color:var(--red);border-color:#f8d3d7;background:var(--red-bg)}
.result-ring{--p:0;width:170px;height:170px;border-radius:50%;background:conic-gradient(var(--brand) calc(var(--p)*1%),#eceef4 0);display:grid;place-items:center;margin:0 auto}
.result-ring>div{width:136px;height:136px;border-radius:50%;background:#fff;display:grid;place-items:center;text-align:center}
.result-ring b{font-size:34px;letter-spacing:-.03em;display:block;line-height:1}
.level-badge{display:inline-flex;align-items:center;gap:8px;background:var(--brand);color:#fff;border-radius:14px;padding:10px 20px;font-size:22px;font-weight:800;letter-spacing:.02em}
.q-edit{border:1px solid var(--border);border-radius:14px;padding:16px;background:var(--surface)}
.q-edit+.q-edit{margin-top:12px}
.opt-row{display:flex;gap:8px;align-items:center;margin-top:8px}
.opt-row input[type=text]{flex:1}
.opt-row label.correct-pick{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--text-2);white-space:nowrap}
.opt-row input[type=radio]{accent-color:var(--green);width:17px;height:17px}

/* ---------- Certificate ---------- */
.cert-wrap{max-width:980px;margin:0 auto}
.cert{aspect-ratio:1.414;background:#fff;border-radius:22px;padding:14px;box-shadow:var(--shadow)}
.cert-inner{height:100%;border:10px solid var(--brand);border-radius:18px;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:4% 7% 12%}
.cert-inner::before,.cert-inner::after{content:"";position:absolute;top:18px;width:14px;height:14px;border-radius:50%;background:var(--brand)}
.cert-inner::before{left:18px}.cert-inner::after{right:18px}
.cert-logo{max-height:9%;max-width:32%;margin-bottom:3%}
.cert-kicker{color:var(--text-2);font-size:clamp(11px,1.5vw,16px);letter-spacing:.12em;text-transform:uppercase;font-weight:600}
.cert-course{font-size:clamp(20px,4.2vw,44px);font-weight:800;letter-spacing:-.02em;margin:1.2% 0 2.4%;line-height:1.1}
.cert-issued{color:var(--muted);font-size:clamp(11px,1.4vw,15px)}
.cert-name{font-size:clamp(18px,3.1vw,32px);font-weight:700;margin:.6% 0 2.4%}
.cert-text{color:var(--text-2);font-size:clamp(10px,1.3vw,14px);max-width:62%;line-height:1.55}
.cert-foot{position:absolute;left:6%;right:6%;bottom:6%;display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.cert-foot .sig{text-align:left;font-size:clamp(9px,1.1vw,13px);color:var(--text-2)}
.cert-foot .sig img{max-height:clamp(24px,5vw,54px);display:block;margin-bottom:4px}
.cert-foot .sig b{display:block;color:var(--text)}
.cert-foot .mid img{max-height:clamp(18px,3vw,34px)}
.cert-foot .qr{text-align:right;font-size:clamp(9px,1.05vw,12.5px);color:var(--text-2)}
.cert-foot .qr svg{width:clamp(44px,8vw,92px);height:auto;display:block;margin-left:auto;margin-bottom:4px}
.cert-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:space-between;margin-top:16px}
.cert-mini{aspect-ratio:1.414;border-radius:12px;border:5px solid var(--brand);background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:10px;font-size:11px}
.cert-mini b{font-size:14px;margin:4px 0}

/* ---------- Auth ---------- */
.auth{min-height:100vh;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);background:var(--surface)}
.auth-form{display:flex;flex-direction:column;justify-content:center;padding:48px clamp(24px,7vw,110px);min-width:0}
.auth-form .app-brand{padding:0;margin-bottom:40px}
.auth-form .brand-logo{max-height:44px}
.auth-form h1{font-size:28px;margin-bottom:6px}
.auth-form .form{margin-top:26px;max-width:420px}
.auth-art{margin:14px;border-radius:26px;background:linear-gradient(145deg,var(--brand),color-mix(in srgb,var(--brand) 60%,#140d33));color:#fff;padding:48px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden}
.auth-art::before{content:"";position:absolute;width:420px;height:420px;border-radius:50%;background:rgba(255,255,255,.07);right:-140px;top:-120px}
.auth-art::after{content:"";position:absolute;width:300px;height:300px;border-radius:50%;background:rgba(255,255,255,.05);left:-80px;bottom:-110px}
.auth-art>*{position:relative;z-index:1}
.auth-art h2{color:#fff;font-size:30px;line-height:1.2;max-width:440px;margin-bottom:12px}
.auth-art p{opacity:.85;max-width:420px}
.auth-art .brand-logo{max-height:40px}
.auth-cards{display:grid;gap:12px;max-width:380px}
.auth-card{background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.18);border-radius:16px;padding:14px 16px;display:flex;gap:12px;align-items:center;backdrop-filter:blur(4px)}
.auth-card .ai{width:38px;height:38px;border-radius:11px;background:#fff;color:var(--brand);display:grid;place-items:center;flex:none}
.auth-card b{display:block}.auth-card span{font-size:12.5px;opacity:.85}
.auth-foot{margin-top:24px;color:var(--muted);font-size:13px}
.divider{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px}
.divider::before,.divider::after{content:"";flex:1;border-top:1px solid var(--border)}

/* ---------- Settings / branding ---------- */
.logo-slot{display:grid;grid-template-columns:190px minmax(0,1fr);gap:18px;align-items:center;padding:16px;border:1px solid var(--border);border-radius:14px}
.logo-slot+.logo-slot{margin-top:12px}
.logo-preview{height:110px;border-radius:12px;display:grid;place-items:center;padding:14px;background:repeating-conic-gradient(#f1f2f6 0 25%,#fff 0 50%) 0 0/16px 16px;border:1px solid var(--border)}
.logo-preview.dark{background:linear-gradient(135deg,var(--brand),color-mix(in srgb,var(--brand) 60%,#140d33))}
.logo-preview img{max-width:100%;max-height:80px;object-fit:contain}
.swatches{display:flex;gap:8px;flex-wrap:wrap}
.swatch{width:32px;height:32px;border-radius:10px;border:2px solid #fff;box-shadow:0 0 0 1px var(--border-strong);cursor:pointer}
.perm-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:13px 0;border-bottom:1px solid var(--border)}
.perm-row:last-child{border-bottom:0}
.code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:8px 10px;word-break:break-all;display:block}
kbd,code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;background:var(--surface-2);border-radius:5px;padding:1px 5px}

/* ---------- Misc ---------- */
.kv{display:grid;grid-template-columns:auto 1fr;gap:8px 16px;font-size:13.5px}
.kv dt{color:var(--muted)}.kv dd{margin:0;font-weight:500}
.dl-row{display:flex;justify-content:space-between;gap:10px;padding:9px 0;border-bottom:1px dashed var(--border);font-size:13.5px}
.dl-row:last-child{border-bottom:0}
.dl-row span{color:var(--muted)}
.announce{padding:16px;border:1px solid var(--border);border-radius:14px;background:var(--surface)}
.announce+.announce{margin-top:12px}
.announce.pinned{border-color:var(--brand-200);background:linear-gradient(var(--brand-50),#fff 60%)}
.announce .a-head{display:flex;gap:10px;align-items:center;margin-bottom:8px}
.announce .a-body{color:var(--text-2);white-space:pre-wrap;overflow-wrap:anywhere}
.pay-card{border-radius:var(--radius);padding:20px;border:1px solid var(--border);background:var(--surface)}
.pay-amount{font-size:28px;font-weight:800;letter-spacing:-.03em}
.pagination{display:flex;gap:6px;justify-content:center;margin-top:16px}
.pagination a,.pagination span{min-width:34px;height:34px;display:grid;place-items:center;border-radius:9px;border:1px solid var(--border);background:#fff;color:var(--text-2);font-weight:600;font-size:13px;padding:0 8px}
.pagination .active{background:var(--brand);color:#fff;border-color:var(--brand)}
.search-group+.search-group{margin-top:18px}
.drag-handle{cursor:grab;color:var(--muted)}
.sticky-top{position:sticky;top:88px}
.celebrate{position:relative;overflow:hidden}
.celebrate::after{content:"";position:absolute;inset:0;pointer-events:none;background:
 radial-gradient(circle at 12% 20%,#f59e0b 0 3px,transparent 4px),radial-gradient(circle at 88% 26%,#ec4899 0 3px,transparent 4px),
 radial-gradient(circle at 78% 82%,#22c55e 0 3px,transparent 4px),radial-gradient(circle at 20% 78%,#3b82f6 0 3px,transparent 4px),
 radial-gradient(circle at 55% 12%,var(--brand) 0 2.5px,transparent 3.5px)}

/* ---------- Responsive ---------- */
@media (max-width:1200px){
  .g-4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .g-main,.g-main-wide{grid-template-columns:minmax(0,1fr)}
  .week{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (max-width:960px){
  .sidebar{position:fixed;left:0;top:0;transform:translateX(-102%);transition:transform .22s ease;box-shadow:var(--shadow-lg)}
  body.sidebar-open .sidebar{transform:none}
  body.sidebar-open .sidebar-backdrop{display:block;position:fixed;inset:0;background:rgba(17,20,33,.4);z-index:35}
  .topbar{padding:0 16px;gap:8px}
  .content{padding:20px 16px 40px}
  .g-3{grid-template-columns:minmax(0,1fr)}
  .auth{grid-template-columns:1fr}
  .auth-art{display:none}
  .chat{grid-template-columns:1fr;height:calc(100vh - 68px - 40px - 60px)}
  .chat.has-active .chat-side{display:none}
  .chat:not(.has-active) .chat-main{display:none}
  .uc-name{display:none}
  .week{grid-template-columns:repeat(2,minmax(0,1fr))}
  .logo-slot{grid-template-columns:1fr}
}
@media (max-width:640px){
  .g-2,.form-grid{grid-template-columns:minmax(0,1fr)}
  .g-4{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .g-4>.stat{flex-direction:column;align-items:flex-start;gap:10px;padding:16px}
  .g-4 .stat-val{font-size:20px}
  .boxed{flex-wrap:wrap}
  .boxed>.li-body,.boxed>.grow{min-width:55%}
  .table td,.table th{padding:10px}
  .form-grid .span-2{grid-column:auto}
  .search{display:none}
  h1{font-size:21px}
  .week{grid-template-columns:1fr}
  .day-col{min-height:0}
  .filters select,.filters input{min-width:0;flex:1 1 140px}
  .msg{max-width:88%}
  .cert{padding:6px;border-radius:14px}.cert-inner{border-width:5px;border-radius:12px}
  .page-head{align-items:flex-start}
}
@media print{
  .sidebar,.topbar,.no-print,.cert-actions{display:none!important}
  body{background:#fff}.content{padding:0}
  .cert{box-shadow:none}
}
/* attendance radio chips */
.att-opt{cursor:pointer}
.att-opt input{position:absolute;opacity:0;width:0;height:0}
.att-opt .chip{opacity:.35;transition:opacity .12s;border:1.5px solid transparent}
.att-opt input:checked+.chip{opacity:1;border-color:currentColor}
.att-opt:hover .chip{opacity:.8}
