/* ==========================================================================
   Ilmiy salohiyat va innovatsiya akademiyasi — o‘quv platformasi
   Ranglar logotipdan: to‘q yashil + oltin
   ========================================================================== */
:root {
  --green-950: #0a2a17;
  --green-900: #0f3d22;
  --green-800: #14532d;
  --green-700: #166534;
  --green-600: #15803d;
  --green-500: #1f9d4c;
  --green-200: #bfe6cb;
  --green-100: #dcf3e3;
  --green-50: #eef9f1;
  --gold-700: #a86a00;
  --gold-600: #d98a06;
  --gold-500: #f2a516;
  --gold-400: #f8bf3f;
  --gold-100: #fdf0d2;
  --gold-50: #fef8ea;
  --ink: #122119;
  --ink-2: #2b3b32;
  --muted: #64746b;
  --line: #e2e8e4;
  --line-2: #eef2ef;
  --bg: #f4f7f3;
  --surface: #ffffff;
  --surface-2: #f8faf8;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --red-50: #fef2f2;
  --blue-600: #2563eb;
  --blue-50: #eff6ff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 24, .05);
  --shadow: 0 1px 3px rgba(16, 40, 24, .06), 0 10px 28px -14px rgba(16, 40, 24, .22);
  --shadow-lg: 0 24px 60px -24px rgba(10, 42, 23, .45);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  --sidebar-w: 272px;
  --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-800); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 16.5px; font-weight: 700; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
[hidden] { display: none !important; }
.icon { flex: none; }
::selection { background: var(--gold-100); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
/* Panel foni: yashil-krem gradient va xira ta'lim naqshi (kitob, qalam, qalpoqcha, Brayl nuqtalari) */
.app::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E %3Cg fill='none' stroke='%23166534' stroke-opacity='.11' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E %3Cpath transform='translate(26 36) rotate(-10)' d='M0 4c7-4 15-4 22 0v24c-7-4-15-4-22 0zM22 4c7-4 15-4 22 0v24c-7-4-15-4-22 0z'/%3E %3Cpath transform='translate(152 18) rotate(38)' d='M0 0h8v30l-4 7-4-7zM0 5h8M0 30h8'/%3E %3Cpath transform='translate(104 112) rotate(-6)' d='M0 10 24 0l24 10-24 10zM10 15v9c8 6 20 6 28 0v-9M48 10v12'/%3E %3Cpath transform='translate(196 148) rotate(12)' d='M10 0a10 10 0 0 1 6 18v5H4v-5A10 10 0 0 1 10 0zM5 27h10M7 31h6'/%3E %3Cpath transform='translate(94 60)' d='M7 0l2.1 4.5 4.9.6-3.6 3.4.9 4.9L7 11 2.7 13.4l.9-4.9L0 5.1l4.9-.6z'/%3E %3Cg transform='translate(184 86) rotate(-28)'%3E%3Crect width='42' height='10' rx='2'/%3E%3Cpath d='M7 0v4M14 0v6M21 0v4M28 0v6M35 0v4'/%3E%3C/g%3E %3Cpath transform='translate(118 208)' d='M8 14S0 9 0 4a4 4 0 0 1 8-1 4 4 0 0 1 8 1c0 5-8 10-8 10z'/%3E %3Cpath transform='translate(222 222)' d='M0 6h12M6 0v12'/%3E %3Cpath transform='translate(20 104)' d='M0 0l10 10M10 0 0 10'/%3E %3Ccircle cx='72' cy='120' r='2'/%3E%3Ccircle cx='226' cy='44' r='2.2'/%3E%3Ccircle cx='150' cy='176' r='1.8'/%3E %3C/g%3E %3Cg fill='%23166534' fill-opacity='.12'%3E %3Ccircle cx='44' cy='170' r='3'/%3E%3Ccircle cx='54' cy='170' r='3'/%3E%3Ccircle cx='44' cy='180' r='3'/%3E%3Ccircle cx='54' cy='190' r='3'/%3E %3C/g%3E %3Cg fill='none' stroke='%23166534' stroke-opacity='.11' stroke-width='1.3'%3E %3Ccircle cx='54' cy='180' r='2.6'/%3E%3Ccircle cx='44' cy='190' r='2.6'/%3E %3C/g%3E %3C/svg%3E") 0 0 / 260px 260px repeat,
    radial-gradient(900px 520px at 100% 0%, rgba(242, 165, 22, .14), transparent 62%),
    radial-gradient(760px 560px at 0% 100%, rgba(31, 157, 76, .13), transparent 60%),
    linear-gradient(165deg, #e4f1e7 0%, #f1f5ec 48%, #faf4e4 100%);
}
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  color: rgba(255, 255, 255, .78);
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(242, 165, 22, .16), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(31, 157, 76, .25), transparent 70%),
    linear-gradient(180deg, var(--green-900), var(--green-950));
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; }
.brand:hover { color: #fff; }
.brand img { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 255, 255, .14); }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.brand small { font-size: 12px; color: var(--gold-400); font-weight: 600; }
.nav { flex: 1; overflow-y: auto; padding: 6px 14px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-title {
  margin: 18px 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: rgba(255, 255, 255, .42);
}
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0; border-radius: 12px;
  color: rgba(255, 255, 255, .78); font-weight: 600; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--gold-500);
}
.nav-link.active .icon { color: var(--gold-400); }
.nav-badge {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px;
  background: var(--gold-500); color: #2a1a00; font-size: 11.5px; font-weight: 800; text-align: center;
}
.sidebar-foot { padding: 14px 18px 20px; }
.direction-chip {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  font-size: 12px; line-height: 1.45; color: rgba(255, 255, 255, .72);
}
.direction-chip .icon { color: var(--gold-400); margin-top: 1px; }
.scrim { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 32px;
  background: rgba(246, 249, 243, .78); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--muted); font-weight: 600; }
