/* Nagasari Academy: original learner workspace design system.
   Reading this as a learner dashboard for curious course-takers, with calm
   contemporary product UI and a compact, warm-lilac workspace language. */
:root {
  color-scheme: light;
  --canvas: #f6f7fb;
  --surface: #fff;
  --surface-2: #fbfbfe;
  --sidebar: #f0edf9;
  --sidebar-strong: #e9e4f6;
  --ink: #222338;
  --muted: #77798e;
  --subtle: #9b9caf;
  --line: #e9e9f1;
  --line-strong: #dcdce9;
  --accent: #6558d3;
  --accent-hover: #5548c4;
  --accent-soft: #eeecff;
  --mint: #dff3eb;
  --peach: #fae9dc;
  --lilac: #e8e4fb;
  --warning: #a76827;
  --warning-bg: #fff3df;
  --success: #287d61;
  --success-bg: #e7f5ee;
  --danger: #b54255;
  --danger-bg: #fff0f2;
  --purple: #7659a7;
  --shadow-soft: 0 8px 24px rgb(49 43 93 / 5%);
  --shadow-dialog: 0 24px 72px rgb(35 31 68 / 22%);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 18px;
  --sidebar-width: 228px;
  --topbar-height: 76px;
  --content-width: 1280px;
  --ease: cubic-bezier(.2,.75,.25,1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid rgb(101 88 211 / 42%); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 24px 15px 16px; overflow-y: auto; background: var(--sidebar); border-right: 1px solid rgb(75 63 126 / 6%); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 0 9px; margin-bottom: 28px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: var(--accent); box-shadow: 0 5px 12px rgb(101 88 211 / 22%); }
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { display: block; font-size: 14px; font-weight: 750; letter-spacing: -.035em; line-height: 1.2; }
.brand-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .025em; }
.nav-group-label { padding: 0 12px; margin: 20px 0 8px; color: #858397; font-size: 10px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.nav-item { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 0 12px; margin: 2px 0; border: 1px solid transparent; border-radius: 10px; color: #66677c; font-size: 12px; font-weight: 560; transition: color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease); }
.nav-item svg { width: 17px; height: 17px; color: #85859a; }
.nav-item:hover { color: var(--ink); background: rgb(255 255 255 / 58%); }
.nav-item:active { transform: scale(.985); }
.nav-item.active { color: var(--accent); background: #fff; box-shadow: 0 2px 8px rgb(49 43 93 / 5%); font-weight: 700; }
.nav-item.active svg { color: var(--accent); }
.sidebar-bottom { margin-top: auto; padding-top: 22px; }
.workspace-card { padding: 14px; border: 1px solid rgb(101 88 211 / 10%); border-radius: 13px; background: rgb(255 255 255 / 56%); }
.workspace-card strong { display: block; font-size: 11px; }
.workspace-card p { margin: 5px 0 10px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.user-mini { display: flex; align-items: center; gap: 9px; padding: 15px 7px 1px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 50%; color: #5d4e9d; background: #ddd5f7; font-size: 11px; font-weight: 750; }
.user-mini strong { display: block; font-size: 11px; }
.user-mini small { display: block; color: var(--muted); font-size: 10px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: var(--topbar-height); align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 92%); backdrop-filter: blur(14px); }
.breadcrumbs { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.breadcrumbs strong { color: var(--ink); font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 10px; color: #6e6f83; background: transparent; transition: background .16s, color .16s, border-color .16s; }
.icon-btn:hover { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 17px; height: 17px; }
.search-trigger { display: flex; min-width: 190px; height: 38px; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface-2); text-align: left; font-size: 11px; }
.search-trigger kbd { margin-left: auto; padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font: inherit; }
.demo-chip { display: inline-flex; min-height: 25px; align-items: center; padding: 0 9px; border: 1px solid #e7dcbd; border-radius: 999px; color: #805d28; background: #fff9e9; font-size: 10px; font-weight: 700; }
.role-switch { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: 11px; font-weight: 650; }
.mobile-menu-btn { display: none; }
#main { width: min(100%, var(--content-width)); min-height: calc(100vh - var(--topbar-height)); padding: 30px 34px 50px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 23px; }
.page-heading h1 { margin: 0; font-size: clamp(24px, 2.2vw, 30px); font-weight: 730; letter-spacing: -.045em; line-height: 1.18; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgb(101 88 211 / 16%); }
.btn.primary:hover { background: var(--accent-hover); box-shadow: 0 6px 14px rgb(101 88 211 / 23%); }
.btn.secondary { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.btn.secondary:hover { border-color: #c9c5e7; background: #fbfaff; }
.btn.ghost { color: var(--muted); background: transparent; }
.btn.ghost:hover { color: var(--accent); background: var(--accent-soft); }
.btn.danger { border-color: #f1ced4; color: var(--danger); background: var(--danger-bg); }
.btn.small { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 10px; }
.pill { display: inline-flex; min-height: 24px; align-items: center; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; color: #686a80; background: #f7f7fb; font-size: 10px; font-weight: 650; line-height: 1.25; }
.pill.green { border-color: #d1eadc; color: #32765a; background: var(--success-bg); }
.pill.amber { border-color: #f0dfbd; color: #916324; background: var(--warning-bg); }
.pill.purple { border-color: #ddd8f8; color: #6556ae; background: var(--accent-soft); }

.dashboard-top { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, .9fr); gap: 18px; margin-bottom: 30px; }
.hero-study { position: relative; display: flex; min-height: 252px; align-items: center; justify-content: space-between; gap: 18px; overflow: hidden; padding: 29px 31px; border-radius: var(--radius-lg); color: #fff; background: #292747; }
.hero-study::before { position: absolute; top: -125px; right: 9%; width: 300px; height: 300px; border: 1px solid rgb(255 255 255 / 10%); border-radius: 50%; content: ""; box-shadow: 0 0 0 32px rgb(255 255 255 / 3%), 0 0 0 66px rgb(255 255 255 / 2%); }
.hero-copy { position: relative; z-index: 1; max-width: 430px; }
.hero-copy .hero-tag { display: inline-flex; padding: 5px 9px; border: 1px solid rgb(255 255 255 / 19%); border-radius: 999px; color: #dfdcff; background: rgb(255 255 255 / 7%); font-size: 9px; font-weight: 700; }
.hero-copy h2 { max-width: 390px; margin: 14px 0 8px; font-size: clamp(22px, 2.3vw, 30px); font-weight: 720; letter-spacing: -.045em; line-height: 1.12; }
.hero-copy p { max-width: 360px; margin: 0 0 17px; color: #c5c3d6; font-size: 11px; line-height: 1.6; }
.hero-study .btn.primary { color: #332b70; background: #e8e3ff; box-shadow: none; }
.hero-study .btn.primary:hover { background: #fff; }
.hero-visual { position: relative; z-index: 1; display: grid; width: 132px; height: 154px; flex: 0 0 auto; place-items: center; border: 1px solid rgb(255 255 255 / 18%); border-radius: 16px; background: linear-gradient(145deg, #7669dc, #5548ac 70%); box-shadow: 0 18px 34px rgb(14 12 43 / 24%); transform: rotate(4deg); }
.hero-visual::before, .hero-visual::after { position: absolute; border: 1px solid rgb(255 255 255 / 22%); border-radius: 50%; content: ""; }
.hero-visual::before { width: 84px; height: 84px; }
.hero-visual::after { width: 57px; height: 57px; background: rgb(238 233 255 / 17%); }
.hero-visual span { position: absolute; right: 12px; bottom: 12px; left: 12px; color: #f2f0ff; font-size: 9px; font-weight: 750; letter-spacing: .04em; }
.hero-stats { display: flex; gap: 17px; margin-top: 18px; color: #d1cfe0; font-size: 10px; }
.hero-stats strong { color: #fff; font-size: 12px; }
.goal-panel { display: flex; flex-direction: column; justify-content: space-between; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.panel-head { display: flex; min-height: 26px; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 13px; font-weight: 720; letter-spacing: -.02em; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.goal-ring { position: relative; display: grid; width: 116px; height: 116px; place-items: center; align-self: center; margin: 8px 0; border-radius: 50%; background: conic-gradient(var(--accent) 0 68%, #eeedf5 68% 100%); }
.goal-ring::before { position: absolute; inset: 9px; border-radius: inherit; background: var(--surface); content: ""; }
.goal-ring strong { position: relative; font-size: 24px; letter-spacing: -.05em; }
.goal-ring span { position: absolute; z-index: 1; margin-top: 33px; color: var(--muted); font-size: 9px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 4px 0 10px; }
.day { display: grid; height: 30px; place-items: center; border-radius: 8px; color: #a1a1b1; background: #f6f6fa; font-size: 9px; }
.day.done { color: #fff; background: var(--accent); font-weight: 700; }
.goal-caption { color: var(--muted); font-size: 10px; text-align: center; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 26px 0 13px; }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 730; letter-spacing: -.035em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-title a { color: var(--accent); font-size: 11px; font-weight: 700; }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.course-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgb(49 43 93 / 3%); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.course-card:hover { transform: translateY(-3px); border-color: #dbd7f1; box-shadow: 0 12px 24px rgb(49 43 93 / 8%); }
.course-cover { position: relative; display: flex; min-height: 132px; align-items: flex-end; overflow: hidden; padding: 17px; isolation: isolate; }
.cover-meta { position: absolute; top: 12px; left: 14px; z-index: 2; color: rgb(34 35 56 / 67%); font-size: 9px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.cover-creative { background: var(--mint); }
.cover-measure { background: var(--peach); }
.cover-retarget { background: var(--lilac); }
.cover-code { position: absolute; top: 27px; right: 13px; color: rgb(34 35 56 / 12%); font-size: 62px; font-weight: 800; letter-spacing: -.1em; line-height: 1; }
.cover-lines { position: absolute; top: 35px; right: 20px; width: 70px; height: 70px; border: 1px solid rgb(34 35 56 / 18%); border-radius: 50%; box-shadow: 0 0 0 11px rgb(255 255 255 / 20%), 0 0 0 22px rgb(34 35 56 / 5%); }
.cover-badge { position: absolute; top: 13px; right: 13px; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid rgb(34 35 56 / 12%); border-radius: 9px; color: var(--ink); background: rgb(255 255 255 / 43%); font-size: 10px; font-weight: 800; }
.cover-title { position: relative; z-index: 1; max-width: 80%; margin: 0; color: #29283e; font-size: 19px; font-weight: 760; letter-spacing: -.045em; line-height: 1.08; }
.course-body { padding: 14px 15px 15px; }
.course-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.course-title { margin: 8px 0 12px; font-size: 13px; font-weight: 720; letter-spacing: -.02em; line-height: 1.35; }
.course-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #eeedf4; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s var(--ease); }
.course-body .progress-track { margin: 0 0 9px; }

.dashboard-bottom { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .85fr); gap: 16px; margin-top: 25px; }
.panel { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgb(49 43 93 / 3%); }
.next-list { margin-top: 12px; }
.next-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.lesson-num { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 750; }
.next-copy { min-width: 0; flex: 1; }
.next-copy strong { display: block; overflow: hidden; font-size: 11px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.next-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.community-mini { display: flex; align-items: center; gap: 12px; padding: 14px 0 2px; }
.avatar-stack { display: flex; padding-left: 5px; }
.avatar-stack .avatar { width: 29px; height: 29px; margin-left: -5px; border: 2px solid var(--surface); font-size: 9px; }
.community-mini p { flex: 1; margin: 0; color: var(--muted); font-size: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.quick-link { display: flex; min-height: 66px; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); transition: border-color .16s, background .16s, transform .16s; }
.quick-link:hover { transform: translateY(-1px); border-color: #d7d2f0; background: #fcfbff; }
.quick-link svg { color: var(--accent); }
.quick-link strong { display: block; font-size: 10px; }
.quick-link small { display: block; color: var(--muted); font-size: 9px; }
.demo-footer { padding: 25px 0 0; color: var(--subtle); font-size: 10px; text-align: center; }

/* Shared composition primitives for dense learning and creator surfaces. */
.grid-2, .grid-3, .grid-4 { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat-value { display: block; font-size: 23px; font-weight: 740; letter-spacing: -.05em; }
.stat-label { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.tabs { display: flex; align-items: center; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { min-height: 40px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 11px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 700; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 14px 0; }
.input, .select { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; color: var(--ink); background: var(--surface); font-size: 11px; }
.input::placeholder, textarea.input::placeholder { color: #818296; opacity: 1; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(101 88 211 / 12%); }
textarea.input { min-height: 100px; padding: 10px 11px; resize: vertical; }
.empty { display: grid; min-height: 160px; place-items: center; padding: 25px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface-2); text-align: center; }
.notice { padding: 12px 14px; border: 1px solid #d9d5f4; border-radius: 10px; color: #51468e; background: #f3f1ff; font-size: 11px; }
.notice.warning { border-color: #f0dfbd; color: #805b25; background: var(--warning-bg); }
.row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.divider { height: 1px; margin: 14px 0; background: var(--line); }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 7px; color: #65667a; background: #f0f0f6; font-size: 9px; font-weight: 700; }
.badge.green { color: #32765a; background: var(--success-bg); }
.badge.amber { color: #916324; background: var(--warning-bg); }
.badge.purple { color: #6556ae; background: var(--accent-soft); }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--surface-2); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.mobile-label { display: none; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 5px; }
.calendar-cell { min-height: 76px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 10px; }
.event-chip { display: block; overflow: hidden; padding: 3px 5px; margin-top: 5px; border-radius: 5px; color: #554994; background: var(--accent-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.course-detail-top { margin-bottom: 20px; }
.course-banner { position: relative; display: flex; min-height: 170px; align-items: flex-end; overflow: hidden; padding: 24px; border-radius: var(--radius-lg); background: var(--mint); }
.course-banner h2 { position: relative; z-index: 1; max-width: 540px; margin: 0; font-size: clamp(22px,3vw,34px); letter-spacing: -.05em; line-height: 1.1; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(260px,.75fr); gap: 17px; }
.module-list { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.module-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 17px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 12px; font-weight: 720; }
.lesson-row { display: flex; min-height: 58px; align-items: center; gap: 11px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-check { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: transparent; }
.lesson-check.completed { border-color: var(--success); color: #fff; background: var(--success); animation: check-pop .28s var(--ease); }
.lesson-row > div:nth-child(2) { min-width: 0; flex: 1; }
.lesson-row strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.lesson-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.lesson-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; align-items: start; gap: 18px; }
.player { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.player-surface { position: relative; display: grid; min-height: 345px; place-items: center; overflow: hidden; color: #fff; background: #282645; }
.player-surface::before { position: absolute; width: 210px; height: 210px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 50%; content: ""; box-shadow: 0 0 0 28px rgb(255 255 255 / 3%), 0 0 0 58px rgb(255 255 255 / 2%); }
.player-center { position: relative; display: grid; width: 56px; height: 56px; place-items: center; border: 1px solid rgb(255 255 255 / 36%); border-radius: 50%; color: #fff; background: rgb(255 255 255 / 14%); }
.player-center svg { width: 23px; height: 23px; }
.player-controls { position: absolute; inset: auto 0 0; display: flex; height: 46px; align-items: center; gap: 12px; padding: 0 14px; background: linear-gradient(transparent, rgb(18 17 34 / 80%)); }
.player-time { color: #efeff7; font-size: 9px; white-space: nowrap; }
.player-progress { height: 4px; flex: 1; border-radius: 99px; background: rgb(255 255 255 / 32%); }
.player-progress .progress-fill { background: #d9d3ff; }
.lesson-tabs { margin-top: 17px; }
.lesson-content { padding: 18px 0; color: #55566d; font-size: 12px; line-height: 1.75; }
.resource-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.resource-row:last-child { border-bottom: 0; }
.resource-row svg { color: var(--accent); }
.note-editor { display: flex; flex-direction: column; gap: 9px; }
.notes-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.note-card { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.note-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.quiz-option { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.quiz-option:hover { border-color: #cec8ed; background: #fcfbff; }
.quiz-option input { accent-color: var(--accent); }
.quiz-result { padding: 14px; border-radius: 10px; color: #32765a; background: var(--success-bg); font-size: 11px; }
.transcript { max-height: 260px; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface-2); font-size: 10px; line-height: 1.8; }
.discussion-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.post-author { display: flex; align-items: center; gap: 9px; }
.post-author strong { font-size: 10px; }
.post-author small { display: block; color: var(--muted); font-size: 9px; }
.post-body { margin: 10px 0; color: #55566d; font-size: 11px; line-height: 1.65; }
.certificate { padding: 15px; border: 1px solid #d8d0ae; border-radius: 12px; background: #fffdf5; }
.certificate-inner { padding: 25px; border: 1px solid #e5dfc7; text-align: center; }
.cert-seal { display: grid; width: 44px; height: 44px; place-items: center; margin: 0 auto 10px; border: 1px solid #c3ad6a; border-radius: 50%; color: #846d31; }
.admin-chart { min-height: 220px; }
.bar-chart { display: flex; height: 190px; align-items: end; gap: 10px; padding: 18px 5px 0; border-bottom: 1px solid var(--line); }
.chart-bar { min-width: 8px; flex: 1; border-radius: 6px 6px 0 0; background: #bbb4ed; transition: height .25s var(--ease); }
.chart-bar:nth-child(3n) { background: var(--accent); }
.admin-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.builder-row { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.builder-drag { color: #999aab; cursor: grab; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.invoice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.settings-form { max-width: 760px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 10px; font-weight: 700; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: 0 0 auto; align-items: center; padding: 3px; border: 0; border-radius: 99px; background: #d6d6e0; transition: background .16s; }
.switch::after { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 14%); content: ""; transition: transform .16s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

 dialog.modal { width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 760px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-dialog); }
dialog.modal::backdrop { background: rgb(30 29 48 / 48%); backdrop-filter: blur(3px); }
.modal-head, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 19px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-body { padding: 19px; }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-close { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 9px; color: var(--muted); background: transparent; }
.modal-close:hover { background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.toast-container { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: flex; width: min(360px, calc(100vw - 32px)); flex-direction: column; gap: 9px; pointer-events: none; }
.toast-container > .toast { padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-soft); font-size: 11px; pointer-events: auto; animation: toast-in .2s var(--ease); }
.search-results { position: absolute; z-index: 45; top: calc(100% + 7px); right: 0; left: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-soft); }
.search-result { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 11px; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: var(--surface-2); }
.notification-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.notification-item { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border-bottom: 1px solid var(--line); }
.notification-item:last-child { border-bottom: 0; }
.notification-item p { margin: 0; font-size: 11px; }
.notification-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.mobile-nav { display: none; }
.login-preview { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--canvas); }
.login-card { width: min(420px,100%); padding: 30px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.login-card .brand { padding: 0; margin: 0 0 25px; }

@keyframes check-pop { 0% { transform: scale(.75); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Tablet: preserve the rail while giving content and tables room to breathe. */
@media (max-width: 1100px) {
  :root { --sidebar-width: 208px; }
  .topbar { padding-right: 23px; padding-left: 23px; }
  #main { padding-right: 23px; padding-left: 23px; }
  .dashboard-top { grid-template-columns: minmax(0,1.4fr) minmax(245px,.8fr); }
  .hero-study { padding: 24px; }
  .hero-visual { width: 108px; height: 132px; }
  .course-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .course-grid .course-card:last-child:nth-child(odd) { grid-column: span 2; }
  .lesson-layout { grid-template-columns: minmax(0,1fr) 280px; }
}
@media (max-width: 767px) {
  :root { --topbar-height: 64px; }
  .sidebar { width: min(290px, 86vw); padding-top: 17px; box-shadow: 14px 0 35px rgb(35 31 68 / 14%); transform: translateX(-105%); transition: transform .22s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: none; background: rgb(30 29 48 / 36%); }
  .sidebar.open ~ .sidebar-backdrop { display: block; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .mobile-menu-btn { display: inline-grid; }
  .breadcrumbs { display: none; }
  .top-actions { gap: 6px; }
  .search-trigger { width: 38px; min-width: 38px; justify-content: center; padding: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .demo-chip { min-height: 23px; padding: 0 7px; font-size: 9px; }
  .role-switch { min-height: 34px; padding: 0 8px; font-size: 10px; }
  #main { min-height: calc(100vh - var(--topbar-height) - 64px); padding: 23px 20px 90px; }
  .page-heading { align-items: flex-start; margin-bottom: 18px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading p { font-size: 11px; }
  .heading-actions { justify-content: flex-end; }
  .dashboard-top { grid-template-columns: minmax(0,1fr); gap: 12px; margin-bottom: 23px; }
  .hero-study { min-height: 230px; padding: 22px; }
  .hero-copy { max-width: 75%; }
  .hero-copy h2 { font-size: 25px; }
  .hero-visual { width: 82px; height: 108px; margin-right: 2px; }
  .hero-visual::before { width: 62px; height: 62px; }
  .hero-visual::after { width: 42px; height: 42px; }
  .hero-visual span { right: 7px; bottom: 8px; left: 7px; font-size: 8px; }
  .goal-panel { min-height: 230px; }
  .goal-ring { width: 100px; height: 100px; }
  .course-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
  .course-grid .course-card:last-child:nth-child(odd) { grid-column: auto; }
  .course-cover { min-height: 116px; padding: 13px; }
  .cover-title { font-size: 16px; }
  .course-body { padding: 12px; }
  .course-title { font-size: 12px; }
  .dashboard-bottom, .detail-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .lesson-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .player-surface { min-height: clamp(210px, 56vw, 340px); }
  .stats-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mobile-nav { position: fixed; z-index: 22; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); min-height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(12px); }
  .mobile-nav a { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 9px; color: var(--muted); font-size: 9px; }
  .mobile-nav a.active { color: var(--accent); font-weight: 750; }
  .mobile-nav svg { width: 18px; height: 18px; }
  .calendar-cell { min-height: 56px; padding: 4px; }
  .event-chip { font-size: 8px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { position: relative; padding: 7px 12px; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; border: 0; text-align: right; }
  .mobile-label { display: inline; color: var(--muted); font-size: 9px; font-weight: 700; text-align: left; }
  .form-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 430px) {
  #main { padding-right: 16px; padding-left: 16px; }
  .topbar { padding-right: 11px; padding-left: 11px; }
  .top-actions { gap: 3px; }
  .top-actions > .icon-btn { width: 34px; height: 34px; }
  .role-switch { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .heading-actions { justify-content: flex-start; }
  .hero-study { min-height: 222px; padding: 19px; }
  .hero-copy { max-width: calc(100% - 76px); }
  .hero-copy h2 { font-size: 22px; }
  .hero-copy p { font-size: 10px; }
  .hero-stats { gap: 10px; font-size: 9px; }
  .hero-visual { width: 68px; height: 92px; }
  .course-grid { gap: 9px; }
  .course-cover { min-height: 101px; padding: 11px; }
  .cover-meta { top: 9px; left: 10px; font-size: 8px; }
  .cover-title { max-width: 93%; font-size: 14px; }
  .cover-code { top: 31px; right: 8px; font-size: 48px; }
  .cover-badge { top: 8px; right: 8px; width: 24px; height: 24px; }
  .course-body { padding: 10px; }
  .course-meta { align-items: flex-start; font-size: 9px; }
  .course-title { min-height: 32px; margin: 7px 0 9px; font-size: 11px; }
  .course-footer { font-size: 9px; }
  .quick-grid { gap: 7px; }
  .quick-link { min-height: 60px; gap: 7px; padding: 8px; }
  .quick-link svg { width: 16px; height: 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0,1fr); }
  .stats-row { gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .calendar-grid { gap: 3px; }
  .calendar-cell { min-height: 45px; font-size: 9px; }
  .panel { padding: 15px; }
}
@media all {
  body.dark { color-scheme: dark; }
  body.dark.dark, body.dark {
    --canvas: #191923;
    --surface: #23232f;
    --surface-2: #292936;
    --sidebar: #22212e;
    --sidebar-strong: #302d42;
    --ink: #eeeef6;
    --muted: #aaaabd;
    --subtle: #86869b;
    --line: #373744;
    --line-strong: #4a4959;
    --accent: #a49af8;
    --accent-hover: #b4adff;
    --accent-soft: #37324f;
    --mint: #293b38;
    --peach: #47352e;
    --lilac: #37334a;
    --warning: #f0bc76;
    --warning-bg: #403525;
    --success: #7ac7a5;
    --success-bg: #263b34;
    --danger: #f092a0;
    --danger-bg: #442c34;
    --purple: #c0a9ec;
    --shadow-soft: 0 8px 24px rgb(0 0 0 / 18%);
    --shadow-dialog: 0 24px 72px rgb(0 0 0 / 48%);
  }
  body.dark .hero-study { background: #25243c; }
  body.dark .hero-copy .hero-tag { color: #e2dfff; }
  body.dark .hero-study .btn.primary { color: #302a58; background: #d4ceff; }
  body.dark .course-cover { filter: saturate(.78) brightness(.78); }
  body.dark .cover-title { color: #f3f0ff; }
  body.dark .cover-meta { color: #e6e2f5; }
  body.dark .cover-badge { color: #f3f0ff; background: rgb(30 28 42 / 52%); }
  body.dark .demo-chip { border-color: #695732; color: #efd28d; background: #3b3425; }
  body.dark .nav-item.active { background: #302d41; }
  body.dark .workspace-card { background: rgb(255 255 255 / 3%); }
  body.dark .search-trigger { background: var(--surface-2); }
  body.dark .btn.secondary { background: var(--surface); }
  body.dark .data-table th { background: var(--surface-2); }
  body.dark .certificate { border-color: #685e3c; background: #302d23; }
  body.dark .certificate-inner { border-color: #62583b; }
  body.dark .mobile-nav { background: rgb(35 35 47 / 96%); }
  body.dark .login-preview { background: var(--canvas); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  body.dark .sidebar-backdrop { background: rgb(0 0 0 / 55%); }
}
