:root {
  --night: #102e2c;
  --forest: #173d3a;
  --forest-soft: #28514d;
  --paper: #f4eddf;
  --paper-deep: #e8dcc8;
  --ink: #233230;
  --muted: #6d7771;
  --brass: #d3a552;
  --orange: #e97816;
  --green: #4c8b3e;
  --red: #b54839;
  --white: #fffdf7;
  --line: rgba(35, 50, 48, .15);
  --line-soft: rgba(35, 50, 48, .08);
  --shadow: 0 24px 70px rgba(8, 31, 29, .18);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; background: #f1ecdf; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.brand-lockup, .login-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: .04em; }
.brand-lockup small { margin-left: 3px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--brass); font-family: "Songti SC", "STSong", serif; }
.brand-mark.light { border-color: rgba(255, 255, 255, .3); }
.eyebrow { display: block; margin: 0 0 8px; color: #987036; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

.primary, .secondary, .text-button, .icon-button {
  border: 0;
  font-weight: 700;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}
.primary, .secondary { min-height: 48px; padding: 0 20px; border-radius: 14px; }
.primary { color: #fff; background: var(--forest); box-shadow: 0 10px 24px rgba(5, 27, 25, .16); }
.secondary { border: 1px solid currentColor; color: var(--forest); background: transparent; }
.primary:hover, .secondary:hover { transform: translateY(-2px); }
.compact { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 13px; }
.text-button { padding: 6px; color: var(--muted); background: transparent; font-size: 12px; }
.text-button:hover { color: var(--forest); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); background: rgba(35, 50, 48, .07); font-size: 23px; }

/* Login */
.login-screen { position: relative; min-height: 100svh; overflow: hidden; color: #fffdf7; background: var(--forest); }
.login-screen::before { content: ""; position: absolute; inset: -20% auto auto -8%; width: 62vw; height: 62vw; border: 1px solid rgba(211, 165, 82, .12); border-radius: 50%; box-shadow: 0 0 0 10vw rgba(211, 165, 82, .025), 0 0 0 20vw rgba(211, 165, 82, .018); pointer-events: none; }
.login-screen::after { content: "星"; position: absolute; right: -2vw; bottom: -20vh; color: rgba(255, 255, 255, .025); font: 700 min(60vw, 760px)/1 "Songti SC", serif; pointer-events: none; }
.login-brand { position: relative; z-index: 1; height: 84px; padding: 0 clamp(24px, 5vw, 74px); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.login-brand small { margin-left: 5px; color: rgba(255, 255, 255, .55); font-weight: 400; letter-spacing: 0; }
.login-stage { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px); align-items: center; gap: clamp(50px, 8vw, 140px); width: min(1320px, calc(100vw - 48px)); min-height: calc(100svh - 150px); margin: 0 auto; padding: 50px 0 70px; }
.login-copy { max-width: 720px; animation: login-copy-in .65s cubic-bezier(.2, .8, .2, 1) both; }
.login-copy .eyebrow { color: #dfb86e; }
.login-copy h1 { margin: 0; font: 700 clamp(46px, 5.8vw, 82px)/1.13 "Songti SC", "STSong", serif; letter-spacing: -.05em; }
.login-copy > p { max-width: 610px; margin: 24px 0 0; color: rgba(255, 255, 255, .65); font-size: 17px; line-height: 1.8; }
.login-feature { display: grid; grid-template-columns: 34px 1fr; gap: 14px 16px; max-width: 580px; margin-top: 42px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .14); }
.login-feature > span { color: #dfb86e; font: 700 12px ui-monospace, monospace; }
.login-feature p { margin: 0; color: rgba(255, 255, 255, .58); font-size: 13px; line-height: 1.55; }
.login-feature strong { margin-right: 12px; color: #fff; }
.login-form { padding: 34px 36px 30px; border-radius: 26px; color: var(--ink); background: var(--white); box-shadow: 0 34px 80px rgba(2, 18, 17, .3); animation: login-form-in .55s .08s cubic-bezier(.2, .8, .2, 1) both; }
.login-form header { display: flex; align-items: center; gap: 15px; margin-bottom: 30px; }
.login-form header small { display: block; color: var(--brass); font-size: 12px; font-weight: 800; }
.login-form h2 { margin: 4px 0 0; font: 700 27px "Songti SC", "STSong", serif; }
.login-form label, .admin-dialog label, .admin-dialog fieldset { display: block; margin-top: 19px; border: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.login-form input, .admin-dialog input, .admin-dialog textarea, .admin-dialog select {
  display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #faf7ef; font-size: 14px; line-height: 1.55;
}
.login-form input:focus, .admin-dialog input:focus, .admin-dialog textarea:focus, .admin-dialog select:focus { border-color: var(--brass); box-shadow: 0 0 0 4px rgba(211, 165, 82, .12); }
.login-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 27px; }
.login-button span { font-size: 22px; font-weight: 400; }
.login-hint { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.login-hint code { color: #72562f; }
.login-screen > footer { position: absolute; z-index: 1; bottom: 24px; left: clamp(24px, 5vw, 74px); color: rgba(255, 255, 255, .35); font-size: 12px; }

/* App shell */
.admin-app { min-height: 100svh; }
.admin-topbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr) auto; align-items: center; height: 72px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255, 253, 247, .9); box-shadow: 0 2px 14px rgba(35, 50, 48, .04); backdrop-filter: blur(14px); }
.topbar-context { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.topbar-context i { width: 3px; height: 3px; border-radius: 50%; background: var(--brass); }
.account-block { display: flex; align-items: center; gap: 10px; }
.account-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: var(--forest); background: rgba(211, 165, 82, .23); font: 700 16px "Songti SC", serif; }
.account-block strong, .account-block small { display: block; }
.account-block strong { font-size: 13px; }
.account-block small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.account-block .text-button { margin-left: 7px; }
.account-screen { min-height: 100svh; background: var(--paper); }
.account-topbar { display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 clamp(22px, 5vw, 74px); border-bottom: 1px solid var(--line); background: rgba(255, 253, 247, .88); }
.account-workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: clamp(50px, 9vw, 130px); align-items: center; width: min(1120px, calc(100% - 44px)); min-height: calc(100svh - 72px); margin: 0 auto; padding: 70px 0; }
.account-intro h1 { margin: 0; color: var(--forest); font: 700 clamp(40px, 5vw, 64px) "Songti SC", serif; }
.account-intro > p { max-width: 570px; margin: 18px 0 35px; color: var(--muted); line-height: 1.8; }
.account-intro dl { margin: 0; border-top: 1px solid var(--line); }
.account-intro dl div { display: grid; grid-template-columns: 120px minmax(0, 1fr); padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.account-intro dt { color: var(--muted); font-size: 12px; }
.account-intro dd { margin: 0; font-size: 13px; font-weight: 700; }
.account-action { padding: 34px; border-radius: 24px; background: var(--white); box-shadow: 0 22px 60px rgba(16, 46, 44, .12); }
.account-action h2 { margin: 0; font: 700 29px "Songti SC", serif; }
.account-action p { margin: 12px 0 25px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.admin-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: calc(100svh - 72px); }
.admin-sidebar { position: sticky; top: 72px; display: flex; flex-direction: column; height: calc(100svh - 72px); padding: 24px 14px 18px; border-right: 1px solid var(--line); background: rgba(255, 253, 247, .58); }
.admin-sidebar nav { display: grid; gap: 5px; }
.nav-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 47px; padding: 0 15px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; text-align: left; transition: color .18s ease, background .18s ease, transform .18s ease; }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:first-child svg { fill: currentColor; stroke: none; }
.nav-item:hover { color: var(--forest); background: rgba(255, 253, 247, .72); transform: translateX(2px); }
.nav-item.active { color: #fff; background: var(--forest); box-shadow: 0 9px 23px rgba(23, 61, 58, .15); }
.nav-group { display: grid; gap: 3px; }
.nav-parent { grid-template-columns: 24px minmax(0, 1fr) 16px; }
.nav-parent > i { color: currentColor; font-size: 15px; font-style: normal; text-align: center; transition: transform .18s ease; }
.nav-group.expanded .nav-parent > i { transform: rotate(180deg); }
.nav-group.child-active .nav-parent { color: var(--forest); background: rgba(23, 61, 58, .06); }
.nav-submenu { display: none; gap: 2px; margin: 0 0 4px 27px; padding-left: 15px; border-left: 1px solid rgba(35, 50, 48, .13); }
.nav-group.expanded .nav-submenu { display: grid; animation: workspace-in .18s ease-out both; }
.nav-subitem { min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; text-align: left; transition: color .16s ease, background .16s ease; }
.nav-subitem:hover { color: var(--forest); background: rgba(255, 253, 247, .75); }
.nav-subitem.active { color: var(--forest); background: rgba(211, 165, 82, .18); box-shadow: inset 2px 0 0 var(--brass); }
.sidebar-note { margin-top: auto; padding: 17px 14px 5px; border-top: 1px solid var(--line); }
.sidebar-note span { color: #8b6332; font-size: 12px; font-weight: 800; }
.sidebar-note p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.admin-workspace { min-width: 0; padding: 42px clamp(30px, 5vw, 76px) 80px; overflow: hidden; }
.workspace-view { animation: workspace-in .3s ease-out both; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.workspace-heading h1 { margin: 0; font: 700 clamp(32px, 4vw, 48px) "Songti SC", "STSong", serif; letter-spacing: -.03em; }
.workspace-heading p { max-width: 660px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.workspace-heading .primary { min-width: 116px; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.view-section { padding: 30px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font: 700 20px "Songti SC", "STSong", serif; }
.section-heading span { color: var(--muted); font-size: 12px; }

/* Overview */
.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 5px; }
.metric-item { min-width: 0; padding: 18px 24px 19px 0; border-right: 1px solid var(--line); }
.metric-item + .metric-item { padding-left: 24px; }
.metric-item:last-child { border-right: 0; }
.metric-item small, .metric-item strong, .metric-item span { display: block; }
.metric-item small { color: var(--muted); font-size: 12px; }
.metric-item strong { margin-top: 9px; color: var(--forest); font: 700 clamp(26px, 3.2vw, 40px)/1 "Songti SC", serif; }
.metric-item span { margin-top: 8px; color: #987036; font-size: 12px; }
.overview-intro { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 54px; align-items: start; }
.progress-note { padding: 3px 0 3px 20px; border-left: 3px solid var(--brass); }
.progress-note small { color: #987036; font-size: 12px; font-weight: 800; }
.progress-note h3 { margin: 8px 0 7px; font: 700 19px "Songti SC", serif; }
.progress-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* Tables and filters */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.search-field { position: relative; flex: 1; max-width: 380px; }
.search-field svg { position: absolute; top: 12px; left: 13px; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search-field input, .toolbar select { width: 100%; min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: rgba(255, 253, 247, .68); font-size: 12px; }
.search-field input { padding-left: 39px; }
.toolbar select { width: auto; min-width: 130px; }
.search-field input:focus, .toolbar select:focus { border-color: var(--brass); }
.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 13px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.data-table td { padding: 18px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.data-table tbody tr { transition: background .16s ease; }
.data-table tbody tr:hover { background: rgba(255, 253, 247, .6); }
.data-table strong, .data-table small { display: block; }
.data-table strong { color: var(--ink); font-size: 14px; }
.data-table small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.table-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.table-action { padding: 6px 7px; border: 0; color: var(--forest); background: transparent; font-size: 12px; font-weight: 700; }
.table-action.danger { color: var(--red); }
.table-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: var(--muted); background: rgba(35, 50, 48, .07); font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.active, .status-badge.published { color: var(--green); background: rgba(76, 139, 62, .1); }
.status-badge.upcoming { color: #9a6830; background: rgba(211, 165, 82, .14); }
.status-badge.ended, .status-badge.inactive, .status-badge.archived { color: var(--muted); }
.role-badge { color: #72562f; font-size: 12px; font-weight: 700; }
.empty-table { padding: 54px 20px !important; color: var(--muted); text-align: center; }

/* Courses */
.course-list { display: grid; gap: 0; }
.course-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 26px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.course-cover { position: relative; display: grid; place-items: end start; width: 116px; height: 148px; padding: 16px 14px; overflow: hidden; border-radius: 8px 16px 16px 8px; color: #fff8e7; background: var(--forest); box-shadow: 0 14px 24px rgba(23, 61, 58, .16); }
.course-cover::before { content: ""; position: absolute; inset: 0 auto 0 8px; width: 1px; background: rgba(255, 255, 255, .2); }
.course-cover::after { content: ""; position: absolute; top: 17px; right: 14px; width: 24px; height: 24px; border: 1px solid rgba(211, 165, 82, .52); border-radius: 50%; }
.course-cover span { position: relative; font: 700 18px/1.35 "Songti SC", serif; }
.course-copy .eyebrow { margin-bottom: 6px; }
.course-copy h2 { margin: 0; color: var(--forest); font: 700 26px "Songti SC", serif; }
.course-copy p { max-width: 680px; margin: 9px 0 13px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.course-meta { display: flex; flex-wrap: wrap; gap: 18px; color: #72562f; font-size: 12px; }
.course-row-actions { display: grid; gap: 9px; min-width: 110px; }

/* Teacher workspace */
.teacher-app { min-height: 100svh; }
.teacher-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.teacher-overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 54px; align-items: start; }
.teacher-recent-list { border-top: 1px solid var(--line); }
.teacher-recent-list > button { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 15px 0; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); background: transparent; text-align: left; }
.teacher-recent-list > button:hover strong { color: var(--forest); }
.teacher-recent-list strong, .teacher-recent-list small { display: block; }
.teacher-recent-list strong { font-size: 14px; }
.teacher-recent-list small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.teacher-recent-list em { color: var(--muted); font-size: 12px; font-style: normal; }
.teacher-progress { display: grid; grid-template-columns: minmax(80px, 1fr) 38px; align-items: center; gap: 9px; min-width: 130px; }
.teacher-progress progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: rgba(35, 50, 48, .1); }
.teacher-progress progress::-webkit-progress-bar { border-radius: inherit; background: rgba(35, 50, 48, .1); }
.teacher-progress progress::-webkit-progress-value { border-radius: inherit; background: var(--brass); }
.teacher-progress progress::-moz-progress-bar { border-radius: inherit; background: var(--brass); }
.teacher-progress strong { color: var(--muted); font: 700 12px ui-monospace, monospace; text-align: right; }
.teacher-offering-list { border-top: 1px solid var(--line); }
.teacher-offering-list article { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 2px; border-bottom: 1px solid var(--line-soft); }
.teacher-offering-list strong, .teacher-offering-list small { display: block; }
.teacher-offering-list strong { font: 700 16px "Songti SC", serif; }
.teacher-offering-list small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.teacher-student-context { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.teacher-student-context small { color: #987036; font-size: 12px; font-weight: 800; }
.teacher-student-context h2 { margin: 6px 0 0; color: var(--forest); font: 700 28px "Songti SC", serif; }
.teacher-student-context p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.teacher-student-context > div:last-child { display: grid; justify-items: end; gap: 13px; min-width: 250px; }
.course-record-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 4px 0 19px; }
.course-record-heading span small, .course-record-heading span strong { display: block; }
.course-record-heading span small { margin-bottom: 4px; color: var(--brass); font-size: 12px; font-weight: 700; }
.course-record-heading span strong { color: var(--forest); font: 700 24px "Songti SC", serif; }
.course-record-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.course-record-heading em { padding: 7px 10px; border-radius: 999px; color: var(--forest); background: rgba(76, 139, 62, .12); font-size: 12px; font-style: normal; font-weight: 700; }
.course-record-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border-radius: 14px; background: var(--line); }
.course-record-overview > span { min-width: 0; padding: 17px 18px; background: rgba(255, 253, 247, .82); }
.course-record-overview small, .course-record-overview strong { display: block; }
.course-record-overview small { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.course-record-overview strong { overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.course-timing-panel { margin-top: 20px; padding: 20px; border: 1px solid rgba(23, 61, 58, .1); border-radius: 14px; background: rgba(245, 241, 228, .55); }
.course-timing-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.course-timing-panel h3, .course-timing-panel p { margin: 0; }
.course-timing-panel h3 { color: var(--forest); font: 700 17px "Songti SC", serif; }
.course-timing-panel header p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.course-timing-panel header > span { text-align: right; }
.course-timing-panel header small, .course-timing-panel header strong { display: block; }
.course-timing-panel header small { color: var(--muted); font-size: 12px; }
.course-timing-panel header strong { margin-top: 3px; color: var(--forest); font-size: 17px; }
.course-timing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.course-timing-grid article { min-width: 0; padding: 14px; border-radius: 11px; background: rgba(255, 253, 247, .82); }
.course-timing-grid article > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
.course-timing-grid article i { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; }
.course-timing-grid article.in_progress i { color: #9a6830; }
.course-timing-grid article.completed i { color: var(--green); }
.course-timing-grid article > strong { display: block; margin-top: 10px; color: var(--forest); font-size: 18px; }
.course-timing-grid article > small { display: block; min-height: 36px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.course-record-sections { margin-top: 22px; border-bottom: 1px solid var(--line); }
.course-record-item { border-top: 1px solid var(--line); }
.course-record-item > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 22px; align-items: center; gap: 15px; padding: 17px 2px; cursor: pointer; list-style: none; }
.course-record-item > summary::-webkit-details-marker { display: none; }
.course-record-item > summary strong { font: 700 16px "Songti SC", serif; }
.course-record-item > summary span { color: var(--muted); font-size: 12px; }
.course-record-item > summary i { color: var(--muted); font-size: 17px; font-style: normal; transition: transform .2s ease; }
.course-record-item[open] > summary i { transform: rotate(180deg); }
.course-record-item[open] > summary strong { color: var(--forest); }
.course-record-item > div { padding: 0 2px 22px; animation: workspace-in .22s ease-out both; }
.course-quiz-record { margin: 0; padding: 0; list-style: none; }
.course-quiz-record li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 13px; padding: 14px 0; border-top: 1px dashed rgba(35, 50, 48, .1); }
.course-quiz-record li:first-child { border-top: 0; }
.course-quiz-record li > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.course-quiz-record li strong { display: block; font-size: 14px; line-height: 1.55; }
.course-quiz-record li p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.course-quiz-record li em { margin-left: 10px; color: #9a6830; font-style: normal; font-weight: 700; }
.course-quiz-record li.correct em { color: var(--green); }
.course-transcript .transcript-row { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.course-transcript .transcript-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.course-transcript .transcript-row p { margin: 0; font-size: 14px; line-height: 1.75; }
.course-transcript .transcript-row.child p { color: #77572a; }
.teacher-course-summary { margin-top: 25px; padding: 23px 25px; border-left: 3px solid var(--brass); background: rgba(255, 253, 247, .66); }
.teacher-course-summary header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.teacher-course-summary header small { color: var(--brass); font-size: 12px; font-weight: 700; }
.teacher-course-summary h3 { margin: 4px 0 0; color: var(--forest); font: 700 21px "Songti SC", serif; }
.teacher-course-summary header > span { color: var(--muted); font-size: 12px; }
.teacher-course-summary > p { margin: 15px 0 0; font-size: 14px; line-height: 1.75; }
.teacher-course-summary dl { display: grid; gap: 0; margin: 18px 0 0; }
.teacher-course-summary dl > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.teacher-course-summary dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.teacher-course-summary dd { margin: 0; font-size: 13px; line-height: 1.7; }
.teacher-course-summary blockquote { margin: 0; color: #77572a; }
.teacher-course-summary blockquote + blockquote { margin-top: 6px; }
.teacher-note blockquote { margin: 0; padding-left: 18px; border-left: 3px solid var(--brass); color: var(--muted); font-size: 14px; line-height: 1.8; }

/* Dialogs */
.admin-dialog { width: min(700px, calc(100vw - 32px)); max-height: calc(100svh - 38px); padding: 0; overflow: auto; border: 0; border-radius: 24px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); }
.admin-dialog[open] { animation: dialog-in .22s ease-out both; }
.admin-dialog::backdrop { background: rgba(10, 30, 28, .52); backdrop-filter: blur(4px); }
.admin-dialog > form { padding: 28px; }
.admin-dialog header, .admin-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-dialog h2 { margin: 0; font: 700 27px "Songti SC", "STSong", serif; }
.admin-dialog textarea { min-height: 94px; resize: vertical; }
.admin-dialog footer { justify-content: flex-end; margin-top: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-full { grid-column: 1 / -1; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.form-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; color: #8c322a; background: rgba(181, 72, 57, .1); font-size: 12px; line-height: 1.5; }
.password-dialog { width: min(540px, calc(100vw - 32px)); }
.password-dialog > form > p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.student-import-dialog { width: min(820px, calc(100vw - 32px)); }
.student-import-content { padding: 28px; }
.student-import-intro { margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.student-import-steps { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 12px; margin-top: 23px; padding: 15px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }
.student-import-steps span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.student-import-steps b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #805415; background: rgba(211, 165, 82, .25); font-size: 11px; }
.student-import-steps i { height: 1px; background: var(--line); }
.student-import-controls { display: grid; grid-template-columns: auto minmax(220px, 1fr) minmax(180px, .7fr); align-items: end; gap: 12px; margin-top: 22px; }
.student-import-controls > label { min-width: 0; margin: 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.student-import-controls input, .student-import-controls select { display: block; width: 100%; min-height: 40px; margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #faf7ef; font-size: 12px; }
.student-import-file { position: relative; overflow: hidden; }
.student-import-preview { min-height: 210px; margin-top: 20px; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.student-import-preview > p { margin: 0; padding: 70px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.student-import-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 2px; color: var(--muted); font-size: 12px; }
.student-import-summary strong { color: var(--forest); font-size: 15px; }
.student-import-dialog footer { justify-content: flex-end; margin-top: 22px; }
.student-dialog, .class-course-dialog { width: min(900px, calc(100vw - 32px)); }
.manager-dialog-content { padding: 28px; }
.manager-dialog-content > header { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.manager-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; margin: 24px 0 18px; }
.manager-toolbar .manager-filter { min-width: 0; margin: 0; font-size: 12px; }
.manager-input { position: relative; display: block; }
.manager-input svg { position: absolute; z-index: 1; top: 23px; left: 15px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.manager-input input { padding-left: 43px; }
.manager-toolbar select { width: 100%; }
.manager-body { min-height: 330px; }
.manager-table .manager-check { width: 16px; height: 16px; accent-color: var(--forest); }
.manager-loading { min-height: 330px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 8px; }
.manager-footer { padding-top: 20px; border-top: 1px solid var(--line); }
.manager-footer > span { color: var(--muted); font-size: 12px; }
.manager-footer > div { display: flex; gap: 9px; }
.class-course-list { min-height: 104px; padding: 12px 0 24px; }
.class-course-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line-soft); }
.class-course-item > div:first-child strong, .class-course-item > div:first-child small, .class-course-item > div:first-child span { display: block; }
.class-course-item strong { font: 700 16px "Songti SC", serif; }
.class-course-item small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.class-course-item > div:first-child span { margin-top: 5px; color: #72562f; font-size: 12px; }
.class-course-item > div:last-child { display: flex; align-items: center; gap: 8px; }
.class-course-form { padding-top: 24px; border-top: 1px solid var(--line); }
.class-course-form .section-heading { margin-bottom: 5px; }
.class-course-form footer { margin-top: 20px; }

.course-editor-dialog { width: min(1180px, calc(100vw - 32px)); }
.course-editor-dialog > form { padding: 28px; }
.course-editor-intro { margin: 15px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.course-editor-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; align-items: start; }
.course-gate-nav { position: sticky; top: 0; display: grid; gap: 8px; max-height: 68svh; overflow-y: auto; }
.course-gate-nav button { display: grid; gap: 4px; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #faf7ef; text-align: left; }
.course-gate-nav button.active { border-color: var(--forest); background: rgba(23,61,58,.08); box-shadow: inset 3px 0 0 var(--forest); }
.course-gate-nav span { color: #72562f; font-size: 12px; font-weight: 800; }
.course-gate-nav b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.course-gate-nav small { color: #9a6830; font-size: 11px; }
.course-gate-nav small.complete { color: var(--green); }
.course-editor-fields { display: grid; gap: 18px; min-width: 0; max-height: 68svh; padding-right: 6px; overflow-y: auto; }
.course-editor-section { padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf8; }
.course-editor-section .section-heading { margin-bottom: 8px; }
.course-editor-section .section-heading h2 { font: 700 21px "Songti SC", serif; }
.course-question-card { margin: 15px 0 0 !important; padding: 0 16px 16px; border: 1px solid var(--line) !important; border-radius: 14px; background: #faf7ef; }
.course-question-card legend { padding: 0 8px; color: #72562f; font-size: 12px; font-weight: 900; }
.follow-up-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.course-editor-check { display: flex !important; align-items: center; gap: 9px; align-self: end; min-height: 48px; }
.course-editor-check input { display: inline-block !important; width: 17px !important; min-height: 17px !important; margin: 0 !important; accent-color: var(--forest); }

@media (max-width: 820px) {
  .course-editor-layout { grid-template-columns: 1fr; }
  .course-gate-nav { position: static; grid-template-columns: repeat(6, minmax(130px, 1fr)); overflow-x: auto; }
  .course-editor-fields { max-height: none; overflow: visible; }
  .follow-up-grid { grid-template-columns: 1fr; }
}

.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 40px)); padding: 13px 18px; border-radius: 14px; color: #fff; background: rgba(16, 46, 44, .96); box-shadow: var(--shadow); font-size: 13px; animation: toast-in .22s ease-out both; }
.loading-state { display: grid; place-items: center; align-content: center; min-height: 60svh; color: var(--muted); font-size: 12px; }
.loading-state i { width: 30px; height: 30px; margin-bottom: 13px; border: 2px solid rgba(23, 61, 58, .12); border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes login-copy-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes login-form-in { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes workspace-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .login-stage { grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; }
  .login-copy h1 { font-size: 54px; }
  .admin-topbar { grid-template-columns: 244px minmax(0, 1fr) auto; }
  .admin-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-item:nth-child(3) { border-right: 0; }
  .metric-item:nth-child(n+4) { margin-top: 20px; }
  .overview-intro { grid-template-columns: 1fr; }
  .teacher-overview-grid { grid-template-columns: 1fr; }
  .course-timing-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .login-brand { height: 68px; }
  .login-brand small { display: none; }
  .login-stage { display: block; width: min(100% - 30px, 520px); padding: 42px 0 70px; }
  .login-copy { margin-bottom: 34px; }
  .login-copy h1 { font-size: clamp(38px, 12vw, 55px); }
  .login-copy > p, .login-feature { display: none; }
  .login-form { padding: 28px 24px; }
  .login-screen > footer { display: none; }
  .admin-topbar { grid-template-columns: minmax(0, 1fr) auto; padding: 0 16px; }
  .admin-topbar .brand-lockup small, .topbar-context, .account-block > span:not(.account-avatar) { display: none; }
  .account-block .text-button { margin-left: 0; }
  .admin-shell { display: block; }
  .admin-sidebar { position: sticky; z-index: 15; top: 72px; display: block; width: 100%; height: auto; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar nav { display: flex; min-width: max-content; }
  .nav-group { display: flex; align-items: center; }
  .nav-parent { grid-template-columns: 19px auto 14px; width: auto; }
  .nav-submenu, .nav-group.expanded .nav-submenu { display: flex; margin: 0; padding: 0 0 0 4px; border-left: 0; }
  .nav-subitem { min-height: 40px; padding: 0 11px; }
  .nav-subitem.active { box-shadow: inset 0 -2px 0 var(--brass); }
  .nav-item { grid-template-columns: 19px auto; width: auto; min-height: 40px; padding: 0 12px; }
  .nav-item svg { width: 17px; height: 17px; }
  .sidebar-note { display: none; }
  .admin-workspace { padding: 28px 18px 60px; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; }
  .workspace-heading h1 { font-size: 34px; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-item, .metric-item + .metric-item { padding: 15px 12px 15px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .toolbar { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; max-width: none; }
  .data-table { min-width: 720px; }
  .course-row { grid-template-columns: 84px minmax(0, 1fr); gap: 17px; }
  .course-cover { width: 82px; height: 112px; padding: 12px; }
  .course-cover span { font-size: 14px; }
  .course-row-actions { grid-column: 1 / -1; display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .account-workspace { grid-template-columns: 1fr; gap: 32px; align-content: start; padding: 45px 0; }
  .account-action { padding: 27px 24px; }
  .manager-toolbar { grid-template-columns: 1fr; }
  .student-import-steps { grid-template-columns: 1fr; gap: 8px; }
  .student-import-steps i { display: none; }
  .student-import-controls { grid-template-columns: 1fr; }
  .manager-footer, .pagination { align-items: flex-start; flex-direction: column; }
  .class-course-item { align-items: flex-start; flex-direction: column; }
  .teacher-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .teacher-metrics { grid-template-columns: 1fr 1fr; }
  .teacher-student-context { align-items: flex-start; flex-direction: column; }
  .teacher-student-context > div:last-child { justify-items: start; width: 100%; min-width: 0; }
  .course-record-heading { grid-template-columns: 1fr auto; }
  .course-record-heading p { grid-column: 1 / -1; }
  .course-record-overview { grid-template-columns: 1fr 1fr; }
  .course-timing-panel > header { align-items: flex-start; }
  .course-timing-grid { grid-template-columns: 1fr; }
  .teacher-course-summary dl > div { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.course-audio-status { color: #3f7654; }
.course-audio-status.pending { color: #9a6b2f; }