.crumbs a:hover { color: var(--green-700); }
.crumbs .icon { color: #a7b3ac; }
.crumbs .current { color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; }
.footer { padding: 18px 32px 26px; font-size: 12.5px; color: var(--muted); text-align: center; }
.read-progress {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: 3px; z-index: 50;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); transform-origin: 0 50%; transform: scaleX(0);
}

/* user menu */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 99px;
  background: #fff; border: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--ink);
}
.user-btn:hover { border-color: var(--green-200); }
.user-btn .meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-btn .meta strong { font-size: 13.5px; }
.user-btn .meta small { font-size: 11.5px; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--green-600), var(--green-800)); color: #fff;
  font-weight: 800; font-size: 13px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: #2a1a00; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: none; z-index: 60;
}
.user-menu.open .dropdown { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px;
  color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--green-700); }
.dropdown .sep { height: 1px; background: var(--line-2); margin: 6px 4px; }
.dropdown .danger { color: var(--red-600); }

/* ---------- Typography helpers ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-600); }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-title h2 { font-size: 18px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auto-fill { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.grow { flex: 1; min-width: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { display: flex; align-items: center; gap: 10px; }
.card-head h3 .icon { color: var(--green-600); }
.card-body { padding: 18px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-link { display: block; color: inherit; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.card-link:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--green-200); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1.5px solid transparent;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .tab:focus-visible, .input:focus-visible { outline: 3px solid rgba(242, 165, 22, .45); outline-offset: 2px; }
.btn-primary { background: var(--green-700); color: #fff; box-shadow: 0 6px 16px -8px rgba(22, 101, 52, .7); }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-gold { background: var(--gold-500); color: #2a1a00; box-shadow: 0 6px 16px -8px rgba(217, 138, 6, .8); }
.btn-gold:hover { background: var(--gold-400); color: #2a1a00; }
.btn-outline { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-outline:hover { border-color: var(--green-600); color: var(--green-700); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-white { background: #fff; color: var(--green-800); }
.btn-white:hover { background: var(--gold-50); color: var(--green-900); }
.btn-glass { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn-glass:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-danger-soft { background: var(--red-50); color: var(--red-600); }
.btn-danger-soft:hover { background: var(--red-100); color: #b91c1c; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.danger:hover { background: var(--red-50); color: var(--red-600); }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--line-2); color: var(--muted);
}
.badge.green { background: var(--green-50); color: var(--green-700); }
.badge.gold { background: var(--gold-100); color: var(--gold-700); }
.badge.red { background: var(--red-50); color: var(--red-600); }
.badge.blue { background: var(--blue-50); color: var(--blue-600); }
.badge.dark { background: var(--green-900); color: #fff; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  font-size: 12.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.chip .icon { color: var(--muted); }
.lv-good { color: var(--green-700); background: var(--green-50); }
.lv-mid { color: var(--gold-700); background: var(--gold-100); }
.lv-low { color: var(--red-600); background: var(--red-50); }
.lv-none { color: var(--muted); background: var(--line-2); }
.mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  font-weight: 800; font-size: 16px;
}

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; width: calc(var(--p, 0) * 1%); border-radius: inherit; background: linear-gradient(90deg, var(--green-600), var(--green-500)); transition: width .4s ease; }
.bar.gold > span { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); }
.bar.thin { height: 6px; }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.progress-row .bar { flex: 1; }
.ring {
  --size: 76px; --thick: 8px; --ring-c: var(--green-600); --ring-track: var(--line-2);
  position: relative; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center;
}
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ring-c) calc(var(--p, 0) * 1%), var(--ring-track) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
}
.ring > span { position: relative; font-weight: 800; font-size: calc(var(--size) * .24); letter-spacing: -.02em; }
.ring > span small { font-size: .55em; font-weight: 700; }
.ring.on-dark { --ring-c: var(--gold-400); --ring-track: rgba(255, 255, 255, .16); color: #fff; }
.ring.lg { --size: 132px; --thick: 12px; }

/* ---------- Alerts ---------- */
.messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm);
  animation: slide-in .25s ease;
}
.alert .icon { margin-top: 1px; }
.alert .grow { flex: 1; }
.alert-success { border-color: var(--green-200); background: var(--green-50); color: var(--green-800); }
.alert-error { border-color: #fecaca; background: var(--red-50); color: #991b1b; }
.alert-warning { border-color: #fde68a; background: var(--gold-50); color: #854d0e; }
.alert-info { border-color: #bfdbfe; background: var(--blue-50); color: #1e3a8a; }
.alert .close { background: none; border: 0; color: inherit; opacity: .55; cursor: pointer; padding: 0; }
.alert .close:hover { opacity: 1; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--gold-50);
  border: 1px dashed #f4d48c; color: #6b4a06; font-size: 14px;
}
.note .icon { color: var(--gold-600); margin-top: 2px; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .empty-icon {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--green-50); color: var(--green-600);
}
.empty h3 { margin-bottom: 6px; }
.empty p { max-width: 46ch; margin: 0 auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfa; }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--line); }
.table .num { text-align: center; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 34px; height: 34px; font-size: 12px; }
.person strong { display: block; font-size: 14px; }
.table .person strong { white-space: nowrap; }
.person small { color: var(--muted); font-size: 12.5px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 18px; }
.field > label, .label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.field .req { color: var(--red-600); margin-left: 2px; }
.input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font: inherit; font-size: 14.5px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9aa8a0; }
.input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(21, 128, 61, .12); }
.input.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select.input {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364746b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="color"].input { padding: 4px; height: 46px; width: 90px; cursor: pointer; }
.field .help { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--red-600); font-size: 13px; font-weight: 600; }
.errorlist.nonfield { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--red-50); border: 1px solid #fecaca; }
.field.has-error .input { border-color: #f87171; }
.checkbox { width: 18px; height: 18px; accent-color: var(--green-700); vertical-align: middle; }
.check-field { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.check-field label { font-weight: 600; font-size: 14px; cursor: pointer; margin: 0; }
.choice-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.choice-list > div, .choice-list li { display: contents; }
.choice-list label {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.choice-list label:has(input:checked) { border-color: var(--green-600); background: var(--green-50); color: var(--green-800); }
.choice-list input { accent-color: var(--green-700); }
.file-input { display: block; width: 100%; font: inherit; font-size: 14px; color: var(--muted); }
.file-input::file-selector-button {
  margin-right: 12px; padding: 9px 16px; border-radius: 10px; border: 1.5px dashed var(--green-600);
  background: var(--green-50); color: var(--green-800); font: inherit; font-weight: 700; cursor: pointer;
}
.field .clearable-file-input, .field a[href] { font-size: 13px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 40px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .input { width: auto; min-width: 220px; }
.filters .search-input .input { width: 100%; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 700; font-size: 13.5px;
}
.pill:hover { border-color: var(--green-600); color: var(--green-700); }
.pill.active { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.pill .count { font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--line-2); color: var(--muted); }
.pill.active .count { background: rgba(255, 255, 255, .2); color: #fff; }

/* ---------- Dashboard ---------- */
.welcome {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 28px;
  padding: 30px 32px; border-radius: var(--radius-lg); color: #fff;
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(242, 165, 22, .28), transparent 60%),
    linear-gradient(120deg, var(--green-800), var(--green-950));
  box-shadow: var(--shadow-lg);
}
.welcome::after {
  content: ""; position: absolute; right: -60px; bottom: -90px; width: 280px; height: 280px; border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, .05);
}
.welcome .grow { position: relative; z-index: 1; }
.welcome h1 { color: #fff; font-size: 27px; }
.welcome p { color: rgba(255, 255, 255, .78); margin-top: 8px; max-width: 62ch; }
.welcome .eyebrow { color: var(--gold-400); }
.welcome .row { margin-top: 18px; flex-wrap: wrap; }
.welcome .ring { position: relative; z-index: 1; }
.glass-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); font-size: 13px; font-weight: 600; color: #fff;
}
.glass-chip .icon { color: var(--gold-400); }
.stat { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--green-50); color: var(--green-700); }
.stat-icon.gold { background: var(--gold-100); color: var(--gold-700); }
.stat-icon.blue { background: var(--blue-50); color: var(--blue-600); }
.stat-icon.rose { background: #fff1f2; color: #e11d48; }
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 700; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line-2); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); color: inherit; }
.list-item .title { font-weight: 700; font-size: 14.5px; }
.list-item .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.list-item .end { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--green-600)); }

