:root {
  color-scheme: light;
  --bg: #fff8e4;
  --surface: #fffdf7;
  --surface-soft: #f6edd8;
  --surface-strong: #f0dfb9;
  --text: #17212b;
  --muted: #5f6874;
  --line: #e2d3b3;
  --primary: #00365b;
  --primary-dark: #002844;
  --accent: #c9a55b;
  --accent-soft: #eac78b;
  --success: #226d4f;
  --warning: #9a6500;
  --danger: #a93838;
  --shadow: 0 18px 48px rgba(0, 54, 91, 0.12);
  --shadow-soft: 0 10px 28px rgba(0, 54, 91, 0.08);
  --header-bg: rgba(255,253,247,0.94);
  --input-bg: #ffffff;
  --hero-text: rgba(255,255,255,.84);
  --radius: 8px;
  --radius-small: 6px;
  --max: 1240px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081c2d;
  --surface: #0f2b41;
  --surface-soft: #17384f;
  --surface-strong: #1f4560;
  --text: #fff8e4;
  --muted: #bfd0da;
  --line: rgba(234, 199, 139, .22);
  --primary: #eac78b;
  --primary-dark: #c9a55b;
  --accent: #eac78b;
  --accent-soft: #fff0bf;
  --success: #7fc7a1;
  --warning: #f2c36f;
  --danger: #ff9b9b;
  --shadow: 0 20px 50px rgba(0, 0, 0, .34);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, .24);
  --header-bg: rgba(8, 28, 45, .9);
  --input-bg: #0a2235;
  --hero-text: rgba(255,248,228,.84);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PT Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

:root[data-theme="dark"] body {
  background: var(--bg);
}

button, input, textarea, select { font: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid rgba(201, 165, 91, 0.28);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.site-brand,
.site-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand { font-weight: 850; }

.site-brand-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(234, 199, 139, .48);
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  letter-spacing: .08em;
  box-shadow: 0 8px 22px rgba(0,54,91,.16);
}

.site-brand-symbol img,
.brand-mark img,
.admin-sidebar-symbol img,
.brand-preview-symbol img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-brand-symbol img,
.brand-mark img,
.admin-sidebar-symbol img {
  padding: 5px;
}

:root[data-theme="dark"] .site-brand-symbol.has-brand-logo,
:root[data-theme="dark"] .brand-mark.has-brand-logo,
:root[data-theme="dark"] .admin-sidebar-symbol.has-brand-logo,
:root[data-theme="dark"] .brand-preview-symbol.has-brand-logo {
  border-color: rgba(255, 248, 228, .42);
  background: #00365b;
  color: #fff8e4;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}

.site-brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.site-brand-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.header-user {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.header-greeting {
  display: block;
  max-width: min(32vw, 360px);
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .15s, background .2s, color .2s;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: var(--surface-soft);
}

.theme-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.page-shell {
  width: min(calc(100% - 34px), var(--max));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 30px 0 64px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 150px);
  place-items: center;
}

.auth-card {
  position: relative;
  width: min(100%, 560px);
  padding: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card-modern {
  display: grid;
  gap: 20px;
}

.auth-card-accent {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-card-accent img,
.auth-feature-list img,
.insight-card img,
.admin-sidebar-heading img,
.admin-nav img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.auth-brand-row {
  display: grid;
  grid-template-columns: 72px minmax(0,1fr);
  gap: 18px;
  align-items: center;
}

.auth-brand-row .brand-mark {
  margin-bottom: 0;
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 40px);
}

.auth-card .admin-login-title {
  font-size: clamp(24px, 2.2vw, 31px);
  line-height: 1.18;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 25px;
  place-items: center;
  border: 1px solid rgba(234, 199, 139, .5);
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-weight: 900;
  letter-spacing: .06em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, h4 {
  margin-top: 0;
  line-height: 1.18;
}

h1 {
  margin-bottom: 15px;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: 0;
}

h2 {
  font-size: clamp(24px, 2.6vw, 34px);
  letter-spacing: 0;
}

h3 { font-size: 20px; }

.auth-description {
  margin: 0;
  color: var(--muted);
}

.auth-feature-list {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px;
}

.auth-feature-list span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-stack label {
  display: grid;
  gap: 7px;
}

.form-stack label > span {
  font-size: 14px;
  font-weight: 750;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

input, select {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 120px;
  padding: 13px 14px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,54,91,.12);
}

.button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform .15s, background .2s, opacity .2s;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .58; }
.button-primary { background: var(--primary); color: white; }
:root[data-theme="dark"] .button-primary { color: #082033; }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); }
.button-secondary { border: 1px solid var(--line); background: var(--surface); color: var(--primary); }
.button-light { border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); color: white; }
.button-light:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.button-disabled { background: #e7dfce; color: #7c7468; }
:root[data-theme="dark"] .button-disabled { background: #203649; color: #8fa8b8; }
.button-block { width: 100%; }
.button-small { min-height: 36px; padding: 0 13px; font-size: 13px; }

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

.form-message {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
}

.form-message-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) 280px;
  gap: 40px;
  align-items: center;
  padding: 44px;
  overflow: hidden;
  border: 1px solid rgba(234,199,139,.22);
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.dashboard-hero .eyebrow { color: var(--accent-soft); }

.hero-greeting {
  max-width: 860px;
  font-size: clamp(22px, 2.35vw, 32px);
  line-height: 1.22;
}

.dashboard-hero p:not(.eyebrow) {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--hero-text);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hero-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.84);
  font-size: 12px;
  font-weight: 800;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.progress-summary {
  position: relative;
  z-index: 1;
  padding: 25px;
  border: 1px solid rgba(234,199,139,.38);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.progress-summary > strong {
  display: block;
  font-size: 44px;
  line-height: 1;
}

.progress-summary > span { color: var(--muted); }
.progress-summary .button { margin-top: 18px; }

.progress-track {
  height: 8px;
  margin-top: 17px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.section-heading,
.admin-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 38px 0 18px;
}

.section-heading h2,
.admin-page-heading h1 { margin-bottom: 0; }

.course-hours { color: var(--muted); font-weight: 700; }

.video-panel {
  display: grid;
  gap: 16px;
  margin: 18px 0 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.video-panel-copy {
  max-width: 720px;
}

.video-panel-copy h2 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2vw, 28px);
}

.video-panel-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.video-frame {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.video-frame iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.video-card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 16px;
}

.video-card-body h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.video-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.video-sound-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  cursor: pointer;
}

.video-sound-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.video-sound-button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--surface);
}

