:root{
  --bg:#F5F6FB;
  --surface:#FFFFFF;
  --surface-2:#EFF1F9;
  --ink:#14141F;
  --muted:#6B6E82;
  --border:#E4E6F1;
  --accent:#5B5BF5;
  --accent-soft:#EDEDFE;
  --violet:#8B5CF6;
  --rose:#F43F5E;
  --rose-soft:#FFE4E9;
  --emerald:#10B981;
  --emerald-soft:#DCFCE9;
  --amber:#F59E0B;
  --amber-soft:#FEF3D6;
  --shadow: 0 1px 2px rgba(20,20,31,.04), 0 10px 30px rgba(20,20,31,.06);
  --radius:16px;
  --sidebar-w:252px;
  --rail-w:80px;
}
[data-theme="dark"]{
  --bg:#0D0E14;
  --surface:#15161F;
  --surface-2:#1D1F2B;
  --ink:#F1F1F7;
  --muted:#8B8DA0;
  --border:#262838;
  --accent:#7A7AFF;
  --accent-soft:#20213A;
  --violet:#A78BFA;
  --rose:#FB7185;
  --rose-soft:#2E1B23;
  --emerald:#34D399;
  --emerald-soft:#12291F;
  --amber:#FBBF24;
  --amber-soft:#2E2410;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 32px rgba(0,0,0,.45);
}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing:antialiased;
  transition:background .2s ease, color .2s ease;
}
a{color:inherit; text-decoration:none;}
button{font-family:inherit; border:none; background:none; cursor:pointer;}
img,svg{display:block;}
input,textarea,select{ font-family:inherit; color:var(--ink); }

/* ============ LAYOUT ============ */
.app{ display:flex; min-height:100vh; width:100%; }

/* ---------- Sidebar ---------- */
.sidebar{
  width:var(--sidebar-w);
  flex:0 0 var(--sidebar-w);
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding:20px 14px;
  position:fixed;
  top:0; left:0; bottom:0;
  z-index:60;
  overflow-y:auto;
  transition:transform .25s ease, width .2s ease, flex-basis .2s ease;
}
.app.collapsed .sidebar{ width:var(--rail-w); flex-basis:var(--rail-w); }
.content-wrap{ flex:1 1 auto; min-width:0; margin-left:var(--sidebar-w); transition:margin-left .2s ease; width:100%; }
.app.collapsed .content-wrap{ margin-left:var(--rail-w); }

.brand{ display:flex; align-items:center; gap:10px; padding:6px 4px 16px; }
.app.collapsed .brand{ justify-content:center; }
.brand-mark{
  width:36px;height:36px;flex:0 0 36px;
  border-radius:11px;
  background:linear-gradient(135deg, var(--accent), var(--violet));
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 6px 16px rgba(91,91,245,.35);
}
.brand-mark svg{width:18px;height:18px;}
.brand-name{font-size:17px; font-weight:800; letter-spacing:-.02em; white-space:nowrap;}
.brand-sub{font-size:11px; color:var(--muted); margin-top:-1px; white-space:nowrap;}
.app.collapsed .brand-text{display:none;}

.toggle-row{ display:flex; justify-content:flex-end; padding:0 4px 14px; }
.app.collapsed .toggle-row{ justify-content:center; }
.app.collapsed .rail-toggle svg{ transform:rotate(180deg); }
.rail-toggle{
  display:flex; align-items:center; justify-content:center;
  width:28px;height:28px;border-radius:8px;border:1px solid var(--border);
  background:var(--surface); color:var(--muted); cursor:pointer; flex:0 0 28px; margin-left:auto;
}
.rail-toggle:hover{ color:var(--ink); }

.nav-group-label{
  font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
  color:var(--muted); padding:16px 12px 6px; white-space:nowrap;
}
.app.collapsed .nav-group-label{display:none;}
.app.collapsed .nav-subitem{display:none;}

.nav-link{
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:11px;
  color:var(--muted); font-size:14px; font-weight:600;
  margin-bottom:3px; white-space:nowrap; overflow:hidden;
}
.nav-link svg{width:19px; height:19px; flex:0 0 19px;}
.nav-link:hover{ background:var(--surface-2); color:var(--ink); }
.nav-link.active{ background:var(--accent-soft); color:var(--accent); }
.app.collapsed .nav-link{ justify-content:center; padding:12px; }
.app.collapsed .nav-link span{ display:none; }