/* ---------- Subject cards ---------- */
.subject-icon {
  display: grid; place-items: center; flex: none; border-radius: 14px;
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c);
}
.subject-card {
  --c: var(--green-600);
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; color: inherit; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.subject-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.subject-card:hover { color: inherit; transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 35%, var(--line)); }
.subject-card .top { display: flex; align-items: flex-start; gap: 14px; padding-right: 18px; }
.subject-card h3 { font-size: 16px; line-height: 1.35; }
.subject-card .desc { font-size: 13.5px; color: var(--muted); }
.subject-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.subject-card .meta .chip { padding: 3px 9px; font-size: 12px; }
.subject-card .num {
  position: absolute; right: 16px; top: 14px; font-size: 12px; font-weight: 800; color: color-mix(in srgb, var(--c) 55%, #fff);
}
.subject-card .progress-row { margin-top: 2px; }
.subject-card .progress-row .bar > span { background: var(--c); }
.continue-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }

/* ---------- Subject hero ---------- */
.subject-hero {
  --c: var(--green-600);
  position: relative; overflow: hidden; display: flex; gap: 24px; align-items: center;
  padding: 28px 30px; border-radius: var(--radius-lg); color: #fff;
  background:
    radial-gradient(70% 140% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%),
    linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #06210f));
  box-shadow: var(--shadow-lg);
}
.subject-hero::after {
  content: ""; position: absolute; right: 120px; top: -80px; width: 220px; height: 220px; border-radius: 50%;
  border: 30px solid rgba(255, 255, 255, .06);
}
.subject-hero .hero-icon {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22);
}
.subject-hero h1 { color: #fff; font-size: 26px; }
.subject-hero p { color: rgba(255, 255, 255, .82); margin-top: 6px; max-width: 70ch; }
.subject-hero .row { margin-top: 14px; flex-wrap: wrap; gap: 8px; }
.subject-hero .grow { position: relative; z-index: 1; }
.subject-hero .ring { --ring-c: #fff; --ring-track: rgba(255, 255, 255, .22); color: #fff; z-index: 1; }
.subject-hero .hero-side { display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; font-size: 12px; font-weight: 700; color: rgba(255,255,255,.8); }
.tabs-wrap { position: sticky; top: var(--topbar-h); z-index: 20; margin: 18px 0 22px; padding: 6px 0; }
.tabs {
  display: flex; gap: 2px; padding: 6px; overflow-x: auto; scrollbar-width: none;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; border-radius: 11px;
  color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.active { background: var(--green-800); color: #fff; }
.tab.active .icon { color: var(--gold-400); }
.tab .count { font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--line-2); color: var(--muted); }
.tab.active .count { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- Lecture list ---------- */
.lesson {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); color: inherit;
}
.lesson:last-child { border-bottom: 0; }
.lesson:hover { background: var(--surface-2); color: inherit; }
.lesson .n {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  font-weight: 800; background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink-2);
}
.lesson.done .n { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.lesson .title { font-weight: 700; }
.lesson .sub { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.lesson .sub span { display: inline-flex; align-items: center; gap: 5px; }
.lesson .go { margin-left: auto; color: #b2beb7; flex: none; }
.lesson:hover .go { color: var(--green-600); }

/* ---------- Syllabus ---------- */
.hours { display: inline-flex; min-width: 30px; justify-content: center; padding: 2px 8px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.h-lec { background: var(--green-50); color: var(--green-700); }
.h-pr { background: var(--gold-100); color: var(--gold-700); }
.h-sem { background: var(--blue-50); color: var(--blue-600); }
.h-zero { color: #c3ccc6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Materials ---------- */
.file-tile {
  position: relative; width: 46px; height: 56px; border-radius: 8px 14px 8px 8px; flex: none;
  display: grid; place-items: end center; padding-bottom: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: #7a8a81; text-transform: uppercase; box-shadow: inset 0 -16px 24px -18px rgba(0,0,0,.3);
}
.file-tile::before { content: ""; position: absolute; right: 0; top: 0; width: 14px; height: 14px; background: rgba(255,255,255,.35); border-radius: 0 12px 0 6px; }
.file-tile.pdf { background: linear-gradient(160deg, #ef4444, #b91c1c); }
.file-tile.doc { background: linear-gradient(160deg, #3b82f6, #1d4ed8); }
.file-tile.ppt { background: linear-gradient(160deg, #fb923c, #c2410c); }
.file-tile.xls { background: linear-gradient(160deg, #22c55e, #15803d); }
.file-tile.img, .file-tile.video { background: linear-gradient(160deg, #a855f7, #7e22ce); }
.file-tile.link { background: linear-gradient(160deg, #14b8a6, #0f766e); }
.material { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.material:last-child { border-bottom: 0; }
.material .title { font-weight: 700; line-height: 1.35; }
.material .sub { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.material .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }
.material-card { display: flex; gap: 14px; padding: 16px; }
.material-card .title { font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.material-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.material-card .actions { display: flex; gap: 8px; margin-top: 10px; }
.group-label { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.group-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group-label:first-child { margin-top: 0; }
.majmua-card {
  display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--gold-50), #fff 60%); border: 1px solid #f5dfa6;
}
.majmua-card .stat-icon { width: 54px; height: 54px; }

/* ---------- Prose (reading) ---------- */
.prose { font-family: var(--font-read); font-size: 18px; line-height: 1.78; color: #1c2a22; max-width: 76ch; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 1em; }
.prose p { margin: 0; }
.prose p + p { margin-top: .9em; }
.prose h2, .prose h3 { font-family: var(--font); font-size: 20px; font-weight: 800; color: var(--green-900); margin-top: 1.9em; margin-bottom: .2em; letter-spacing: -.01em; }
.prose h4 { font-family: var(--font); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-700); margin-top: 1.8em; }
.prose h3:first-child, .prose h4:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--gold-600); }
.prose strong { color: #0f2318; }
.prose figure { margin: 1.6em 0; }
.prose figure img { margin: 0 auto; max-height: 520px; width: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--gold-500); color: var(--ink-2); font-style: italic; }
.prose table { border-collapse: collapse; font-family: var(--font); font-size: 14px; width: 100%; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 10px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose.compact { font-size: 16.5px; line-height: 1.72; max-width: none; }

/* ---------- Lecture page ---------- */
.lecture-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: calc(var(--topbar-h) + 18px); max-height: calc(100vh - var(--topbar-h) - 36px); display: flex; flex-direction: column; overflow: hidden; }
.toc .card-head { padding: 14px 16px; }
.toc-list { overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.toc-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.toc-item:hover { background: var(--surface-2); color: var(--ink); }
.toc-item .n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; font-size: 11.5px; font-weight: 800; background: var(--line-2); color: var(--muted); }
.toc-item.done .n { background: var(--green-100); color: var(--green-700); }
.toc-item.current { background: var(--green-50); color: var(--green-900); }
.toc-item.current .n { background: var(--green-700); color: #fff; }
.lecture-head { padding: 26px 30px 0; }
.lecture-head h1 { font-size: 27px; margin-top: 8px; }
.lecture-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--line-2); gap: 2px; }
.segmented button, .segmented a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px; border: 0;
  background: transparent; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.segmented .on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.lecture-body { padding: 28px 30px 34px; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 12px; background: #525659; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 26px; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.complete-box {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 30px 30px; padding: 20px 22px; border-radius: 16px;
  background: linear-gradient(120deg, var(--green-50), #fff); border: 1px solid var(--green-200);
}
.complete-box.done { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.complete-box.done .muted { color: rgba(255, 255, 255, .8); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); color: inherit; }
.pager a:hover { border-color: var(--green-600); color: inherit; }
.pager .lbl { font-size: 12px; font-weight: 800; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .05em; }
.pager .t { font-weight: 700; font-size: 14.5px; }
.pager .next { text-align: right; align-items: flex-end; }

/* ---------- Tests ---------- */
.test-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.test-card .top { display: flex; align-items: flex-start; gap: 14px; }
.test-card .facts { display: flex; flex-wrap: wrap; gap: 6px; }
.test-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.facts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fact { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.fact .v { font-size: 20px; font-weight: 800; }
.fact .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.quiz-shell { max-width: 820px; margin: 0 auto; }
.quiz-top {
  position: sticky; top: var(--topbar-h); z-index: 15; display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; margin-bottom: 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.quiz-top .grow .title { font-weight: 800; font-size: 14.5px; }
.timer {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; flex: none;
  background: var(--green-50); color: var(--green-800); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px;
}
.timer.warn { background: var(--gold-100); color: var(--gold-700); }
.timer.danger { background: var(--red-50); color: var(--red-600); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.q { padding: 26px 28px; margin-bottom: 16px; }
.q-num { font-size: 12.5px; font-weight: 800; color: var(--gold-600); letter-spacing: .06em; text-transform: uppercase; }
.q-text { font-size: 19px; font-weight: 700; line-height: 1.45; margin: 8px 0 20px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; transition: border-color .15s, background .15s, transform .1s;
}
.option:hover { border-color: var(--green-200); background: var(--surface-2); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .letter {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--line); font-weight: 800; font-size: 13.5px; color: var(--muted); background: #fff;
}
.option .txt { padding-top: 4px; font-size: 15.5px; line-height: 1.45; }
.option:has(input:checked) { border-color: var(--green-600); background: var(--green-50); }
.option:has(input:checked) .letter { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid rgba(242, 165, 22, .45); outline-offset: 2px; }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette button {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font: inherit; font-size: 13px; font-weight: 800; color: var(--muted); cursor: pointer;
}
.palette button.answered { background: var(--green-100); border-color: var(--green-200); color: var(--green-800); }
.palette button.current { border-color: var(--green-700); color: var(--green-800); box-shadow: 0 0 0 3px rgba(21, 128, 61, .15); }
.quiz.js .q { display: none; }
.quiz.js .q.current { display: block; animation: fade .2s ease; }
html:not(.js) .js-only { display: none !important; }
fieldset.q { margin: 0 0 16px; min-width: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.modal-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(10, 30, 18, .45); backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 440px; padding: 26px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; }
.modal .stat-icon { margin: 0 auto 14px; }
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal .row { justify-content: center; margin-top: 20px; }
.result-hero { display: flex; align-items: center; gap: 28px; padding: 28px 30px; flex-wrap: wrap; }
.result-hero.pass { background: linear-gradient(120deg, var(--green-50), #fff 70%); }
.result-hero.fail { background: linear-gradient(120deg, var(--red-50), #fff 70%); }
.review .option { cursor: default; }
.review .option.correct { border-color: var(--green-600); background: var(--green-50); }
.review .option.correct .letter { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.review .option.wrong { border-color: #f87171; background: var(--red-50); }
.review .option.wrong .letter { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.review .tag { margin-left: auto; flex: none; font-size: 12px; font-weight: 800; padding-top: 5px; }
.q.ok { border-left: 4px solid var(--green-600); }
.q.bad { border-left: 4px solid var(--red-600); }

/* ---------- Homework ---------- */
.hw-card { display: flex; gap: 16px; padding: 18px 20px; align-items: flex-start; }
.hw-card .title { font-weight: 800; font-size: 15.5px; }
.hw-card .sub { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.hw-card .sub span { display: inline-flex; align-items: center; gap: 6px; }
.hw-card .end { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.deadline.overdue { color: var(--red-600); font-weight: 700; }
.score-big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.score-big small { font-size: 16px; color: var(--muted); }
.feedback { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--gold-500); font-size: 14.5px; }
.answer-text { white-space: pre-wrap; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14.5px; }

/* ---------- Rich text editor ---------- */
.rte { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.rte:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(21, 128, 61, .12); }
.rte-toolbar { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); border-radius: 11px 11px 0 0; }
.rte-toolbar button { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; font: inherit; font-weight: 800; font-size: 13px; }
.rte-toolbar button:hover { background: var(--line); }
.rte-toolbar button.on { background: var(--green-100); color: var(--green-800); }
.rte-toolbar .sep { width: 1px; margin: 6px 4px; background: var(--line); }
.rte-area { min-height: 300px; max-height: 70vh; overflow: auto; padding: 18px 22px; outline: none; }
.rte-area.prose { font-size: 16px; max-width: none; }
.rte textarea.input { border: 0; border-radius: 0 0 11px 11px; min-height: 300px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-side {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  padding: 44px 52px; color: #fff;
  background:
    radial-gradient(70% 50% at 0% 0%, rgba(242, 165, 22, .22), transparent 60%),
    radial-gradient(60% 60% at 100% 100%, rgba(31, 157, 76, .35), transparent 70%),
    linear-gradient(160deg, var(--green-900), var(--green-950));
}
.auth-side::after {
  content: ""; position: absolute; right: -140px; top: 22%; width: 420px; height: 420px; border-radius: 50%;
  border: 50px solid rgba(255, 255, 255, .04);
}
.auth-logo { display: flex; align-items: center; gap: 14px; color: #fff; position: relative; z-index: 1; }
.auth-logo img { width: 58px; height: 58px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255, 255, 255, .12); }
.auth-logo strong { display: block; font-size: 17px; }
.auth-logo small { color: var(--gold-400); font-weight: 700; font-size: 12.5px; }
.auth-side h2 { color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -.025em; max-width: 16ch; }
.auth-side h2 em { font-style: normal; color: var(--gold-400); }
.auth-side .lead { color: rgba(255, 255, 255, .78); margin-top: 14px; max-width: 46ch; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .88); font-weight: 600; }
.auth-points .icon { color: var(--gold-400); }
.auth-points .pt { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); }
.auth-side .foot { font-size: 12.5px; color: rgba(255, 255, 255, .55); position: relative; z-index: 1; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 27px; }
.auth-card .sub { color: var(--muted); margin: 8px 0 26px; }
.auth-card .panel { padding: 30px; border-radius: 22px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-alt { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth-alt a { font-weight: 800; }

/* ---------- Landing ---------- */
.landing { background: #fff; }
.l-nav { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.l-nav .container { display: flex; align-items: center; gap: 22px; height: 72px; }
.l-nav .brand { padding: 0; color: var(--ink); }
.l-nav .brand strong { color: var(--ink); }
.l-nav .brand small { color: var(--gold-600); }
.l-nav .brand img { box-shadow: none; }
.l-links { display: flex; gap: 22px; margin-left: auto; font-weight: 700; font-size: 14.5px; }
.l-links a { color: var(--ink-2); }
.l-links a:hover { color: var(--green-700); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.l-hero {
  position: relative; overflow: hidden; color: #fff; padding: 84px 0 96px;
  background:
    radial-gradient(50% 70% at 85% 30%, rgba(242, 165, 22, .22), transparent 65%),
    radial-gradient(60% 60% at 0% 100%, rgba(31, 157, 76, .35), transparent 70%),
    linear-gradient(150deg, var(--green-900), var(--green-950));
}
.l-hero::before {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.l-hero .container { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; align-items: center; }
.l-hero h1 { color: #fff; font-size: 52px; line-height: 1.06; letter-spacing: -.035em; margin-top: 18px; }
.l-hero h1 em { font-style: normal; color: var(--gold-400); }
.l-hero .lead { color: rgba(255, 255, 255, .8); font-size: 17.5px; margin-top: 20px; max-width: 54ch; }
.l-hero .cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.l-hero .badge-line { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); font-size: 13px; font-weight: 700; }
.l-hero .badge-line .icon { color: var(--gold-400); }
.l-visual { position: relative; display: grid; place-items: center; min-height: 380px; }
.l-visual .logo-orb {
  width: 300px; height: 300px; border-radius: 50%; padding: 14px; background: rgba(255, 255, 255, .08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 30px 80px -20px rgba(0, 0, 0, .55), 0 0 120px rgba(242, 165, 22, .25);
}
.l-visual .logo-orb img { width: 100%; height: 100%; border-radius: 50%; }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); animation: float 6s ease-in-out infinite;
}
.float-card .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
.float-card strong { display: block; font-size: 18px; line-height: 1.1; }
.float-card small { color: var(--muted); font-size: 12px; font-weight: 600; }
.float-card.a { left: -6px; top: 34px; }
.float-card.b { right: -10px; top: 46%; animation-delay: -2s; }
.float-card.c { left: 22px; bottom: 8px; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.l-section { padding: 80px 0; }
.l-section.alt { background: var(--bg); }
.l-head { text-align: center; max-width: 720px; margin: 0 auto 44px; }
.l-head h2 { font-size: 34px; letter-spacing: -.025em; margin-top: 10px; }
.l-head p { color: var(--muted); margin-top: 12px; font-size: 16px; }
.feature { padding: 24px; border-radius: 20px; background: #fff; border: 1px solid var(--line); transition: transform .18s, box-shadow .18s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .stat-icon { margin-bottom: 16px; }
.feature h3 { font-size: 17px; }
.feature p { color: var(--muted); margin-top: 8px; font-size: 14.5px; }
.l-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: -48px; position: relative; z-index: 2; }
.l-stat { padding: 22px; border-radius: 18px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.l-stat strong { display: block; font-size: 32px; font-weight: 800; color: var(--green-800); letter-spacing: -.02em; }
.l-stat span { color: var(--muted); font-weight: 600; font-size: 14px; }
.l-subject { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: inherit; }
.l-subject:hover { border-color: var(--green-200); color: inherit; box-shadow: var(--shadow); }
.l-subject strong { font-size: 15px; line-height: 1.35; }
.l-subject small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.steps { counter-reset: step; }
.step { position: relative; padding: 26px 24px 24px; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.step::before {
  counter-increment: step; content: counter(step); display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px;
  border-radius: 14px; background: var(--gold-500); color: #2a1a00; font-weight: 800; font-size: 18px;
}
.step p { color: var(--muted); margin-top: 8px; font-size: 14.5px; }
.l-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 40px 44px; border-radius: 26px; color: #fff;
  background: radial-gradient(60% 120% at 100% 0%, rgba(242, 165, 22, .3), transparent 60%), linear-gradient(120deg, var(--green-800), var(--green-950));
}
.l-cta h2 { color: #fff; font-size: 28px; }
.l-cta p { color: rgba(255, 255, 255, .78); margin-top: 8px; }
.l-footer { padding: 40px 0; background: var(--green-950); color: rgba(255, 255, 255, .7); font-size: 14px; }
.l-footer .container { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.l-footer strong { color: #fff; }
.l-footer a { color: var(--gold-400); }

/* ---------- Teacher ---------- */
.manage-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.manage-head h1 { font-size: 23px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.q-row { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.q-row:last-child { border-bottom: 0; }
.q-row .n { font-weight: 800; color: var(--muted); min-width: 28px; }
.q-row .choices { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.q-row .choices li.ok { color: var(--green-700); font-weight: 700; }
.q-row .choices li.ok::before { content: "✓ "; }
.grade-cell { display: inline-flex; min-width: 46px; justify-content: center; padding: 3px 8px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.form-grid.grade-form { grid-template-columns: 2fr 1.3fr .7fr .7fr 1fr; }
.inline-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.inline-form .input { width: auto; padding: 8px 12px; font-size: 14px; }
.inline-form .input.score { width: 86px; }
.inline-form .input.textarea { min-height: 40px; flex: 1; min-width: 200px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lecture-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; }
  .toc-list { max-height: 260px; }
  .l-hero .container { grid-template-columns: 1fr; }
  .l-visual { display: none; }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 30, 18, .45); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .read-progress { left: 0; }
  .topbar { padding: 0 20px; }
  .content { padding: 22px 20px 40px; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.grade-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 24px; }
  .auth-side h2, .auth-side .lead, .auth-points { display: none; }
  .l-links { display: none; }
  .l-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  h1 { font-size: 23px; }
  .content { padding: 18px 16px 36px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .user-btn .meta, .hide-sm { display: none !important; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
  .stat-value { font-size: 21px; }
  .welcome { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
  .welcome h1 { font-size: 22px; }
  .subject-hero { flex-direction: row; align-items: center; gap: 14px; padding: 18px 18px; flex-wrap: wrap; }
  .subject-hero .hero-icon { display: none; }
  .subject-hero h1 { font-size: 19px; }
  .subject-hero p, .subject-hero .glass-chip.teacher { display: none; }
  .subject-hero .row { margin-top: 10px; }
  .subject-hero .glass-chip { padding: 4px 10px; font-size: 12px; }
  .subject-hero .hero-side .ring { --size: 58px; --thick: 6px; }
  .subject-hero .hero-side > span { display: none; }
  .welcome .ring.lg { --size: 96px; --thick: 10px; }
  .material .grow { flex-basis: calc(100% - 64px); }
  .lecture-head, .lecture-body { padding-left: 18px; padding-right: 18px; }
  .complete-box { margin: 0 18px 22px; }
  .prose { font-size: 16.5px; line-height: 1.72; }
  .pager { grid-template-columns: 1fr; }
  .material, .lesson { padding: 14px 16px; gap: 12px; }
  .material { flex-wrap: wrap; }
  .material .actions { margin-left: 62px; }
  .hw-card { flex-wrap: wrap; }
  .hw-card .end { margin-left: 0; flex-direction: row; align-items: center; width: 100%; }
  .q { padding: 20px 18px; }
  .q-text { font-size: 17px; }
  .quiz-top { flex-wrap: wrap; }
  .form-grid, .form-grid.grade-form { grid-template-columns: minmax(0, 1fr); }
  .filters .input { min-width: 0; width: 100%; }
  .l-hero { padding: 56px 0 80px; }
  .l-hero h1 { font-size: 36px; }
  .l-head h2 { font-size: 26px; }
  .l-section { padding: 56px 0; }
  .l-cta { padding: 28px 24px; }
  .page-head { margin-bottom: 18px; }
  .card-pad { padding: 18px; }
  .card-head, .card-body, .list-item { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .tabs-wrap, .toc, .complete-box, .pager, .lecture-tools, .footer { display: none !important; }
  .main { margin: 0; }
}
