/* ClassMeet UI */
:root{
  --bg:#f4f6fb;--card:#fff;--text:#0f172a;--muted:#64748b;--border:#e6e9f2;
  --primary:#6366f1;--primary-d:#4f46e5;--primary-soft:#eef0ff;--grad:linear-gradient(135deg,#6366f1,#8b5cf6);
  --danger:#e11d48;--ok:#16a34a;--sidebar:#0f172a;
  --radius:14px;--shadow:0 1px 2px rgba(15,23,42,.05),0 4px 16px rgba(15,23,42,.05);
}
.theme-student{--primary:#0d9488;--primary-d:#0f766e;--primary-soft:#e6f7f5;--grad:linear-gradient(135deg,#0d9488,#22c1a8)}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--text);line-height:1.55;-webkit-font-smoothing:antialiased}
a{color:var(--primary);text-decoration:none}a:hover{text-decoration:underline}
h1{font-size:1.7rem;margin:0 0 .25rem;letter-spacing:-.02em}
h2{font-size:1.15rem;margin:1.8rem 0 .9rem}
h3{margin:.4rem 0;font-size:1.05rem}
.icon{width:18px;height:18px;flex:none}
.muted{color:var(--muted)}.small{font-size:.85rem}

/* App shell */
.shell{display:flex;min-height:100vh}
.sidebar{width:260px;background:var(--sidebar);color:#cbd5e1;padding:1.25rem 1rem;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;flex:none}
.brand{display:flex;align-items:center;gap:.6rem;font-weight:800;font-size:1.2rem;color:#fff;letter-spacing:-.02em}
.brand:hover{text-decoration:none}
.brand-mark{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--grad);color:#fff;font-weight:800}
.side-label{margin:1.5rem .6rem .5rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:#64748b}
.side-nav{display:flex;flex-direction:column;gap:.2rem;flex:1}
.side-nav a{display:flex;align-items:center;gap:.7rem;padding:.65rem .8rem;border-radius:10px;color:#cbd5e1;font-weight:500}
.side-nav a:hover{background:rgba(255,255,255,.06);text-decoration:none;color:#fff}
.side-nav a.active{background:var(--grad);color:#fff;box-shadow:0 6px 16px rgba(99,102,241,.35)}
.side-user{display:flex;align-items:center;gap:.7rem;padding:.8rem;border-radius:12px;background:rgba(255,255,255,.06)}
.side-user form{margin:0}
.side-user-info{min-width:0;flex:1}.side-user-info strong,.side-user-info small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.side-user-info strong{color:#fff;font-size:.9rem}.side-user-info small{color:#94a3b8;font-size:.75rem}
.avatar{width:38px;height:38px;border-radius:50%;object-fit:cover;flex:none}
.avatar-fallback{display:grid;place-items:center;background:var(--grad);color:#fff;font-weight:700;font-size:.85rem}
.icon-btn{background:transparent;border:0;color:#94a3b8;cursor:pointer;padding:.4rem;border-radius:8px;display:grid;place-items:center}
.icon-btn:hover{background:rgba(255,255,255,.1);color:#fff}
.content{flex:1;min-width:0}
.page{max-width:1100px;margin:0 auto;padding:2rem 1.75rem 4rem}
.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap;margin-bottom:1.5rem}
.page-head p{margin:0}

/* Cards, grid */
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:1.2rem;margin-bottom:1rem;box-shadow:var(--shadow)}
.card h2:first-child{margin-top:0}
.card-link{display:block;color:inherit;transition:transform .15s,box-shadow .15s,border-color .15s}
.card-link:hover{text-decoration:none;transform:translateY(-2px);border-color:var(--primary);box-shadow:0 10px 28px rgba(15,23,42,.1)}
.accent{border-top:4px solid var(--primary)}
.accent-live{border-top:4px solid var(--danger)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:1rem}
.grid .card{margin:0}
.card.empty{display:flex;flex-direction:column;align-items:center;gap:.4rem;padding:2rem;color:var(--muted);border-style:dashed;box-shadow:none}
.card.empty .icon{width:28px;height:28px}.card.empty p{margin:0}
.card.center{text-align:center;max-width:480px;margin:4rem auto}
.error-code{font-size:4rem;font-weight:800;background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1rem}
.stat{display:flex;align-items:center;gap:1rem;margin:0}
.stat>div{display:flex;flex-direction:column}
.stat-num{font-size:1.8rem;font-weight:800;line-height:1.1}
.stat-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:12px;background:var(--primary-soft);color:var(--primary)}
.stat-icon .icon{width:22px;height:22px}
.stat-icon.s2{background:#fff4e5;color:#f59e0b}.stat-icon.s3{background:#e8f8ee;color:#16a34a}
.live-banner{border-left:4px solid var(--danger);background:linear-gradient(90deg,#fff1f3,#fff)}

/* Buttons & badges */
.btn{display:inline-flex;align-items:center;gap:.4rem;justify-content:center;background:var(--grad);color:#fff;border:0;padding:.55rem 1.05rem;border-radius:10px;font-size:.92rem;font-weight:600;cursor:pointer;font-family:inherit;box-shadow:0 4px 12px rgba(99,102,241,.25);transition:transform .1s,filter .15s}
.theme-student .btn{box-shadow:0 4px 12px rgba(13,148,136,.25)}
.btn:hover{filter:brightness(1.07);text-decoration:none;transform:translateY(-1px)}
.btn:disabled{opacity:.6;cursor:wait}
.btn-sm{padding:.3rem .7rem;font-size:.82rem;border-radius:8px}
.btn-block{width:100%}
.btn-ghost{background:#fff;color:var(--text);border:1px solid var(--border);box-shadow:none}.btn-ghost:hover{background:#f8fafc;filter:none}
.btn-danger{background:var(--danger);box-shadow:0 4px 12px rgba(225,29,72,.25)}
.btn-google{background:#fff;color:var(--text);border:1px solid var(--border);box-shadow:var(--shadow);padding:.75rem 1.2rem;margin:1.2rem 0 .8rem}
.badge{display:inline-block;padding:.12rem .6rem;border-radius:999px;background:var(--primary-soft);color:var(--primary);font-size:.72rem;font-weight:700}
.badge-live{background:#ffe4e9;color:var(--danger)}.badge-ok{background:#dcfce7;color:var(--ok)}.badge-off{background:#f1f5f9;color:var(--muted)}
.badge-live::before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--danger);margin-right:.35rem;animation:pulse 1.4s infinite}
@keyframes pulse{50%{opacity:.25}}
.alert{padding:.8rem 1rem;border-radius:10px;margin-bottom:1rem;font-size:.92rem}
.alert-success{background:#dcfce7;color:#166534}.alert-error{background:#ffe4e9;color:#9f1239}.alert-info{background:#e0e7ff;color:#3730a3}
.toast{position:fixed;top:1rem;right:1rem;z-index:50;max-width:360px;box-shadow:var(--shadow)}

/* Layout helpers, tables, forms */
.row-between{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap}
.actions{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}.actions form{margin:0}
.table-wrap{overflow-x:auto;padding:0}
table{width:100%;border-collapse:collapse}
th,td{padding:.85rem 1.1rem;text-align:left;border-bottom:1px solid var(--border);white-space:nowrap}
th{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);background:#f8fafc}
tbody tr:hover{background:#fafbff}tr:last-child td{border-bottom:0}
.form{max-width:620px}.form label{display:block;margin-bottom:1.1rem;font-weight:600;font-size:.92rem}
input[type=text],input[type=email],input[type=search],textarea{width:100%;padding:.65rem .8rem;border:1px solid var(--border);border-radius:10px;font:inherit;margin-top:.3rem;background:#fff}
input:focus,textarea:focus{outline:2px solid var(--primary);outline-offset:0;border-color:transparent}
.form small{display:block;margin-top:.25rem;font-weight:400}.error{color:var(--danger)}
.check{display:flex;align-items:center;gap:.55rem;font-weight:400!important}
fieldset{border:1px solid var(--border);border-radius:10px;margin:0 0 1.1rem}
.checks{max-height:280px;overflow:auto}
.search{display:flex;gap:.5rem;margin-bottom:1rem;max-width:440px}.search input{margin:0}
.pager{display:flex;gap:1rem;align-items:center;justify-content:center;margin-top:1rem}
.list{list-style:none;padding:0;margin:.5rem 0}.list li{padding:.55rem 0;border-bottom:1px solid var(--border)}.list li:last-child{border:0}
.meeting{padding:.8rem 0;border-bottom:1px solid var(--border)}.meeting:last-child{border:0}
.share{display:flex;gap:.4rem;margin-top:.6rem;max-width:520px}.share input{margin:0}

/* Meeting room */
.room-top{display:flex;justify-content:space-between;align-items:center;padding:.6rem 1.2rem;background:var(--sidebar);color:#cbd5e1}
.room-main{padding:.75rem 1rem 1rem}
.room-bar{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;padding:.2rem 0 .8rem}
.room-title{font-size:1.1rem}
.room-layout{display:grid;grid-template-columns:1fr;gap:1rem}
.room-layout:has(.participants){grid-template-columns:1fr 280px}
.jitsi{width:100%;height:calc(100vh - 170px);min-height:480px;background:#0b1020;border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.participants{margin:0;height:fit-content}
.participants .list li{font-size:.9rem}
.player{width:100%;max-height:75vh;background:#000;border-radius:10px}

/* Auth */
.auth-main{min-height:100vh}
.auth-split{display:grid;grid-template-columns:1.1fr 1fr;min-height:100vh}
.auth-hero{background:var(--grad);color:#fff;padding:3rem;display:flex;flex-direction:column;justify-content:center;gap:1rem;position:relative;overflow:hidden}
.auth-hero::after{content:"";position:absolute;right:-120px;bottom:-120px;width:360px;height:360px;border-radius:50%;background:rgba(255,255,255,.1)}
.auth-hero .brand{position:absolute;top:2rem;left:3rem}
.auth-hero h1{font-size:2.6rem;line-height:1.15;margin:0}
.auth-hero p{max-width:420px;opacity:.9;margin:0}
.hero-points{list-style:none;padding:0;margin:1rem 0 0;display:grid;gap:.7rem}
.hero-points li{display:flex;align-items:center;gap:.7rem;opacity:.95}
.hero-points .icon{background:rgba(255,255,255,.18);border-radius:8px;padding:6px;width:32px;height:32px}
.auth-panel{display:flex;flex-direction:column;justify-content:center;padding:3rem;max-width:480px;width:100%;margin:0 auto}
.auth-panel h2{font-size:1.7rem;margin:.6rem 0 .3rem}
.auth-student{--primary:#0d9488;--primary-soft:#e6f7f5;--grad:linear-gradient(135deg,#0d9488,#22c1a8)}
.role-card{display:flex;align-items:center;gap:1rem;padding:1rem 1.1rem;margin-top:1rem;border:1px solid var(--border);border-radius:14px;background:#fff;color:var(--text);box-shadow:var(--shadow);transition:.15s}
.role-card:hover{text-decoration:none;border-color:var(--primary);transform:translateY(-2px)}
.role-card small{display:block;color:var(--muted)}
.role-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:12px;background:#eef0ff;color:#6366f1}
.role-icon.role-student{background:#e6f7f5;color:#0d9488}
.role-icon .icon{width:22px;height:22px}

@media(max-width:900px){
  .shell{flex-direction:column}
  .sidebar{width:100%;height:auto;position:static;flex-direction:row;flex-wrap:wrap;align-items:center;gap:.6rem;padding:.8rem 1rem}
  .side-label,.side-user-info{display:none}
  .side-nav{flex-direction:row;flex:1;overflow-x:auto}
  .side-user{padding:.3rem;background:transparent}
  .page{padding:1.25rem 1rem 3rem}
  .auth-split{grid-template-columns:1fr}
  .auth-hero{padding:5rem 1.5rem 2rem}.auth-hero .brand{left:1.5rem;top:1.5rem}.auth-hero h1{font-size:1.9rem}
  .auth-panel{padding:2rem 1.5rem}
  .room-layout:has(.participants){grid-template-columns:1fr}
}

.rec-live{color:var(--danger);font-weight:600}
.rec-live::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--danger);margin-right:.4rem;animation:pulse 1.2s infinite}

/* Modal dialogs */
.modal-backdrop{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:1rem;background:rgba(15,23,42,.55);backdrop-filter:blur(3px);animation:fadeIn .15s ease}
.modal-backdrop.closing{opacity:0;transition:opacity .15s}
.modal{background:#fff;border-radius:18px;padding:1.8rem 1.6rem 1.4rem;width:100%;max-width:420px;text-align:center;box-shadow:0 24px 60px rgba(15,23,42,.35);animation:popIn .18s ease}
.modal-icon{width:60px;height:60px;border-radius:50%;margin:0 auto 1rem;display:grid;place-items:center}
.modal-icon svg{width:30px;height:30px}
.modal-icon-info,.modal-icon-question{background:var(--primary-soft);color:var(--primary)}
.modal-icon-success{background:#dcfce7;color:var(--ok)}
.modal-icon-warning{background:#fef3c7;color:#d97706}
.modal-icon-error,.modal-icon-danger{background:#ffe4e9;color:var(--danger)}
.modal-title{margin:0 0 .4rem;font-size:1.25rem}
.modal-text{margin:0 0 1.4rem;color:var(--muted)}
.modal-actions{display:flex;gap:.6rem;justify-content:center}
.modal-actions .btn{min-width:110px}
@keyframes fadeIn{from{opacity:0}}
@keyframes popIn{from{opacity:0;transform:scale(.94) translateY(8px)}}

/* Toasts */
.toasts{position:fixed;top:1rem;right:1rem;z-index:1100;display:flex;flex-direction:column;gap:.6rem;max-width:min(380px,calc(100vw - 2rem))}
.toast-item{display:flex;align-items:center;gap:.7rem;background:#fff;border:1px solid var(--border);border-left:4px solid var(--primary);border-radius:12px;padding:.75rem .9rem;box-shadow:0 10px 30px rgba(15,23,42,.18);animation:slideIn .2s ease}
.toast-item.closing{opacity:0;transform:translateX(20px);transition:.2s}
.toast-icon{display:grid;color:var(--primary)}.toast-icon svg{width:20px;height:20px}
.toast-msg{flex:1;font-size:.92rem}
.toast-close{background:none;border:0;font-size:1.3rem;line-height:1;color:var(--muted);cursor:pointer}
.toast-success{border-left-color:var(--ok)}.toast-success .toast-icon{color:var(--ok)}
.toast-error{border-left-color:var(--danger)}.toast-error .toast-icon{color:var(--danger)}
.toast-warning{border-left-color:#d97706}.toast-warning .toast-icon{color:#d97706}
@keyframes slideIn{from{opacity:0;transform:translateX(24px)}}

/* Waiting room */
.wait-card{max-width:460px;margin:3rem auto;text-align:center;padding:2.2rem 1.6rem}
.wait-card h1{font-size:1.4rem;margin:1rem 0 .4rem}
.wait-card .modal-icon{margin:0 auto}
.center-actions{justify-content:center;margin-top:1rem}
.spinner{width:54px;height:54px;margin:0 auto;border-radius:50%;border:5px solid var(--primary-soft);border-top-color:var(--primary);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.lobby-item{display:flex;justify-content:space-between;align-items:center;gap:.5rem;flex-wrap:wrap}
.participants h3{font-size:.95rem;margin:.9rem 0 .2rem}
.participants>.row-between:first-child h3{margin-top:0}