:root[data-theme="dark"] .video-sound-button[aria-pressed="true"] {
  color: #082033;
}

.video-gallery.is-empty,
.video-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.dashboard-insights,
.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 14px;
}

.insight-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.insight-card img {
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.insight-card span,
.progress-summary > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.insight-card strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.lesson-card {
  position: relative;
  display: flex;
  min-height: 360px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}

.lesson-card.is-locked { opacity: .67; }
.lesson-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow);
}
.lesson-card.is-locked:hover { transform: none; box-shadow: var(--shadow-soft); }

.lesson-number {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 22px 0 0 22px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-size: 23px;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.lesson-card-body {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 18px 22px 22px;
}

.lesson-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.lesson-card h3 {
  margin: 14px 0 8px;
  font-size: 21px;
  line-height: 1.22;
}

.lesson-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.lesson-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 70%, var(--surface));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-line { margin: 14px 0 0; }
.lesson-card-actions { margin-top: 18px; }
.lesson-card-actions .button { width: 100%; }

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.status-available, .status-active { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }
.status-in-progress { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: var(--warning); }
.status-under-review { background: #eeeafa; color: #6749a0; }
.status-approved, .status-completed { background: #e3f4ea; color: var(--success); }
.status-correction-required,
.status-time-exceeded,
.status-failed,
.status-blocked { background: #ffebeb; color: var(--danger); }

.information-panel {
  margin-top: 36px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.information-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 17px;
}

.information-grid div {
  display: flex;
  gap: 10px;
  color: var(--muted);
}

.information-grid strong { color: var(--accent); }

.lesson-layout {
  display: grid;
  grid-template-columns: 285px minmax(0,1fr);
  gap: 44px;
  align-items: start;
}

.lesson-sidebar {
  position: sticky;
  top: 95px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.lesson-sidebar h2 {
  margin: 8px 0 22px;
  font-size: 23px;
}

.lesson-time-summary {
  display: grid;
  gap: 9px;
  margin: 22px 0;
}

.lesson-time-summary span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.lesson-time-summary strong { color: var(--text); }

.lesson-navigation {
  display: grid;
  gap: 5px;
  max-height: 45vh;
  overflow: auto;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.lesson-navigation a {
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.lesson-navigation a:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.lesson-header {
  padding: 35px 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lesson-header h1 { margin: 14px 0; }
.lesson-header p { margin-bottom: 0; color: var(--muted); }

.content-section {
  scroll-margin-top: 92px;
  margin-top: 25px;
  padding: 36px 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.content-section-label {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.rich-content { color: var(--text); }
.rich-content h4 { margin-top: 24px; }
.rich-content li + li { margin-top: 6px; }

.formula {
  margin: 20px 0;
  padding: 17px;
  overflow-x: auto;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-soft);
  color: var(--text);
  text-align: center;
  font-size: 18px;
}

.callout, .example {
  margin: 20px 0;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.assessment-area { margin-top: 30px; }

.start-assessment-card,
.completion-card,
.review-card,
.submission-box,
.upload-panel {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.start-assessment-card,
.completion-card,
.review-card { text-align: center; }

.start-assessment-card p,
.completion-card p,
.review-card p {
  max-width: 680px;
  margin-right: auto;
  margin-left: auto;
  color: var(--muted);
}

.completion-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 50%;
  background: #e3f4ea;
  color: var(--success);
  font-size: 32px;
  font-weight: 900;
}

.standalone-card { max-width: 750px; margin: 70px auto; }

.attempt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 28px 32px;
  border: 1px solid rgba(234,199,139,.22);
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
}

.attempt-header h2 { margin-bottom: 0; }

.timer-card {
  min-width: 190px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.13);
  text-align: center;
}

.timer-card span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
}

.timer-card strong {
  display: block;
  margin-top: 2px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.timer-card.is-critical { background: #a83b32; }

.question-list {
  display: grid;
  gap: 20px;
}

.question-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.question-number, .question-points {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.question-card h3 { margin: 8px 0 5px; }

.option-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.option-item {
  display: grid;
  grid-template-columns: 20px 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.option-item:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.option-item input {
  width: 18px;
  min-height: auto;
}

.option-label {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  font-weight: 900;
}

.save-indicator {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.upload-panel { margin-top: 22px; }

.upload-methods {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(320px,.8fr);
  gap: 18px;
  margin-top: 20px;
  align-items: stretch;
}

.upload-dropzone {
  display: grid;
  min-height: 170px;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(255,248,228,.62);
  cursor: pointer;
  text-align: center;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-dropzone span,
.upload-dropzone strong,
.upload-dropzone small { display: block; }

.upload-icon { font-size: 28px; font-weight: 900; }
.upload-progress { margin: 14px 0; color: var(--primary); font-weight: 700; }

.drive-upload-form {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.drive-upload-form label {
  display: grid;
  gap: 7px;
}

.drive-upload-form label > span {
  font-size: 14px;
  font-weight: 800;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.uploaded-files {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.uploaded-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.uploaded-file strong,
.uploaded-file span { display: block; }

.uploaded-file span {
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: flex;
  gap: 10px;
}

.file-actions button {
  border: 0;
  background: none;
  color: var(--danger);
  cursor: pointer;
}

.submission-box { margin-top: 22px; }

.authorship-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.authorship-check input {
  width: 20px;
  min-height: 20px;
}

.submission-warning, .empty-note {
  color: var(--muted);
  font-size: 13px;
}

.review-score {
  color: var(--primary) !important;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
}

.success-note {
  padding: 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
  color: var(--success) !important;
}

.certificate-card {
  max-width: 960px;
  margin: 40px auto;
  padding: 65px;
  border: 10px double var(--line);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow);
}

.certificate-lead { color: var(--muted); }

.certificate-data {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 12px;
  margin: 35px 0;
}

.certificate-data div {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.certificate-data span,
.certificate-data strong { display: block; }

.certificate-data span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.loading-state {
  display: grid;
  min-height: 55vh;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--surface-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast-container {
  position: fixed;
  z-index: 1000;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(380px,calc(100vw - 36px));
}

.toast {
  padding: 13px 15px;
  transform: translateY(15px);
  border-radius: var(--radius);
  opacity: 0;
  background: #243a41;
  color: white;
  box-shadow: var(--shadow);
  transition: .22s;
}

.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); }
.toast-error { background: var(--danger); }

.dialog-overlay {
  position: fixed;
  z-index: 500;
  inset: 0;
  display: grid;
  padding: 22px;
  place-items: center;
  overflow: auto;
  background: rgba(9,25,31,.72);
}

.dialog-card {
  position: relative;
  width: min(100%,760px);
  padding: 35px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 30px;
}

.configuration-error {
  max-width: 760px;
  margin: 80px auto;
  padding: 35px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--danger);
}

.configuration-error code {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 230px minmax(0,1fr);
  gap: 28px;
}

.admin-sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.admin-sidebar h2 {
  margin: 0;
  font-size: 18px;
}

.admin-sidebar-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-sidebar-heading img {
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.admin-sidebar-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--surface);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
}

:root[data-theme="dark"] .admin-sidebar-symbol {
  color: #082033;
}

.admin-nav {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}

.admin-nav img {
  width: 18px;
  height: 18px;
}

.admin-nav.is-active {
  background: var(--surface-soft);
  color: var(--primary);
}

.admin-page-heading { margin-top: 0; }

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.admin-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table small {
  display: block;
  color: var(--muted);
}

.empty-table {
  padding: 44px !important;
  color: var(--muted);
  text-align: center !important;
}

.submission-columns {
  display: grid;
  grid-template-columns: minmax(0,1fr) 390px;
  gap: 28px;
}

.admin-answer {
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.answer-value {
  padding: 15px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  overflow-wrap: anywhere;
}

.review-form-card,
.review-files {
  margin-bottom: 20px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-video-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.admin-video-form {
  display: grid;
  grid-template-columns: minmax(180px,.65fr) minmax(260px,1fr) auto;
  gap: 14px;
  align-items: end;
}

.admin-video-form label {
  display: grid;
  gap: 7px;
}

.admin-video-form label > span {
  font-size: 14px;
  font-weight: 750;
}

.admin-video-description {
  grid-column: 1 / -1;
}

.admin-video-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.admin-video-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.admin-video-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.admin-video-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.admin-video-card small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

.admin-video-card button {
  border: 0;
  background: none;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

.brand-settings-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.brand-preview-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-preview-symbol {
  display: grid;
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--surface);
  font-weight: 900;
}

.brand-preview-symbol img {
  padding: 8px;
}

:root[data-theme="dark"] .brand-preview-symbol {
  color: #082033;
}

.brand-preview-card h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.brand-preview-card p {
  margin: 0;
  color: var(--muted);
}

.brand-logo-form {
  display: grid;
  gap: 14px;
}

.brand-logo-form label {
  display: grid;
  gap: 7px;
}

.brand-logo-form label > span {
  font-size: 14px;
  font-weight: 750;
}

.brand-logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-file-card {
  display: block;
  margin-bottom: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.admin-file-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.student-admin-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px 16px;
  margin-top: 12px;
}

.student-admin-card {
  display: grid;
  align-content: start;
  min-height: 218px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.student-admin-card h3 { margin: 14px 0 3px; }
.student-admin-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.student-progress-line {
  display: flex;
  justify-content: space-between;
  padding: 12px 0 10px;
  border-top: 1px solid var(--line);
}

.student-admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.student-admin-actions button {
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

/* Certificate verification */
.verification-shell {
  max-width: 760px;
  margin: 45px auto;
}

.verification-form {
  display: flex;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.verification-card {
  margin-top: 20px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.verification-valid { border-top: 5px solid var(--success); }
.verification-invalid { border-top: 5px solid var(--danger); }

.verification-card > span {
  font-weight: 900;
  text-transform: uppercase;
}

.verification-valid > span { color: var(--success); }
.verification-invalid > span { color: var(--danger); }

.verification-card dl {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
}

.verification-card dl div {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.verification-card dt {
  color: var(--muted);
  font-size: 12px;
}

.verification-card dd {
  margin: 0;
  font-weight: 800;
}

@media (max-width: 1120px) {
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .admin-sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(190px,1fr) repeat(4,minmax(120px,160px));
    gap: 10px;
    align-items: center;
  }

  .admin-sidebar-heading {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .admin-nav {
    margin-top: 0;
    justify-content: center;
  }
}

@media (max-width: 1000px) {
  .lesson-card { min-height: auto; }
  .information-grid { grid-template-columns: repeat(2,1fr); }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; }
  .lesson-navigation { display: none; }
  .submission-columns { grid-template-columns: 1fr; }
  .upload-methods { grid-template-columns: 1fr; }
  .admin-video-form { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header { padding: 0 16px; }
  .site-brand span:last-child { display: none; }
  .site-header-actions { gap: 8px; }
  .header-greeting {
    max-width: 34vw;
    font-size: 12px;
  }
  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .page-shell {
    width: min(calc(100% - 22px),var(--max));
    padding-top: 20px;
    padding-bottom: 46px;
  }

  .auth-card,
  .dashboard-hero,
  .lesson-header,
  .content-section,
  .question-card,
  .start-assessment-card,
  .completion-card,
  .review-card,
  .submission-box,
  .upload-panel {
    padding: 24px;
  }

  .dashboard-hero { grid-template-columns: 1fr; }
  .progress-summary { width: 100%; }
  .dashboard-insights,
  .admin-summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }
  .auth-brand-row { grid-template-columns: 1fr; }
  .auth-feature-list { grid-template-columns: 1fr; }
  .video-panel { padding: 20px; }
  .video-frame { min-height: 220px; }
  .video-frame.is-empty { min-height: 150px; }
  .video-card-body {
    align-items: stretch;
    flex-direction: column;
  }
  .video-sound-button {
    width: 42px;
    height: 42px;
  }
  .brand-preview-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .brand-logo-actions .button {
    width: 100%;
  }

  .admin-sidebar {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    justify-content: flex-start;
  }

  .admin-video-card {
    align-items: stretch;
    flex-direction: column;
  }

  .information-grid,
  .certificate-data,
  .student-admin-grid,
  .verification-card dl {
    grid-template-columns: 1fr;
  }

  .attempt-header {
    align-items: stretch;
    flex-direction: column;
  }

  .timer-card { width: 100%; }

  .uploaded-file,
  .section-heading,
  .admin-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .verification-form { flex-direction: column; }
  .certificate-card { padding: 32px 20px; }
}