.nav-footer{ margin-top:auto; padding-top:14px; border-top:1px solid var(--border); }
.profile-row{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:11px; }
.profile-row.is-link{ cursor:pointer; }
.profile-row.is-link:hover{ background:var(--surface-2); }
.avatar{
  width:36px;height:36px;border-radius:50%; flex:0 0 36px;
  background:linear-gradient(135deg,var(--amber),var(--rose));
  display:flex;align-items:center;justify-content:center;
  color:#fff; font-weight:700; font-size:13px;
}
.profile-meta{overflow:hidden;}
.profile-name{font-size:13.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.profile-role{font-size:11.5px; color:var(--muted); white-space:nowrap;}
.app.collapsed .profile-meta{display:none;}

.scrim{ display:none; position:fixed; inset:0; background:rgba(10,10,20,.5); z-index:55; }

/* ---------- Topbar ---------- */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:14px;
  padding:14px 28px; background:rgba(245,246,251,.78);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
}
[data-theme="dark"] .topbar{ background:rgba(13,14,20,.78); }

.hamburger{
  display:none; width:38px;height:38px; border-radius:11px; border:1px solid var(--border);
  background:var(--surface); align-items:center; justify-content:center; cursor:pointer; flex:0 0 38px; color:var(--ink);
}

.page-title{font-size:19px; font-weight:800; letter-spacing:-.01em; white-space:nowrap;}
.page-title .dim{color:var(--muted); font-weight:500;}

.search{
  margin-left:8px; flex:1 1 auto; max-width:380px;
  display:flex; align-items:center; gap:8px;
  background:var(--surface-2); border:1px solid transparent;
  border-radius:11px; padding:9px 13px; color:var(--muted);
}
.search input{ border:none; outline:none; background:transparent; color:var(--ink); font-size:13.5px; width:100%; }

.top-actions{ display:flex; align-items:center; gap:10px; margin-left:auto; flex:0 0 auto; }
.icon-btn{
  width:38px;height:38px; border-radius:11px; border:1px solid var(--border);
  background:var(--surface); display:flex;align-items:center;justify-content:center;
  cursor:pointer; color:var(--ink); position:relative;
}
.icon-btn svg{width:17px;height:17px;}
.dot{ position:absolute; top:8px; right:8px; width:7px;height:7px;border-radius:50%; background:var(--rose); }

.theme-toggle{
  width:46px; height:27px; border-radius:20px; border:1px solid var(--border);
  background:var(--surface-2); position:relative; cursor:pointer; flex:0 0 46px;
}
.theme-toggle::after{
  content:""; position:absolute; top:2px; left:2px; width:21px;height:21px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--violet)); transition:transform .2s ease;
}
[data-theme="dark"] .theme-toggle::after{ transform:translateX(19px); }

.content{ padding:24px 28px 40px; max-width:1320px; margin:0 auto; }

/* ---------- Banner ---------- */
.banner{
  background:linear-gradient(120deg, var(--accent), var(--violet));
  color:#fff; border-radius:var(--radius); padding:26px 28px;
  display:flex; align-items:center; justify-content:space-between; gap:20px;
  box-shadow:0 16px 34px rgba(91,91,245,.28); margin-bottom:22px; overflow:hidden; position:relative;
}
.banner h1{ margin:0 0 6px; font-size:clamp(18px,2.4vw,22px); letter-spacing:-.01em;}
.banner p{ margin:0; font-size:13.5px; opacity:.92; max-width:440px; }
.banner-btn{
  background:#fff; color:var(--accent); font-weight:800; font-size:13.5px;
  padding:11px 18px; border-radius:11px; white-space:nowrap; flex:0 0 auto;
}
.banner-mark{ position:absolute; right:-16px; bottom:-30px; opacity:.16; }
.banner-mark svg{ width:160px; height:160px; }

/* ---------- Stat cards ---------- */
.stats{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:16px; margin-bottom:22px; }
.stat-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 18px; box-shadow:var(--shadow); min-width:0;
}
.stat-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.stat-icon{ width:36px;height:36px;border-radius:10px; display:flex; align-items:center;justify-content:center; }
.stat-icon svg{width:17px;height:17px;}
.stat-value{ font-size:clamp(20px,2.4vw,26px); font-weight:800; letter-spacing:-.02em; }
.stat-label{ font-size:12.5px; color:var(--muted); margin-top:6px; }
.stat-delta{ font-size:11.5px; font-weight:700; margin-top:10px; display:inline-flex; gap:4px; align-items:center; }
.up{ color:var(--emerald); }
.down{ color:var(--rose); }

