:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ee;
  --surface-3: #e4ebe7;
  --text: #18201d;
  --text-soft: #5e6a65;
  --line: #dce4df;
  --primary: #117a65;
  --primary-strong: #0a5f4e;
  --primary-soft: #dff3ec;
  --cyan: #147d92;
  --cyan-soft: #dff2f5;
  --coral: #d65f4a;
  --coral-soft: #fbe7e2;
  --amber: #a66b00;
  --amber-soft: #fff0cc;
  --shadow: 0 14px 36px rgba(23, 40, 33, .08);
  --shadow-soft: 0 5px 18px rgba(23, 40, 33, .07);
  --sidebar: 258px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131816;
  --surface: #1b221f;
  --surface-2: #222b27;
  --surface-3: #2b3631;
  --text: #f0f5f2;
  --text-soft: #aab8b1;
  --line: #313d37;
  --primary: #58c4a8;
  --primary-strong: #79d9bf;
  --primary-soft: #193a31;
  --cyan: #67c8d6;
  --cyan-soft: #18343a;
  --coral: #f08a75;
  --coral-soft: #412720;
  --amber: #e5b654;
  --amber-soft: #3b3019;
  --shadow: 0 18px 48px rgba(0, 0, 0, .28);
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}
button, input, textarea, select { min-width: 0; font: inherit; letter-spacing: 0; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { letter-spacing: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-soft); }
.eyebrow, .page-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 20px; height: 20px; }
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 15px;
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .btn.primary { color: #10211c; }
.btn.primary:hover { background: var(--primary-strong); }
.btn.soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn.danger { background: var(--coral-soft); color: var(--coral); border-color: transparent; }
.btn.wide { width: 100%; }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.btn:disabled, .icon-btn:disabled { opacity: .5; cursor: wait; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(390px, .85fr); }
.auth-visual { position: relative; min-height: 100vh; overflow: hidden; color: #fff; }
.auth-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 22, 17, .12), rgba(5, 26, 20, .82)); }
.auth-visual > img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.auth-brand, .mobile-brand, .brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 20px; }
.auth-brand { position: absolute; z-index: 1; left: 48px; top: 42px; }
.brand-mark { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 900; }
[data-theme="dark"] .brand-mark { color: #10211c; }
.auth-message { position: absolute; z-index: 1; left: clamp(36px, 6vw, 84px); bottom: clamp(54px, 10vh, 110px); max-width: 620px; }
.auth-message .eyebrow { color: #a8ebd8; }
.auth-message h1 { margin: 14px 0 20px; font-size: clamp(42px, 5.4vw, 74px); line-height: 1.02; font-weight: 820; }
.auth-message p { max-width: 540px; margin: 0; font-size: 18px; line-height: 1.6; color: rgba(255,255,255,.82); }
.auth-form-wrap { position: relative; min-width: 0; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 50px clamp(28px, 6vw, 88px); }
.theme-auth { position: absolute; top: 28px; right: 28px; }
.auth-form { width: min(100%, 430px); min-width: 0; max-width: 100%; }
.mobile-brand { display: none; margin-bottom: 56px; }
.auth-form h2 { margin: 10px 0 10px; font-size: 34px; }
.auth-form > .muted { margin-bottom: 34px; line-height: 1.55; }
.field { display: grid; gap: 8px; margin: 18px 0; color: var(--text-soft); font-size: 13px; font-weight: 750; }
.field input, .field textarea, .field select, .text-input, .select-input, .textarea-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field textarea, .textarea-input { min-height: 100px; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus, .text-input:focus, .select-input:focus, .textarea-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.input-icon { position: relative; display: block; }
.input-icon svg { position: absolute; left: 13px; top: 13px; width: 18px; color: var(--text-soft); }
.input-icon input { padding-left: 42px; }
.form-error { min-height: 22px; margin: -3px 0 10px; color: var(--coral); font-size: 13px; }
.auth-note { margin: 20px 0 0; display: flex; justify-content: center; align-items: center; gap: 7px; color: var(--text-soft); font-size: 12px; }
.auth-note svg { width: 16px; }
.auth-link { width: 100%; margin-top: 13px; border: 0; background: transparent; color: var(--primary); font-weight: 750; cursor: pointer; }
.auth-link:hover { color: var(--primary-strong); }
.field-hint { color: var(--text-soft); font-size: 11px; font-weight: 550; line-height: 1.45; }
.notice { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.notice > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); color: var(--text-soft); }
.notice > span svg { width: 18px; }
.notice strong, .notice small { display: block; }
.notice small { margin-top: 3px; color: var(--text-soft); line-height: 1.4; }
.notice.warning { border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); background: var(--amber-soft); }
.notice.warning > span { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); color: var(--amber); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-head { height: 78px; flex: 0 0 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 21px; border-bottom: 1px solid var(--line); }
.sidebar-close { display: none; }
.nav-list { display: grid; gap: 4px; padding: 24px 14px; overflow-y: auto; }
.nav-btn { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 7px; padding: 10px 12px; background: transparent; color: var(--text-soft); text-align: left; font-weight: 700; cursor: pointer; }
.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn.active { background: var(--primary-soft); color: var(--primary); }
.nav-btn svg { width: 19px; height: 19px; }
.nav-label { margin: 18px 12px 5px; color: var(--text-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sidebar-bottom { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }
.assistant-mini { width: 100%; display: grid; grid-template-columns: 38px 1fr 18px; align-items: center; gap: 10px; border: 0; border-radius: 8px; padding: 11px; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.assistant-mini:hover { background: var(--primary-soft); }
.assistant-mini > svg { width: 17px; color: var(--text-soft); }
.assistant-mini strong, .assistant-mini small { display: block; }
.assistant-mini strong { font-size: 13px; }
.assistant-mini small { margin-top: 2px; color: var(--text-soft); font-size: 11px; }
.assistant-orbit { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; }
[data-theme="dark"] .assistant-orbit { color: #10211c; }
.assistant-orbit svg { width: 18px; }
.profile-mini { margin-top: 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--cyan-soft); color: var(--cyan); font-weight: 850; }
.profile-copy { min-width: 0; flex: 1; }
.profile-copy strong, .profile-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { margin-top: 2px; color: var(--text-soft); font-size: 11px; }
.main-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; z-index: 20; top: 0; height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(20px, 3.4vw, 50px); background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { margin: 2px 0 0; font-size: 22px; line-height: 1.15; }
.topbar-actions { display: flex; align-items: center; gap: 5px; }
.menu-btn { display: none; }
.notification-btn { position: relative; }
.notification-btn span { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); border: 2px solid var(--bg); }
.top-profile { display: flex; align-items: center; gap: 9px; margin-left: 6px; padding: 4px 6px 4px 4px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-weight: 700; }
.top-profile:hover { background: var(--surface-2); }
.top-profile > svg { width: 16px; color: var(--text-soft); }
.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 34px clamp(20px, 3.4vw, 50px) 70px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.page-head h2 { margin-bottom: 7px; font-size: 26px; }
.page-head p { margin: 0; color: var(--text-soft); line-height: 1.55; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 34px 0 16px; }
.section-title h2, .section-title h3 { margin: 0; font-size: 19px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.stat-icon.cyan { color: var(--cyan); background: var(--cyan-soft); }
.stat-icon.coral { color: var(--coral); background: var(--coral-soft); }
.stat-icon.amber { color: var(--amber); background: var(--amber-soft); }
.stat-icon svg { width: 19px; }
.stat-value { margin: 20px 0 3px; font-size: 30px; font-weight: 850; }
.stat-label { color: var(--text-soft); font-size: 13px; }
.trend { font-size: 11px; color: var(--primary); font-weight: 800; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; margin-top: 18px; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 17px; }
.panel-head p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; }
.activity-list { display: grid; }
.activity-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.activity-row:first-child { border-top: 0; }
.activity-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--primary); }
.activity-icon svg { width: 17px; }
.activity-main { min-width: 0; }
.activity-main strong, .activity-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-main strong { font-size: 13px; }
.activity-main small { margin-top: 4px; color: var(--text-soft); font-size: 11px; }
.score { min-width: 48px; padding: 6px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 850; text-align: center; }
.score.low { background: var(--coral-soft); color: var(--coral); }
.course-mini-list { display: grid; gap: 14px; }
.course-mini { display: grid; grid-template-columns: 46px 1fr auto; gap: 11px; align-items: center; }
.course-mini-cover { width: 46px; height: 46px; border-radius: 7px; object-fit: cover; background: var(--surface-2); }
.course-mini strong, .course-mini small { display: block; }
.course-mini strong { font-size: 13px; }
.course-mini small { margin-top: 3px; color: var(--text-soft); font-size: 11px; }
.course-mini > span:last-child { color: var(--text-soft); font-size: 12px; }

.courses-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.course-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); }
.course-cover { position: relative; aspect-ratio: 16 / 8.8; overflow: hidden; background: var(--surface-2); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.course-card:hover .course-cover img { transform: scale(1.025); }
.course-cover .status-badge { position: absolute; top: 12px; left: 12px; }
.course-body { padding: 18px; }
.course-body h3 { margin-bottom: 8px; font-size: 17px; }
.course-body p { min-height: 42px; margin-bottom: 16px; color: var(--text-soft); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-soft); font-size: 11px; }
.course-meta span { display: flex; align-items: center; gap: 5px; }
.course-meta svg { width: 14px; }
.course-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; width: max-content; border-radius: 5px; padding: 5px 8px; background: var(--surface-2); color: var(--text-soft); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.status-badge.published, .status-badge.completed { background: var(--primary-soft); color: var(--primary); }
.status-badge.draft { background: var(--amber-soft); color: var(--amber); }
.status-badge.archived { background: var(--surface-3); color: var(--text-soft); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.search-box { position: relative; width: min(360px, 100%); }
.search-box svg { position: absolute; left: 12px; top: 12px; width: 18px; color: var(--text-soft); }
.search-box input { padding-left: 39px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th { padding: 12px 16px; background: var(--surface-2); color: var(--text-soft); font-size: 10px; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table-person { display: flex; align-items: center; gap: 10px; }
.table-person strong, .table-person small { display: block; }
.table-person small { margin-top: 3px; color: var(--text-soft); font-size: 11px; }
.table-actions { display: flex; justify-content: flex-end; gap: 5px; }
.students-table { min-width: 940px; }
.course-cell { max-width: 210px; }
.course-cell strong, .course-cell small { display: block; }
.course-cell small { margin-top: 3px; overflow: hidden; color: var(--text-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.check-list { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.course-check { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: center; padding: 13px 14px; cursor: pointer; }
.course-check + .course-check { border-top: 1px solid var(--line); }
.course-check:hover { background: var(--surface-2); }
.course-check input { width: 17px; height: 17px; accent-color: var(--primary); }
.course-check strong, .course-check small { display: block; }
.course-check small { margin-top: 3px; color: var(--text-soft); font-size: 11px; }
.success-summary { padding: 6px 8px 20px; text-align: center; }
.success-summary > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.success-summary > span svg { width: 25px; }
.success-summary h3 { margin-bottom: 7px; }
.success-summary p { max-width: 440px; margin: auto; color: var(--text-soft); line-height: 1.55; }
.credentials { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.credentials > div { padding: 12px 14px; }
.credentials > div + div { border-top: 1px solid var(--line); }
.credentials small, .credentials strong { display: block; }
.credentials small { margin-bottom: 4px; color: var(--text-soft); font-size: 10px; text-transform: uppercase; }
.empty-state.compact { padding: 24px 12px; }

.builder-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.builder-nav { position: sticky; top: 98px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.builder-nav-head { padding: 6px 7px 12px; border-bottom: 1px solid var(--line); }
.builder-nav-head strong, .builder-nav-head small { display: block; }
.builder-nav-head small { margin-top: 4px; color: var(--text-soft); }
.lesson-nav { display: grid; gap: 4px; margin-top: 10px; }
.lesson-nav button { width: 100%; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text-soft); text-align: left; cursor: pointer; }
.lesson-nav button:hover, .lesson-nav button.active { background: var(--primary-soft); color: var(--primary); }
.lesson-no { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); font-size: 11px; font-weight: 850; }
.lesson-nav button.active .lesson-no { background: var(--primary); color: #fff; }
.builder-main { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.color-field { display: flex; gap: 8px; }
.color-field input[type="color"] { width: 48px; padding: 4px; }
.material-list { display: grid; gap: 8px; }
.material-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.material-row > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--cyan-soft); color: var(--cyan); }
.material-row svg { width: 17px; }
.material-row strong, .material-row small { display: block; }
.material-row small { color: var(--text-soft); font-size: 11px; }
.question-builder { margin-top: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.question-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.question-head strong { font-size: 13px; }
.options-editor { display: grid; gap: 8px; }
.option-edit { display: grid; grid-template-columns: 24px 1fr 36px; align-items: center; gap: 7px; }
.option-edit input[type="radio"], .option-edit input[type="checkbox"] { accent-color: var(--primary); }
.empty-state { padding: 52px 20px; text-align: center; color: var(--text-soft); }
.empty-state span { width: 54px; height: 54px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--primary); }
.empty-state svg { width: 25px; }
.empty-state h3 { margin-bottom: 7px; color: var(--text); }
.empty-state p { max-width: 440px; margin: 0 auto 16px; line-height: 1.55; }

.student-welcome { position: relative; min-height: 250px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .62fr); overflow: hidden; border-radius: 8px; background: #15352d; color: #fff; }
.welcome-copy { position: relative; z-index: 2; padding: clamp(28px, 4vw, 48px); align-self: center; }
.welcome-copy .eyebrow { color: #99dfca; }
.welcome-copy h2 { margin: 10px 0 12px; max-width: 650px; font-size: clamp(28px, 3.2vw, 43px); line-height: 1.1; }
.welcome-copy p { max-width: 600px; margin-bottom: 22px; color: rgba(255,255,255,.72); line-height: 1.6; }
.welcome-copy .btn { border-color: #fff; background: #fff; color: #15352d; }
.welcome-photo { position: relative; min-height: 250px; }
.welcome-photo::before { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(90deg, #15352d 0%, transparent 70%); }
.welcome-photo img { width: 100%; height: 100%; object-fit: cover; }
.progress-line { height: 7px; overflow: hidden; border-radius: 4px; background: var(--surface-3); }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.student-course-card .course-actions { display: grid; grid-template-columns: 1fr auto; }
.progress-copy { font-size: 11px; color: var(--text-soft); }
.progress-copy strong { color: var(--text); }
.lesson-list { display: grid; gap: 10px; }
.lesson-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.lesson-row:hover { border-color: var(--primary); }
.lesson-index { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-soft); font-weight: 850; }
.lesson-row.completed .lesson-index { background: var(--primary-soft); color: var(--primary); }
.lesson-copy { min-width: 0; }
.lesson-copy strong, .lesson-copy small { display: block; }
.lesson-copy small { margin-top: 4px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-side { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: 12px; }
.lesson-content { white-space: pre-line; line-height: 1.8; color: color-mix(in srgb, var(--text) 88%, var(--text-soft)); }
.media-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-item { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.media-item img, .media-item video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.media-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; }
.quiz-shell { display: grid; gap: 16px; }
.quiz-question { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.quiz-question h4 { margin-bottom: 14px; font-size: 15px; line-height: 1.5; }
.quiz-options { display: grid; gap: 8px; }
.quiz-option { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.quiz-option:hover { border-color: var(--primary); }
.quiz-option input { margin-top: 3px; accent-color: var(--primary); }
.result-banner { display: grid; grid-template-columns: 70px 1fr; gap: 18px; align-items: center; padding: 22px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.result-banner.failed { background: var(--coral-soft); color: var(--coral); }
.result-score { width: 68px; height: 68px; display: grid; place-items: center; border: 5px solid currentColor; border-radius: 50%; font-size: 17px; font-weight: 900; }
.result-banner h3 { margin-bottom: 5px; }
.result-banner p { margin: 0; color: var(--text-soft); }

.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.news-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); }
.news-card.featured { grid-column: span 2; }
.news-image { aspect-ratio: 16 / 8; background: var(--surface-2); }
.news-image img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 18px; }
.news-top { display: flex; justify-content: space-between; gap: 10px; color: var(--text-soft); font-size: 11px; }
.news-body h3 { margin: 10px 0 8px; font-size: 17px; }
.news-body p { margin-bottom: 0; color: var(--text-soft); line-height: 1.6; white-space: pre-line; }
.pin { display: inline-flex; gap: 4px; align-items: center; color: var(--coral); font-weight: 800; }
.pin svg { width: 13px; }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; align-items: start; }
.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.provider-option { position: relative; display: block; }
.provider-option input { position: absolute; opacity: 0; }
.provider-card { min-height: 100px; display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: start; padding: 15px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.provider-option input:checked + .provider-card { border-color: var(--primary); background: var(--primary-soft); }
.provider-logo { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--primary); font-weight: 900; }
.provider-card strong, .provider-card small { display: block; }
.provider-card small { margin-top: 5px; color: var(--text-soft); line-height: 1.4; }
.config-status { display: flex; align-items: center; gap: 8px; padding: 11px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 750; }
.config-status.missing { background: var(--amber-soft); color: var(--amber); }
.config-status svg { width: 17px; }

.assistant-drawer { position: fixed; z-index: 50; top: 0; right: 0; width: min(440px, 100vw); height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0,0,0,.12); transform: translateX(102%); transition: transform .25s ease; }
.assistant-drawer.open { transform: translateX(0); }
.assistant-head { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.assistant-head > div { display: flex; align-items: center; gap: 11px; }
.assistant-head strong, .assistant-head small { display: block; }
.assistant-head small { margin-top: 3px; color: var(--text-soft); font-size: 11px; }
.assistant-suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 12px 15px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.suggestion { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: var(--surface); color: var(--text-soft); font-size: 11px; cursor: pointer; }
.suggestion:hover { border-color: var(--primary); color: var(--primary); }
.chat-messages { overflow-y: auto; padding: 20px 16px; }
.chat-welcome { padding: 22px 8px 30px; text-align: center; color: var(--text-soft); }
.chat-welcome .assistant-orbit { width: 52px; height: 52px; margin-bottom: 13px; }
.chat-welcome h3 { margin-bottom: 7px; color: var(--text); }
.chat-welcome p { margin: 0; line-height: 1.55; }
.message { max-width: 88%; margin: 10px 0; }
.message.user { margin-left: auto; }
.message-bubble { padding: 11px 13px; border-radius: 8px; background: var(--surface-2); line-height: 1.55; white-space: pre-line; }
.message.user .message-bubble { background: var(--primary); color: #fff; }
[data-theme="dark"] .message.user .message-bubble { color: #10211c; }
.message-meta { margin-top: 4px; color: var(--text-soft); font-size: 10px; }
.message.user .message-meta { text-align: right; }
.speak-btn { width: 27px; height: 27px; min-width: 27px; vertical-align: middle; }
.speak-btn svg { width: 14px; height: 14px; }
.typing { display: inline-flex; gap: 4px; padding: 13px 15px; border-radius: 8px; background: var(--surface-2); }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-soft); animation: pulse 1s infinite alternate; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .25; transform: translateY(-3px); } }
.chat-composer { display: grid; grid-template-columns: 40px 1fr 40px; gap: 7px; align-items: end; padding: 13px; border-top: 1px solid var(--line); }
.chat-composer textarea { width: 100%; max-height: 120px; min-height: 40px; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--bg); color: var(--text); outline: none; line-height: 1.45; }
.chat-composer textarea:focus { border-color: var(--primary); }
.send-btn { background: var(--primary); color: #fff; }
.send-btn:hover { background: var(--primary-strong); color: #fff; }
.mic-btn.listening { background: var(--coral-soft); color: var(--coral); animation: mic 1s infinite alternate; }
@keyframes mic { to { box-shadow: 0 0 0 7px color-mix(in srgb, var(--coral) 10%, transparent); } }
.drawer-scrim, .sidebar-scrim { position: fixed; z-index: 40; inset: 0; background: rgba(10, 18, 15, .4); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.drawer-scrim.open, .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
.sidebar-scrim { z-index: 25; }

.modal-root { position: fixed; z-index: 80; inset: 0; pointer-events: none; }
.modal-root.open { pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8, 16, 13, .55); backdrop-filter: blur(4px); }
.modal { width: min(620px, 100%); max-height: min(780px, 92vh); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 20px; border-top: 1px solid var(--line); }
.toast-stack { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); animation: toast-in .22s ease; }
.toast svg { width: 19px; color: var(--primary); }
.toast.error svg { color: var(--coral); }
.toast strong, .toast small { display: block; }
.toast small { margin-top: 3px; color: var(--text-soft); line-height: 1.4; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.skeleton { position: relative; overflow: hidden; min-height: 100px; border-radius: 8px; background: var(--surface-2); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 75%, transparent), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .courses-grid, .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-card.featured { grid-column: span 1; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .mobile-brand { display: flex; }
  .auth-form-wrap { padding-top: 34px; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .main-shell { margin-left: 0; }
  .dashboard-grid, .settings-layout { grid-template-columns: 1fr; }
  .builder-layout { grid-template-columns: 1fr; }
  .builder-nav { position: static; }
  .lesson-nav { display: flex; overflow-x: auto; }
  .lesson-nav button { min-width: 210px; }
}

@media (max-width: 680px) {
  .topbar { height: 68px; padding: 0 14px; }
  .page-content { padding: 23px 14px 55px; }
  .page-kicker, .top-profile > span:not(.avatar), .top-profile > svg { display: none; }
  .topbar h1 { font-size: 19px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-actions .btn { flex: 1; }
  .stats-grid, .courses-grid, .news-grid, .provider-grid, .form-grid, .media-gallery { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .student-welcome { grid-template-columns: 1fr; }
  .welcome-photo { position: absolute; inset: 0; opacity: .32; }
  .welcome-photo::before { background: rgba(21, 53, 45, .35); }
  .welcome-copy { min-height: 280px; display: flex; flex-direction: column; justify-content: center; }
  .course-card { width: 100%; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .lesson-row { grid-template-columns: 40px minmax(0, 1fr); }
  .lesson-side { grid-column: 2; justify-content: space-between; }
  .activity-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .result-banner { grid-template-columns: 1fr; text-align: center; }
  .result-score { margin: auto; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal, .modal.wide { width: 100%; max-height: 94vh; border-radius: 8px 8px 0 0; }
  .auth-form-wrap { padding-left: 22px; padding-right: 22px; }
  .auth-form { width: 100%; }
  .auth-form h2 { font-size: 29px; }
  .notice { grid-template-columns: 36px minmax(0, 1fr); }
  .notice .btn { grid-column: 1 / -1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
