/* ============================================================
   TGC ACADEMY - LMS styles (extends styles.css tokens)
   ============================================================ */
:root { --side-w: 260px; --top-h: 70px; }

/* ── Icon safety net: inline icons in headings/labels never render unconstrained ── */
h1 > svg, h2 > svg, h3 > svg, h4 > svg, label > svg, .page-title > svg,
.edit-card > h3 svg, .modal-panel > h3 svg, .shead svg, .section-head svg {
  width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.15em;
}

/* ── App frame ─────────────────────────────────────────── */
#app { min-height: 100vh; }
.lms-shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 50;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1.25rem 1rem; gap: 0.4rem;
  transition: transform var(--t-slow), background var(--t-slow);
}
.side-brand { display: flex; align-items: center; gap: 0.65rem; padding: 0.4rem 0.6rem 1.4rem; }
.side-brand img { width: 38px; height: 38px; }
.side-brand b { font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; line-height: 1; }
.side-brand span { display: block; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; margin-top: 3px; font-family: var(--display); }
.side-sec { font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); padding: 1rem 0.7rem 0.4rem; }
.navlink {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.7rem; border-radius: var(--r-sm);
  font-family: var(--display); font-weight: 500; font-size: 0.92rem; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast); border: none; background: none; width: 100%; text-align: left;
}
.navlink:hover { background: var(--surface); color: var(--ink); }
.navlink.active { background: var(--ink); color: var(--bg); }
.navlink svg { width: 18px; height: 18px; flex-shrink: 0; }
.navlink .badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 99px; min-width: 20px; text-align: center; }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }

.main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1.25rem, 3vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar .page-title { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-full); border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--ink-2); transition: var(--t); }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.usermenu { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; padding: 0.3rem 0.3rem 0.3rem 0.7rem; border-radius: var(--r-full); border: 1px solid var(--line); transition: var(--t); }
.usermenu:hover { border-color: var(--line-strong); }
.usermenu .nm { font-family: var(--display); font-size: 0.85rem; font-weight: 500; line-height: 1; }
.usermenu .rl { font-size: 0.7rem; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: var(--r-full); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 0.85rem; color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-leaf)); flex-shrink: 0; }
.avatar.admin { background: linear-gradient(135deg, #b03a6e, #e06b9a); }
.avatar.facilitator { background: linear-gradient(135deg, var(--orange), var(--orange-bright)); color: #3a2200; }
.avatar.marker { background: linear-gradient(135deg, #5b3aa0, #8a6bd1); }
.avatar.editor { background: linear-gradient(135deg, #1f7a8c, #46b3c4); }

.content { padding: clamp(1.5rem, 3.5vw, 2.75rem); max-width: 1180px; width: 100%; }
.burger-lms { display: none; }

/* ── Generic UI ────────────────────────────────────────── */
.page-head { margin-bottom: 2rem; }
.page-head h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -0.02em; }
.page-head p { color: var(--ink-2); margin-top: 0.5rem; max-width: 60ch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; }
.grid { display: grid; gap: 1.25rem; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem 1.5rem; }
.stat-card .n { font-family: var(--display); font-weight: 600; font-size: 2.2rem; color: var(--accent); line-height: 1; }
.stat-card .l { color: var(--ink-2); font-size: 0.9rem; margin-top: 0.4rem; }

.lms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--display); font-weight: 500; font-size: 0.92rem; padding: 0.7rem 1.3rem; border-radius: var(--r-full); transition: var(--t); white-space: nowrap; }
.lms-btn.primary { background: var(--ink); color: var(--bg); }
.lms-btn.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lms-btn.accent { background: var(--orange); color: #fff; }
.lms-btn.accent:hover { background: var(--orange-bright); transform: translateY(-2px); }
.lms-btn.teal { background: var(--teal-deep); color: #fff; }
[data-theme="dark"] .lms-btn.teal { background: var(--teal-bright); color: #042024; }
.lms-btn.ghost { border: 1.5px solid var(--line-strong); color: var(--ink); }
.lms-btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.lms-btn.sm { padding: 0.5rem 0.95rem; font-size: 0.84rem; }
.lms-btn.danger { color: #d9484a; border: 1.5px solid color-mix(in srgb, #d9484a 40%, transparent); }
.lms-btn.danger:hover { background: #d9484a; color: #fff; }
.lms-btn:disabled { opacity: 0.45; pointer-events: none; }
.lms-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.lms-btn.sm svg { width: 14px; height: 14px; }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.3rem 0.7rem; border-radius: 99px; }
.pill.green { background: hsl(152 50% 45% / 0.14); color: hsl(152 55% 38%); }
.pill.amber { background: hsl(38 85% 50% / 0.16); color: hsl(32 85% 42%); }
.pill.red { background: hsl(0 65% 55% / 0.14); color: hsl(0 60% 50%); }
.pill.gray { background: var(--bg-2); color: var(--muted); }
.pill.teal { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pill svg { width: 13px; height: 13px; flex-shrink: 0; }
[data-theme="dark"] .pill.green { color: hsl(152 55% 60%); }
[data-theme="dark"] .pill.amber { color: hsl(38 90% 62%); }
[data-theme="dark"] .pill.red { color: hsl(0 70% 68%); }

/* forms */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-family: var(--display); font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--ink); }
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }
.input, .textarea, .select {
  width: 100%; padding: 0.75rem 0.95rem; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-family: var(--body); font-size: 0.95rem; transition: border-color var(--t-fast);
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.empty { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty svg { width: 46px; height: 46px; margin: 0 auto 1rem; opacity: 0.5; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--display); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.table td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; vertical-align: middle; }
.table tr:hover td { background: var(--bg-2); }

/* ── Auth screens ──────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-aside { position: relative; background: #06141A; color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(2rem, 4vw, 3.5rem); }
.auth-aside canvas { position: absolute; inset: 0; z-index: 0; opacity: 0.7; }
.auth-aside .veil { position: absolute; inset: 0; z-index: 1; background: radial-gradient(90% 80% at 20% 0%, hsl(186 70% 26% / 0.45), transparent 60%), linear-gradient(160deg, transparent, hsl(190 75% 4% / 0.6)); }
.auth-aside > * { position: relative; z-index: 2; }
.auth-aside .a-top { display: flex; align-items: center; gap: 0.7rem; }
.auth-aside .a-top img { width: 42px; }
.auth-aside .a-top b { font-family: var(--display); font-weight: 700; letter-spacing: 0.02em; }
.auth-aside h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 3.2vw, 2.8rem); letter-spacing: -0.02em; line-height: 1.05; max-width: 16ch; }
.auth-aside h2 .soft { color: var(--teal-leaf); }
.auth-aside .a-tag { font-family: var(--display); font-style: italic; color: hsl(180 25% 82% / 0.7); font-size: 0.95rem; }
.auth-main { display: grid; place-items: center; padding: clamp(1.5rem, 4vw, 3rem); background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-family: var(--display); font-weight: 600; font-size: 1.8rem; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--ink-2); margin: 0.5rem 0 2rem; }
.auth-switch { margin-top: 1.5rem; font-size: 0.9rem; color: var(--ink-2); text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 600; cursor: pointer; }
.demo-accounts { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.demo-accounts .dh { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.demo-chip { text-align: left; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; transition: var(--t); }
.demo-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.demo-chip b { font-family: var(--display); font-size: 0.82rem; display: block; }
.demo-chip span { font-size: 0.72rem; color: var(--muted); }
.err-msg { background: hsl(0 70% 55% / 0.1); color: hsl(0 60% 48%); border: 1px solid hsl(0 70% 55% / 0.25); padding: 0.7rem 0.9rem; border-radius: var(--r-sm); font-size: 0.86rem; margin-bottom: 1.2rem; }

/* ── Course catalog ────────────────────────────────────── */
.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.course-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.course-cover { aspect-ratio: 16/9; background: linear-gradient(150deg, var(--teal-deep), #062a30); position: relative; overflow: hidden; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover .cat { position: absolute; top: 0.8rem; left: 0.8rem; }
.course-body { padding: 1.3rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.course-body h3 { font-family: var(--display); font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.course-body p { color: var(--ink-2); font-size: 0.9rem; margin-top: 0.45rem; flex: 1; }
.course-meta { display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }
.progbar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-top: 1rem; }
.progbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-leaf)); border-radius: 99px; transition: width var(--t-slow); }

/* ── Course player ─────────────────────────────────────── */
.player { display: grid; grid-template-columns: 320px 1fr; gap: 1.75rem; align-items: start; }
.lesson-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem; position: sticky; top: calc(var(--top-h) + 1rem); }
.lesson-list .mod-title { font-family: var(--display); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0.9rem 0.7rem 0.5rem; }
.lesson-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem; border-radius: var(--r-sm); cursor: pointer; transition: background var(--t-fast); width: 100%; text-align: left; border: none; background: none; color: var(--ink); }
.lesson-item:hover:not(.locked) { background: var(--bg-2); }
.lesson-item.active { background: var(--ink); color: var(--bg); }
.lesson-item.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-item .lic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; border: 1.5px solid var(--line-strong); }
.lesson-item.done .lic { background: hsl(152 50% 45%); border-color: hsl(152 50% 45%); color: #fff; }
.lesson-item.active .lic { border-color: var(--bg); }
.lesson-item .lic svg { width: 13px; height: 13px; }
.lesson-item .lt { font-size: 0.86rem; font-weight: 500; line-height: 1.25; }
.lesson-item .ld { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.lesson-item.active .ld { color: hsl(180 20% 82% / 0.7); }
.exam-item .lic { border-color: var(--orange); color: var(--orange); }
.exam-item.locked .lic { border-color: var(--line-strong); color: var(--muted); }

.lesson-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.5rem, 3vw, 2.5rem); min-width: 0; }
.lesson-main .type-pill { margin-bottom: 1rem; }
.lesson-main h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; }
.media-frame { margin: 1.5rem 0; border-radius: var(--r-md); overflow: hidden; background: #06141A; }
.media-frame.video { aspect-ratio: 16/9; }
.media-frame iframe, .media-frame video { width: 100%; height: 100%; border: none; display: block; }
.audio-frame { margin: 1.5rem 0; padding: 1.5rem; border-radius: var(--r-md); background: var(--bg-2); display: flex; align-items: center; gap: 1rem; }
.audio-frame .wave { width: 48px; height: 48px; border-radius: 50%; background: var(--orange-soft); color: var(--accent-2); display: grid; place-items: center; flex-shrink: 0; }
.audio-frame .wave svg { width: 22px; height: 22px; }
.audio-frame audio { flex: 1; }
.lesson-body { line-height: 1.7; color: var(--ink-2); }
.lesson-body h3 { font-family: var(--display); color: var(--ink); font-size: 1.2rem; margin: 1.5rem 0 0.6rem; }
.lesson-body p { margin-bottom: 1rem; }
.lesson-body strong { color: var(--ink); }
.lesson-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

/* ── Exam ──────────────────────────────────────────────── */
.exam-wrap { max-width: 760px; margin: 0 auto; }
.exam-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.6rem 1.75rem; margin-bottom: 1.25rem; }
.exam-q .qn { font-family: var(--display); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); }
.exam-q .qp { font-size: 1.08rem; font-weight: 500; margin: 0.5rem 0 1.2rem; line-height: 1.4; }
.opt { display: flex; align-items: center; gap: 0.8rem; padding: 0.85rem 1rem; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; margin-bottom: 0.6rem; transition: var(--t); }
.opt:hover { border-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.opt .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; display: grid; place-items: center; }
.opt.sel .dot { border-color: var(--accent); }
.opt.sel .dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.opt.correct { border-color: hsl(152 50% 45%); background: hsl(152 50% 45% / 0.08); }
.opt.wrong { border-color: hsl(0 65% 55%); background: hsl(0 65% 55% / 0.08); }

/* result */
.result-hero { text-align: center; padding: 2.5rem; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.result-ring { width: 130px; height: 130px; margin: 0 auto 1.5rem; position: relative; }
.result-ring svg { transform: rotate(-90deg); }
.result-ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 1.9rem; }

/* ── Certificate ───────────────────────────────────────── */
.cert-actions { display: flex; gap: 0.8rem; justify-content: center; margin-bottom: 2rem; flex-wrap: wrap; }
.certificate {
  width: 1000px; max-width: 100%; aspect-ratio: 1.414/1; margin: 0 auto; position: relative;
  background: #fbf9f4; color: #16292B; border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow-lg); padding: clamp(2rem, 5vw, 4rem);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.certificate::before { content: ''; position: absolute; inset: 18px; border: 2px solid var(--teal-deep); border-radius: 4px; pointer-events: none; }
.certificate::after { content: ''; position: absolute; inset: 24px; border: 1px solid var(--orange); border-radius: 2px; pointer-events: none; }
.cert-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; height: 100%; width: 100%; justify-content: space-between; }
.cert-logo { width: 70px; }
.cert-kicker { font-family: var(--display); letter-spacing: 0.35em; text-transform: uppercase; font-size: 0.8rem; color: var(--teal-deep); font-weight: 600; }
.cert-title { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.02em; margin: 0.3rem 0; }
.cert-name { font-family: var(--display); font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 600; color: var(--teal-deep); border-bottom: 2px solid var(--orange); padding-bottom: 0.4rem; margin: 0.5rem 0; }
.cert-for { font-size: 1.05rem; color: #46585A; max-width: 50ch; }
.cert-for b { color: #16292B; }
.cert-foot { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; gap: 2rem; margin-top: 1rem; }
.cert-sig { text-align: center; flex: 1; }
.cert-sig .ln { border-top: 1.5px solid #16292B; padding-top: 0.5rem; font-size: 0.82rem; }
.cert-sig .sg { font-family: var(--display); font-size: 1.3rem; font-style: italic; color: var(--teal-deep); }
.cert-seal { width: 86px; height: 86px; border-radius: 50%; border: 2px solid var(--orange); display: grid; place-items: center; text-align: center; flex-shrink: 0; color: var(--orange); font-family: var(--display); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.3; font-weight: 600; }
.cert-code { font-family: var(--display); font-size: 0.78rem; color: #8A9698; letter-spacing: 0.1em; }

/* ── Authoring ─────────────────────────────────────────── */
.builder { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.mod-block { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.mod-head { display: flex; align-items: center; gap: 0.8rem; padding: 1rem 1.25rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.mod-head input { flex: 1; font-family: var(--display); font-weight: 600; font-size: 1rem; background: none; border: none; color: var(--ink); }
.mod-head input:focus { outline: none; }
.lesson-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: none; }
.lesson-row .ltype { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; background: var(--bg-2); color: var(--accent); }
.lesson-row .ltype svg { width: 15px; height: 15px; }
.lesson-row .lms-btn svg { width: 15px; height: 15px; }
.empty svg { width: 46px; height: 46px; margin: 0 auto 1rem; opacity: 0.5; display: block; }
.stat-card .n svg, .result-ring svg { width: auto; height: auto; }
.lesson-row .linfo { flex: 1; min-width: 0; }
.lesson-row .linfo b { font-family: var(--display); font-size: 0.92rem; font-weight: 500; }
.lesson-row .linfo span { font-size: 0.76rem; color: var(--muted); display: block; }
.add-bar { display: flex; gap: 0.6rem; padding: 1rem 1.25rem; flex-wrap: wrap; }

/* modal */
.modal-lms { position: fixed; inset: 0; z-index: 300; background: hsl(190 60% 3% / 0.6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 1.5rem; opacity: 0; pointer-events: none; transition: opacity var(--t); }
.modal-lms.open { opacity: 1; pointer-events: all; }
.modal-panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); width: min(620px, 100%); max-height: 88vh; overflow-y: auto; padding: clamp(1.5rem, 3vw, 2.25rem); box-shadow: var(--shadow-lg); transform: translateY(12px) scale(0.98); transition: transform var(--t); }
.modal-lms.open .modal-panel { transform: none; }
.modal-panel h3 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin-bottom: 1.3rem; letter-spacing: -0.01em; }
.modal-foot { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1.5rem; }
.seg { display: inline-flex; gap: 0.3rem; padding: 0.3rem; background: var(--bg-2); border-radius: var(--r-full); margin-bottom: 1.1rem; }
.seg button { font-family: var(--display); font-size: 0.82rem; font-weight: 500; padding: 0.45rem 0.9rem; border-radius: var(--r-full); color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--bg); }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 400; background: var(--ink); color: var(--bg); padding: 0.85rem 1.4rem; border-radius: var(--r-full); font-family: var(--display); font-size: 0.9rem; font-weight: 500; opacity: 0; pointer-events: none; transition: var(--t); box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ────────────────────────────────────────── */
.scrim { display: none; }
@media (max-width: 1080px) {
  .player { grid-template-columns: 1fr; }
  .lesson-list { position: static; }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .lms-shell { grid-template-columns: 1fr; }
  .side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .main { grid-column: 1; }
  .burger-lms { display: grid; }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 45; background: hsl(190 60% 3% / 0.5); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 680px) {
  .g-2, .g-3, .g-4, .row-2 { grid-template-columns: 1fr; }
  .usermenu .nm, .usermenu .rl { display: none; }
  .demo-grid { grid-template-columns: 1fr; }
  /* wide data tables scroll instead of clipping inside overflow:hidden cards */
  .card .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

/* print certificate */
@media print {
  .topbar, .side, .cert-actions, .scrim, #themeBtn { display: none !important; }
  .lms-shell { display: block; }
  .content { padding: 0; max-width: none; }
  .certificate { box-shadow: none; width: 100%; }
  @page { size: A4 landscape; margin: 0; }
}