/* ---------- Two column grid ---------- */
.grid-2{ display:grid; grid-template-columns: 1.6fr 1fr; gap:18px; align-items:start; }

.panel{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; min-width:0;
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--border); }
.panel-head h2{ margin:0; font-size:15px; font-weight:800; letter-spacing:-.01em;}
.panel-link{ font-size:12.5px; color:var(--accent); font-weight:700; }
.panel-body{ padding:8px 8px 12px; }

.course-row{ display:flex; align-items:center; gap:14px; padding:12px 10px; border-radius:12px; }
.course-row:hover{ background:var(--surface-2); }
.course-flag{
  width:42px;height:42px;border-radius:12px; flex:0 0 42px;
  display:flex; align-items:center; justify-content:center; font-size:15px; font-weight:800; color:#fff;
}
.course-meta{ flex:1 1 auto; min-width:0; }
.course-name{ font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.course-sub{ font-size:12px; color:var(--muted); margin-top:2px; }
.progress-track{ height:6px; border-radius:6px; background:var(--surface-2); margin-top:9px; overflow:hidden; }
.progress-fill{ height:100%; border-radius:6px; }
.course-pct{ font-size:12.5px; font-weight:800; color:var(--muted); width:38px; text-align:right; flex:0 0 38px;}

.sched-item{ display:flex; gap:12px; padding:13px 18px; border-bottom:1px solid var(--border); }
.sched-item:last-child{ border-bottom:none; }
.sched-time{ font-size:11.5px; color:var(--muted); width:50px; flex:0 0 50px; padding-top:2px; font-weight:700; }
.sched-bar{ width:3px; border-radius:3px; align-self:stretch; flex:0 0 3px; }
.sched-title{ font-size:13.5px; font-weight:700; }
.sched-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.activity-item{ display:flex; gap:12px; padding:12px 18px; }
.activity-dot{ width:8px;height:8px;border-radius:50%; margin-top:6px; flex:0 0 8px; }
.activity-text{ font-size:13px; line-height:1.4; }
.activity-text b{ font-weight:700; }
.activity-time{ font-size:11.5px; color:var(--muted); margin-top:3px; }

/* ---------- Page head / toolbar (courses etc.) ---------- */
.page-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.page-head h1{ margin:0; font-size:22px; font-weight:800; letter-spacing:-.01em; }
.page-head p{ margin:4px 0 0; font-size:13px; color:var(--muted); }
.btn{
  display:inline-flex; align-items:center; gap:8px; font-weight:700; font-size:13.5px;
  padding:11px 18px; border-radius:11px; cursor:pointer; white-space:nowrap;
}
.btn-primary{ background:linear-gradient(135deg,var(--accent),var(--violet)); color:#fff; box-shadow:0 10px 24px rgba(91,91,245,.3); }
.btn-primary svg{width:16px;height:16px;}
.btn-ghost{ background:var(--surface); border:1px solid var(--border); color:var(--ink); }
.btn-danger{ background:var(--rose-soft); color:var(--rose); }

.filter-bar{ display:flex; gap:10px; align-items:center; margin-bottom:20px; flex-wrap:wrap; }
.chip{
  padding:8px 14px; border-radius:20px; border:1px solid var(--border); background:var(--surface);
  font-size:12.5px; font-weight:700; color:var(--muted); cursor:pointer;
}
.chip.active{ background:var(--accent-soft); color:var(--accent); border-color:transparent; }

/* ---------- Course grid ---------- */
.course-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:18px; }
.empty-state{ text-align:center; padding:60px 20px; color:var(--muted); }
.empty-state svg{ width:44px;height:44px; margin:0 auto 12px; opacity:.5; }
.course-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  overflow:hidden; box-shadow:var(--shadow); display:flex; flex-direction:column;
}
.course-cover{
  height:150px; width:100%; position:relative; overflow:hidden; background:var(--surface-2);
  display:flex; align-items:center; justify-content:center;
}
.course-cover img{ width:100%; height:100%; object-fit:cover; }
.course-cover .cover-placeholder{ color:var(--muted); }
.course-cover .cover-placeholder svg{ width:30px;height:30px; }
.course-badge{
  position:absolute; top:10px; left:10px; padding:5px 10px; border-radius:8px;
  font-size:11px; font-weight:800; color:#fff; backdrop-filter:blur(4px);
}
.course-free{ position:absolute; top:10px; right:10px; padding:5px 10px; border-radius:8px; font-size:11px; font-weight:800; background:var(--emerald); color:#fff; }
.course-body{ padding:16px 16px 18px; display:flex; flex-direction:column; gap:10px; flex:1; }
.course-title{ font-size:15px; font-weight:800; letter-spacing:-.01em; line-height:1.3; }
.course-desc{ font-size:12.5px; color:var(--muted); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.course-meta-row{ display:flex; align-items:center; gap:14px; font-size:12px; color:var(--muted); flex-wrap:wrap; }
.course-meta-row span{ display:flex; align-items:center; gap:5px; }
.course-meta-row svg{ width:14px;height:14px; }
.course-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:auto; padding-top:10px; border-top:1px solid var(--border); }
.price-now{ font-size:16px; font-weight:800; }
.price-was{ font-size:12px; color:var(--muted); text-decoration:line-through; margin-left:6px; }
.seats-pill{ font-size:11px; font-weight:700; color:var(--accent); background:var(--accent-soft); padding:5px 10px; border-radius:20px; }

/* ============ MODAL ============ */
.modal-overlay{
  display:none; position:fixed; inset:0; z-index:100;
  background:rgba(10,10,20,.55); backdrop-filter:blur(3px);
  align-items:flex-start; justify-content:center;
  padding:32px 16px; overflow-y:auto;
}
.modal-overlay.open{ display:flex; }
.modal{
  background:var(--surface); border-radius:20px; width:100%; max-width:820px;
  box-shadow:0 30px 80px rgba(0,0,0,.35); overflow:hidden; margin:auto;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 26px; border-bottom:1px solid var(--border); position:sticky; top:0; background:var(--surface); z-index:2;
}
.modal-head h2{ margin:0; font-size:18px; font-weight:800; letter-spacing:-.01em; }
.modal-head p{ margin:2px 0 0; font-size:12.5px; color:var(--muted); }
.modal-close{
  width:34px;height:34px; border-radius:10px; border:1px solid var(--border); background:var(--surface-2);
  display:flex; align-items:center; justify-content:center; color:var(--muted); cursor:pointer; flex:0 0 34px;
}
.modal-close:hover{ color:var(--ink); }

.modal-body{ padding:24px 26px 8px; max-height:70vh; overflow-y:auto; }
.modal-foot{
  display:flex; align-items:center; justify-content:flex-end; gap:10px;
  padding:18px 26px; border-top:1px solid var(--border); background:var(--surface); position:sticky; bottom:0;
}

.field{ margin-bottom:18px; }
.field label{ display:block; font-size:12.5px; font-weight:700; margin-bottom:7px; }
.field .hint{ font-size:11.5px; color:var(--muted); font-weight:500; margin-left:6px; }
.field input[type=text], .field input[type=number], .field input[type=url], .field input[type=password],
.field input[type=date], .field input[type=time], .field input[type=datetime-local],
.field textarea, .field select,
input[type=text], input[type=number], input[type=url], input[type=password],
input[type=date], input[type=time], input[type=datetime-local], textarea, select{
  width:100%; padding:11px 13px; border-radius:11px; border:1px solid var(--border);
  background:var(--surface-2); font-size:13.5px; outline:none; color:var(--ink);
  color-scheme: light;
}
[data-theme="dark"] input[type=date], [data-theme="dark"] input[type=time], [data-theme="dark"] input[type=datetime-local]{
  color-scheme: dark;
}
input[type=text]:focus, input[type=number]:focus, input[type=url]:focus, input[type=password]:focus,
input[type=date]:focus, input[type=time]:focus, input[type=datetime-local]:focus,
textarea:focus, select:focus,
.field input:focus, .field textarea:focus, .field select:focus{ border-color:var(--accent); background:var(--surface); }
.field textarea{ resize:vertical; min-height:80px; font-family:inherit; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator{
  cursor:pointer; border-radius:6px; padding:3px; opacity:.75;
}
input[type=date]::-webkit-calendar-picker-indicator:hover, input[type=time]::-webkit-calendar-picker-indicator:hover,
input[type=datetime-local]::-webkit-calendar-picker-indicator:hover{ opacity:1; background:var(--accent-soft); }

.row-2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.row-3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }

.section-label{
  font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em;
  color:var(--accent); margin:26px 0 12px; display:flex; align-items:center; gap:8px;
}
.section-label:first-child{ margin-top:0; }
.section-label::after{ content:""; flex:1; height:1px; background:var(--border); }

/* Cover image uploader */
.cover-drop{
  border:1.5px dashed var(--border); border-radius:14px; height:170px;
  display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden;
  background:var(--surface-2); cursor:pointer;
}
.cover-drop img{ width:100%; height:100%; object-fit:cover; position:absolute; inset:0; }
.cover-drop-placeholder{ display:flex; flex-direction:column; align-items:center; gap:8px; color:var(--muted); pointer-events:none; }
.cover-drop-placeholder svg{ width:26px;height:26px; }
.cover-drop-placeholder span{ font-size:12.5px; font-weight:600; }
.cover-drop input[type=file]{ position:absolute; inset:0; opacity:0; cursor:pointer; }
.cover-remove{
  position:absolute; top:8px; right:8px; width:28px;height:28px; border-radius:8px;
  background:rgba(20,20,31,.65); color:#fff; display:none; align-items:center; justify-content:center; z-index:3;
}
.cover-drop.has-image .cover-remove{ display:flex; }
.cover-drop.has-image .cover-drop-placeholder{ display:none; }

/* Includes list */
.includes-list{ display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.include-row{ display:flex; align-items:center; gap:10px; background:var(--surface-2); border-radius:10px; padding:9px 12px; }
.include-row svg.check{ width:16px;height:16px; color:var(--emerald); flex:0 0 16px; }
.include-row span{ flex:1; font-size:13px; }
.include-remove{ color:var(--muted); width:22px;height:22px; display:flex; align-items:center; justify-content:center; border-radius:6px; flex:0 0 22px; }
.include-remove:hover{ color:var(--rose); background:var(--rose-soft); }
.include-add-row{ display:flex; gap:8px; align-items:stretch; }
.include-add-row input{ flex:1; }
.add-btn{
  flex:0 0 auto; display:flex; align-items:center; gap:6px; padding:0 16px; border-radius:11px;
  background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:13px; height:42px;
}
.add-btn svg{ width:15px;height:15px; }

/* Price */
.price-box{ position:relative; }
.price-box input{ padding-left:44px !important; }
.price-box::before{
  content:"Rs."; position:absolute; left:13px; top:50%; transform:translateY(-50%);
  color:var(--muted); font-weight:700; font-size:13px; pointer-events:none;
}
.free-note{ font-size:11.5px; color:var(--emerald); font-weight:700; margin-top:6px; display:none; }
.free-note.show{ display:block; }

/* Toggle switch (seat limit) */
.switch-row{ display:flex; align-items:center; justify-content:space-between; padding:4px 0 16px; }
.switch-label{ font-size:13.5px; font-weight:700; }
.switch-sub{ font-size:11.5px; color:var(--muted); margin-top:2px; }
.switch{ width:42px; height:24px; border-radius:20px; background:var(--surface-2); border:1px solid var(--border); position:relative; cursor:pointer; flex:0 0 42px; }
.switch::after{ content:""; position:absolute; top:2px; left:2px; width:20px;height:20px; border-radius:50%; background:#fff; transition:transform .18s ease; box-shadow:0 1px 3px rgba(0,0,0,.25); }
.switch.on{ background:var(--accent); }
.switch.on::after{ transform:translateX(18px); }
.seats-field{ display:none; }
.seats-field.show{ display:block; }

.video-preview{
  margin-top:8px; display:none; align-items:center; gap:10px; font-size:12px; color:var(--muted);
  background:var(--surface-2); padding:9px 12px; border-radius:10px;
}
.video-preview.show{ display:flex; }
.video-preview svg{ width:16px;height:16px; color:var(--rose); flex:0 0 16px; }

/* Mobile bottom tab bar */
.tabbar{
  display:none; position:fixed; bottom:0; left:0; right:0; z-index:50;
  background:rgba(255,255,255,.9); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  border-top:1px solid var(--border); padding:6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content:space-around;
}
[data-theme="dark"] .tabbar{ background:rgba(21,22,31,.9); }
.tab-item{ display:flex; flex-direction:column; align-items:center; gap:3px; color:var(--muted); font-size:10.5px; font-weight:700; padding:6px 4px; border-radius:10px; flex:1 1 0; }
.tab-item svg{width:20px;height:20px;}
.tab-item.active{ color:var(--accent); }

/* Toast */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translate(-50%,120%); z-index:200;
  background:var(--ink); color:var(--bg); padding:13px 20px; border-radius:12px; font-size:13px; font-weight:700;
  display:flex; align-items:center; gap:8px; box-shadow:0 14px 30px rgba(0,0,0,.3); transition:transform .25s ease;
}
.toast.show{ transform:translate(-50%,0); }
.toast svg{ width:16px;height:16px; color:var(--emerald); }
.toast.error svg{ color:var(--rose); }

/* ============ RESPONSIVE BREAKPOINTS ============ */
@media (max-width: 1080px){
  .grid-2{ grid-template-columns: 1fr; }
  .course-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px){
  .stats{ grid-template-columns:repeat(2, minmax(0,1fr)); }
  .search{ max-width:220px; }
}
@media (max-width: 640px){
  .content-wrap{ margin-left:0 !important; }
  .app .sidebar{ width:264px; flex-basis:264px; transform:translateX(-110%); box-shadow:var(--shadow); }
  .app .sidebar.open{ transform:translateX(0); }
  .app .sidebar.open .brand-text,
  .app .sidebar.open .nav-group-label,
  .app .sidebar.open .nav-link span,
  .app .sidebar.open .profile-meta{ display:block; }
  .app .sidebar.open .nav-link{ justify-content:flex-start; padding:10px 12px; }
  .scrim.show{ display:block; }
  .hamburger{ display:flex; }
  .search{ display:none; }
  .page-title{ font-size:17px; }
  .topbar{ padding:12px 16px; gap:10px; }
  .content{ padding:18px 16px 90px; }
  .banner{ flex-direction:column; align-items:flex-start; padding:20px; }
  .banner-btn{ width:100%; text-align:center; }
  .stats{ grid-template-columns:1fr; }
  .course-grid{ grid-template-columns:1fr; }
  .page-head{ flex-direction:column; align-items:flex-start; }
  .page-head .btn{ width:100%; justify-content:center; }
  .row-2, .row-3{ grid-template-columns:1fr; }
  .tabbar{ display:flex; }
  .modal-overlay{ padding:0; }
  .modal{ max-width:100%; min-height:100vh; border-radius:0; }
  .modal-body{ max-height:none; }
}
@media (min-width:641px){ .scrim{ display:none !important; } }

/* ============================================================
   Select2 — themed to match Lingua's design tokens
   ============================================================ */
.select2-container{ width:100% !important; }
.select2-container .select2-selection--single{
  height:44px !important;
  border-radius:11px !important;
  border:1px solid var(--border) !important;
  background:var(--surface-2) !important;
  display:flex; align-items:center;
  padding:0 13px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered{
  color:var(--ink) !important;
  font-size:13.5px !important;
  line-height:44px !important;
  padding:0 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder{
  color:var(--muted) !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow{
  height:42px !important; right:10px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b{
  border-color:var(--muted) transparent transparent transparent !important;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{
  border-color:transparent transparent var(--muted) transparent !important;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single{
  border-color:var(--accent) !important;
  background:var(--surface) !important;
}
.select2-dropdown{
  border-radius:12px !important;
  border:1px solid var(--border) !important;
  background:var(--surface) !important;
  box-shadow:0 18px 40px rgba(20,20,31,.18) !important;
  overflow:hidden;
  padding:6px !important;
}
.select2-search--dropdown{ padding:4px 4px 8px !important; }
.select2-search--dropdown .select2-search__field{
  border-radius:9px !important;
  border:1px solid var(--border) !important;
  background:var(--surface-2) !important;
  color:var(--ink) !important;
  padding:8px 10px !important;
  outline:none !important;
}
.select2-results__option{
  border-radius:9px !important;
  padding:9px 11px !important;
  font-size:13.5px !important;
  color:var(--ink) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected]{
  background:var(--accent-soft) !important;
  color:var(--accent) !important;
}
.select2-container--default .select2-results__option[aria-selected=true]{
  background:var(--surface-2) !important;
  font-weight:700;
}
.select2-results__option .cat-dot{
  display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:8px; vertical-align:middle;
}
.select2-selection__rendered .cat-dot{
  display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:8px; vertical-align:middle;
}
[data-theme="dark"] .select2-container--default .select2-selection__arrow b{ border-color:var(--muted) transparent transparent transparent !important; }

/* ============================================================
   Quizzes
   ============================================================ */
.quiz-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:18px; }
.quiz-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  overflow:hidden; display:flex; flex-direction:column; box-shadow:var(--shadow);
}
.quiz-cover{ position:relative; height:110px; background:linear-gradient(135deg,var(--accent-soft),var(--surface-2)); display:flex; align-items:center; justify-content:center; }
.quiz-cover img{ width:100%; height:100%; object-fit:cover; }
.quiz-cover .cover-placeholder{ color:var(--accent); }
.quiz-cover .cover-placeholder svg{ width:30px; height:30px; }
.quiz-scope-badge{ position:absolute; top:10px; left:10px; padding:5px 10px; border-radius:8px; font-size:10.5px; font-weight:800; }
.quiz-body{ padding:16px 16px 18px; display:flex; flex-direction:column; gap:10px; flex:1; }
.quiz-title{ font-size:15px; font-weight:800; letter-spacing:-.01em; line-height:1.3; }
.quiz-desc{ font-size:12.5px; color:var(--muted); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:19px; }
.quiz-meta-row{ display:flex; align-items:center; gap:12px; font-size:11.5px; color:var(--muted); flex-wrap:wrap; }
.quiz-meta-row span{ display:flex; align-items:center; gap:5px; }
.quiz-meta-row svg{ width:13px;height:13px; }
.quiz-foot{ display:flex; gap:8px; margin-top:auto; padding-top:10px; border-top:1px solid var(--border); }
.quiz-foot .btn{ flex:1; justify-content:center; padding:8px 10px; font-size:12px; }
.quiz-card-actions{ position:absolute; bottom:10px; right:10px; display:flex; gap:6px; }

/* Cascading scope selects */
.scope-field{ display:none; }
.scope-field.show{ display:block; }

/* Toggle-revealed field groups (time limit / valid dates) */
.toggle-field{ display:none; margin-top:12px; }
.toggle-field.show{ display:block; }

/* Quiz questions page header */
.quiz-head-banner{
  display:flex; align-items:center; gap:16px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px 20px; margin-bottom:20px; box-shadow:var(--shadow); flex-wrap:wrap;
}
.quiz-head-cover{ width:64px; height:64px; border-radius:14px; object-fit:cover; flex:0 0 64px; background:var(--surface-2); }
.quiz-head-info{ flex:1 1 260px; min-width:0; }
.quiz-head-info h1{ margin:0 0 4px; font-size:19px; font-weight:800; letter-spacing:-.01em; }
.quiz-head-info p{ margin:0; font-size:12.5px; color:var(--muted); }
.quiz-stat-pills{ display:flex; gap:10px; flex-wrap:wrap; }
.quiz-stat-pill{
  background:var(--surface-2); border-radius:11px; padding:9px 14px; text-align:center; min-width:76px;
}
.quiz-stat-pill b{ display:block; font-size:17px; font-weight:800; letter-spacing:-.01em; }
.quiz-stat-pill span{ font-size:10.5px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:.03em; }

/* Question list */
.question-list{ display:flex; flex-direction:column; gap:12px; }
.question-card{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px 18px;
  display:flex; gap:14px; align-items:flex-start;
}
.question-num{
  width:30px; height:30px; border-radius:9px; background:var(--accent-soft); color:var(--accent);
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:13px; flex:0 0 30px;
}
.question-main{ flex:1; min-width:0; }
.question-text-preview{ font-size:13.5px; font-weight:600; line-height:1.5; margin-bottom:6px; }
.question-media-tags{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.question-tag{
  display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; color:var(--muted);
  background:var(--surface-2); padding:4px 9px; border-radius:7px;
}
.question-tag svg{ width:12px;height:12px; }
.question-answers-preview{ display:flex; flex-direction:column; gap:4px; margin-top:8px; }
.answer-preview-row{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); }
.answer-preview-row svg{ width:14px;height:14px; flex:0 0 14px; }
.answer-preview-row.correct{ color:var(--emerald); font-weight:700; }
.question-actions{ display:flex; gap:6px; flex:0 0 auto; }

/* Rich text toolbar (question editor) */
.rte-toolbar{
  display:flex; gap:5px; align-items:center; padding:8px; border:1px solid var(--border);
  border-bottom:none; border-radius:12px 12px 0 0; background:var(--surface-2); flex-wrap:wrap;
}
.rte-btn{
  width:30px; height:30px; border-radius:8px; display:flex; align-items:center; justify-content:center;
  color:var(--ink); font-weight:800; font-size:13px;
}
.rte-btn:hover, .rte-btn.active{ background:var(--accent-soft); color:var(--accent); }
.rte-btn.italic{ font-style:italic; }
.rte-btn.underline{ text-decoration:underline; }
.rte-sep{ width:1px; align-self:stretch; background:var(--border); margin:2px 2px; }
.rte-color{ width:28px; height:28px; border-radius:8px; border:1.5px solid var(--border); cursor:pointer; padding:2px; background:var(--surface); }
.rte-editor{
  min-height:90px; border:1px solid var(--border); border-radius:0 0 12px 12px; padding:12px 14px;
  font-size:13.5px; background:var(--surface); outline:none; line-height:1.55;
}
.rte-editor:focus{ border-color:var(--accent); }
.rte-editor:empty:before{ content:attr(data-placeholder); color:var(--muted); }

/* Media dropzone (drag/drop + click + paste) */
.media-drop{
  position:relative; border:1.5px dashed var(--border); border-radius:12px; padding:16px;
  text-align:center; cursor:pointer; background:var(--surface-2); transition:border-color .15s ease, background .15s ease;
  min-height:96px; display:flex; align-items:center; justify-content:center;
}
.media-drop.dragover{ border-color:var(--accent); background:var(--accent-soft); }
.media-drop input[type=file]{ display:none; }
.media-drop-placeholder{ display:flex; flex-direction:column; align-items:center; gap:6px; color:var(--muted); pointer-events:none; }
.media-drop-placeholder svg{ width:22px; height:22px; }
.media-drop-placeholder span{ font-size:11.5px; font-weight:600; }
.media-preview{ display:none; width:100%; align-items:center; justify-content:center; }
.media-drop.has-file .media-drop-placeholder{ display:none; }
.media-drop.has-file .media-preview{ display:flex; }
.media-preview img{ max-width:100%; max-height:96px; border-radius:8px; object-fit:cover; }
.media-preview .audio-chip{ display:flex; flex-direction:column; gap:6px; width:100%; padding:0 6px; }
.media-preview .audio-chip .audio-name{ font-size:11.5px; font-weight:700; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.media-preview audio{ width:100%; height:32px; }
.media-remove-btn{
  position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:7px;
  background:rgba(20,20,31,.65); color:#fff; display:none; align-items:center; justify-content:center; z-index:3;
}
.media-drop.has-file .media-remove-btn{ display:flex; }
.media-drop.has-file:not(.audio-mode) .media-remove-btn{ position:absolute; }
.media-field-label{ display:flex; align-items:center; justify-content:between; gap:8px; font-size:12.5px; font-weight:700; margin-bottom:7px; }

/* Answers editor */
.answers-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:12px; }
.answer-row{ border:1px solid var(--border); border-radius:12px; padding:12px; background:var(--surface-2); }
.answer-row.is-correct{ border-color:var(--emerald); background:var(--emerald-soft); }
.answer-row-top{ display:flex; align-items:center; gap:10px; }
.answer-correct-radio{ width:19px; height:19px; accent-color:var(--emerald); flex:0 0 19px; cursor:pointer; }
.answer-text-input{
  flex:1; border:1px solid var(--border); border-radius:9px; padding:9px 12px; font-size:13px;
  background:var(--surface); color:var(--ink); outline:none;
}
.answer-text-input:focus{ border-color:var(--accent); }
.answer-media-toggle{ color:var(--muted); flex:0 0 auto; }
.answer-media-toggle:hover, .answer-media-toggle.active{ color:var(--accent); }
.answer-remove{ color:var(--muted); flex:0 0 auto; width:26px; height:26px; display:flex; align-items:center; justify-content:center; border-radius:7px; }
.answer-remove:hover{ color:var(--rose); background:var(--rose-soft); }
.answer-media-row{ display:none; grid-template-columns:1fr 1fr; gap:10px; margin-top:10px; }
.answer-media-row.show{ display:grid; }
.answer-media-row .media-drop{ min-height:72px; padding:10px; }
.answer-count-badge{ font-size:11px; font-weight:700; color:var(--muted); margin-left:6px; }

@media (max-width: 1080px){
  .quiz-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px){
  .quiz-grid{ grid-template-columns:1fr; }
  .answer-media-row{ grid-template-columns:1fr; }
  .quiz-head-banner{ flex-direction:column; align-items:flex-start; }
}
