:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eef6ff;
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(220, 229, 242, 0.9);
  --hover-surface: #fbfdff;
  --field-bg: #ffffff;
  --text: #132238;
  --muted: #687386;
  --line: #dce5f2;
  --line-strong: #b9c8dc;
  --blue: #245ef5;
  --blue-dark: #183fbc;
  --teal: #0b9f9a;
  --green: #14966f;
  --red: #c2410c;
  --amber: #b46b00;
  --rose: #d12c5f;
  --violet: #6852e8;
  --sidebar: #ffffff;
  --shadow: 0 22px 56px rgba(19, 34, 56, 0.12);
  --shadow-soft: 0 12px 32px rgba(19, 34, 56, 0.075);
  --shadow-quiet: 0 1px 2px rgba(19, 34, 56, 0.04);
}

:root[data-theme="dark"] {
  --bg: #0d1624;
  --surface: #121e31;
  --surface-soft: #16243a;
  --surface-tint: #132f46;
  --glass: rgba(18, 30, 49, 0.72);
  --glass-strong: rgba(18, 30, 49, 0.9);
  --glass-border: rgba(137, 166, 205, 0.22);
  --hover-surface: #17283f;
  --field-bg: #0f1b2d;
  --text: #edf5ff;
  --muted: #9fb0c7;
  --line: #253955;
  --line-strong: #3b5576;
  --blue: #6e9cff;
  --blue-dark: #a8c2ff;
  --teal: #35d0c2;
  --green: #3bd49a;
  --red: #ff8b67;
  --amber: #f2b45f;
  --rose: #ff75a2;
  --violet: #a89cff;
  --sidebar: rgba(16, 27, 45, 0.82);
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.24);
  --shadow-quiet: 0 1px 2px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f9fbff 0%, #f4f7fb 42%, #f6f8fb 100%);
  overflow-x: hidden;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 18% 0%, rgba(36, 94, 245, 0.18), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(11, 159, 154, 0.14), transparent 28%),
    linear-gradient(180deg, #0b1320 0%, #0d1624 48%, #0a111c 100%);
}

button, input, select, textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: var(--text);
  padding: 22px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 28px rgba(19, 34, 56, 0.035);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  padding: 10px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(36, 94, 245, 0.24);
}

.brand-copy { min-width: 0; }
.brand-title { font-weight: 800; overflow-wrap: anywhere; }
.brand-subtitle { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }

.sidebar-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-quiet);
}

.sidebar-toggle span {
  width: 14px;
  height: 14px;
  display: block;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.sidebar-toggle:hover {
  color: var(--blue-dark);
  border-color: var(--line-strong);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 10px 13px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.nav-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: currentColor;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  display: block;
  overflow-wrap: anywhere;
}

.nav-item.active,
.nav-item:hover {
  background: var(--surface-tint);
  color: var(--blue-dark);
  box-shadow: inset 3px 0 0 var(--blue);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 18px 12px;
  overflow-x: hidden;
}

.app-shell.sidebar-collapsed .brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 8px;
}

.app-shell.sidebar-collapsed .brand-copy {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(225deg);
}

.app-shell.sidebar-collapsed .nav-item {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 5px;
  text-align: center;
}

.app-shell.sidebar-collapsed .nav-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.app-shell.sidebar-collapsed .nav-icon svg {
  width: 22px;
  height: 22px;
}

.app-shell.sidebar-collapsed .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .nav-item.active,
.app-shell.sidebar-collapsed .nav-item:hover {
  box-shadow: inset 0 -3px 0 var(--blue);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 18px 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: var(--shadow-quiet);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.theme-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--glass-strong);
  color: var(--text);
  box-shadow: var(--shadow-quiet);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: inset -5px -3px 0 rgba(255, 255, 255, 0.55);
}

:root[data-theme="dark"] .theme-toggle-icon {
  box-shadow: inset -7px -2px 0 #0f1b2d, 0 0 16px rgba(53, 208, 194, 0.32);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 32px; line-height: 1.1; margin-bottom: 7px; overflow-wrap: anywhere; letter-spacing: 0; }
h2 { font-size: 21px; line-height: 1.18; margin-bottom: 6px; overflow-wrap: anywhere; letter-spacing: 0; }
h3 { font-size: 16px; line-height: 1.25; margin-bottom: 8px; overflow-wrap: anywhere; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.primary, .secondary {
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 13px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary {
  background: linear-gradient(135deg, var(--blue), #3177ff);
  color: #fff;
  box-shadow: 0 10px 20px rgba(36, 94, 245, 0.22);
}

.primary:hover { background: var(--blue-dark); }

.secondary {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--line);
  box-shadow: var(--shadow-quiet);
}

.secondary:hover { border-color: var(--line-strong); }
.secondary.danger { color: var(--red); }

.wide { width: 100%; justify-content: center; }
.compact { width: 40px; padding: 0; font-size: 22px; }
.compact-text { min-height: 34px; padding: 7px 10px; font-size: 13px; }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

@media (hover: none) {
  .primary, .secondary, .nav-item, .lesson-nav-item, .answer-option {
    min-height: 44px;
  }
}

.button-row, .hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill, .mini-badge, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  width: fit-content;
}

.badge.good, .status-pill.ok { background: rgba(20, 150, 111, 0.14); color: var(--green); }
.badge.warn, .status-pill.bad { background: rgba(180, 107, 0, 0.14); color: var(--amber); }
.badge-soft { background: rgba(255, 255, 255, 0.18); color: #fff; }

.grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.grid.two {
  grid-template-columns: minmax(330px, 0.9fr) minmax(420px, 1.2fr);
}

.knowledge-secondary {
  margin-top: 18px;
}

.panel {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-head p { margin-bottom: 0; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  margin-bottom: 24px;
}

.hero-panel {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 280px;
  gap: 24px;
  align-items: stretch;
  padding: 30px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, #10223d 0%, #164c9f 54%, #0b8f8a 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: linear-gradient(90deg, #29d0a4, #6ea5ff, #f0b35a);
}

.hero-content {
  display: grid;
  align-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.hero-content h2 {
  font-size: 38px;
  line-height: 1.03;
  margin: 0;
  max-width: 720px;
  letter-spacing: 0;
}

.hero-content p {
  color: #dce8ff;
  max-width: 720px;
}

.hero-content .secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.hero-card {
  display: grid;
  gap: 18px;
  align-content: center;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
  z-index: 1;
}

.hero-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.circle-progress {
  --value: 0;
  width: 154px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: center;
  background: conic-gradient(#34d399 calc(var(--value) * 1%), rgba(255,255,255,0.2) 0);
}

.circle-progress span {
  width: 108px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(16, 24, 40, 0.92);
  font-size: 28px;
  font-weight: 850;
}

.integrity-list {
  display: grid;
  gap: 8px;
  color: #edf5ff;
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  background: var(--muted);
}

.dot.good { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.blue { background: #60a5fa; }

.side-stack {
  display: grid;
  gap: 12px;
}

.metric-card {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--blue);
  margin-bottom: 16px;
}

.metric-card.risk { border-color: rgba(180, 107, 0, 0.3); background: rgba(180, 107, 0, 0.08); }
.metric-card.risk::before { background: var(--amber); }
.metric-value { font-size: 32px; font-weight: 850; line-height: 1; margin-bottom: 7px; letter-spacing: 0; }
.metric-label { color: var(--muted); font-size: 13px; }

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 14px;
}

.compact-title {
  margin-top: 18px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.feature-card, .partner-card, .library-card {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.feature-card:hover, .partner-card:hover, .library-card:hover, .course-item:hover, .learning-card:hover, .asset-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-tint), rgba(11, 159, 154, 0.12));
  color: var(--blue-dark);
  font-weight: 850;
  margin-bottom: 12px;
}

.builder-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 292px;
  gap: 16px;
  align-items: start;
}

.course-list-panel, .assistant-panel {
  position: sticky;
  top: 24px;
}

.assistant-panel {
  display: grid;
  gap: 12px;
}

.assistant-card {
  background: linear-gradient(145deg, rgba(17, 31, 54, 0.92) 0%, rgba(28, 63, 136, 0.86) 100%);
  color: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.assistant-card p { color: #cbd5e1; }
.assistant-head { display: flex; gap: 12px; align-items: flex-start; }
.assistant-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #59a1ff, #18b99f);
  font-weight: 850;
}

.token-widget, .token-ledger {
  display: grid;
  gap: 10px;
}

.token-widget {
  grid-template-columns: 1fr 1fr;
  margin: 14px 0;
}

.token-widget div, .token-ledger div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.token-widget strong, .token-ledger strong { display: block; font-size: 18px; }
.token-widget span, .token-ledger span { color: #cbd5e1; font-size: 12px; }
.token-ledger div { background: var(--surface-soft); border-color: var(--line); }
.token-ledger span { color: var(--muted); }

.assistant-control {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #eaf2ff;
  font-size: 13px;
  font-weight: 800;
}

.assistant-control select,
.assistant-control textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 10px;
}

.assistant-control select option {
  color: #111827;
}

.assistant-result {
  margin-top: 12px;
}

.assistant-status,
.assistant-history {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.35;
}

.assistant-status span {
  display: block;
}

.assistant-history {
  margin: 12px 0 0;
}

.assistant-history-title {
  color: #eaf2ff;
  font-weight: 850;
}

.assistant-history-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.assistant-history-row strong {
  color: #fff;
}

.assistant-draft {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.assistant-draft h3,
.assistant-draft p {
  margin-bottom: 0;
}

.assistant-draft ul {
  margin: 0;
  padding-left: 18px;
  color: #eaf2ff;
}

.assistant-draft-list {
  display: grid;
  gap: 8px;
}

.assistant-draft-list div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.assistant-draft-list span {
  color: #cbd5e1;
  font-size: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.course-item {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--glass-strong);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.course-item.selected {
  border-color: var(--blue);
  background: var(--surface-tint);
  box-shadow: 0 0 0 3px rgba(36, 94, 245, 0.11);
}

.course-item strong,
.item-title {
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.course-item span:not(.badge), .item-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.course-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.course-count { font-size: 12px; color: var(--muted); }

.library-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--glass-strong), var(--surface-tint)),
    var(--glass-strong);
  box-shadow: var(--shadow-soft);
}

.library-hero p {
  margin-bottom: 0;
}

.library-hero-actions,
.library-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.library-stats div,
.library-meta-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.library-stats strong,
.library-meta-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.library-stats span,
.library-meta-grid span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.course-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.library-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
}

.library-card.is-archived {
  opacity: 0.76;
}

.library-card-cover {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(36, 94, 245, 0.15), rgba(11, 159, 154, 0.18)),
    var(--surface-tint);
  border-right: 1px solid var(--line);
}

.library-card-cover span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--blue-dark);
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: var(--shadow-quiet);
}

.library-card-body {
  display: grid;
  gap: 10px;
  padding: 16px;
  min-width: 0;
}

.library-card-body h3,
.library-card-body p {
  margin-bottom: 0;
}

.library-card-body h3 {
  overflow-wrap: anywhere;
}

.library-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.library-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.partner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.partner-rules {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.partner-card {
  display: grid;
  gap: 10px;
}

.partner-card h3,
.partner-card p {
  margin-bottom: 0;
}

.partner-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.course-editor {
  display: grid;
  gap: 14px;
}

.editor-course-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-tint), rgba(11, 159, 154, 0.08));
  border: 1px solid var(--line);
}

.editor-course-head p { margin-bottom: 0; }

.template-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.template-strip button,
.editor-toolbar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--text);
  font-weight: 750;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-quiet);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.template-strip button:hover,
.editor-toolbar button:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  background: var(--surface-tint);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.module {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--glass-strong);
  box-shadow: var(--shadow-quiet);
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 14px;
  background: var(--surface-tint);
}

.module-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.lesson-list {
  display: grid;
}

.lesson-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-top: 1px solid var(--line);
  transition: background 160ms ease;
}

.lesson-card:hover {
  background: var(--hover-surface);
}

.lesson-icon, .asset-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-tint), rgba(11, 159, 154, 0.12));
  color: var(--blue-dark);
  font-weight: 850;
}

.lesson-type {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 850;
}

.asset-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.empty-state, .empty-inline {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background: var(--hover-surface);
}

.empty-inline {
  margin: 12px;
  padding: 14px;
}

.learner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 18px;
  align-items: start;
}

.student-workspace {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.student-top {
  margin-bottom: 16px;
}

.learning-grid {
  display: grid;
  gap: 14px;
}

.preview-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 94, 245, 0.24);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--blue-dark);
}

.preview-banner strong,
.preview-banner span {
  display: block;
}

.preview-banner span {
  color: var(--muted);
  font-size: 13px;
}

.learning-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.learning-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.progress, .mini-progress {
  height: 9px;
  border-radius: 999px;
  background: #e6ebf2;
  overflow: hidden;
  margin: 10px 0;
}

.mini-progress {
  height: 7px;
  margin: 0 0 4px;
  min-width: 140px;
}

.progress > div, .mini-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #36c78a);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
  font-size: 13px;
}

.phone-shell {
  display: grid;
  justify-items: center;
}

.phone {
  width: min(390px, 100%);
  min-height: 720px;
  border: 12px solid var(--text);
  border-radius: 28px;
  background: var(--surface-soft);
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(19, 34, 56, 0.22);
}

.phone-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--line);
  padding: 15px;
}

.phone-card {
  margin: 12px;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass-strong);
  box-shadow: var(--shadow-quiet);
}

.phone-card.subtle { background: var(--surface-tint); }

.asset-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-quiet);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.media-usage-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.media-usage-card div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.media-usage-card strong,
.media-usage-card span {
  display: block;
}

.media-usage-card strong {
  font-size: 18px;
}

.media-usage-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.video-jobs-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.video-jobs-head,
.video-job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-jobs-head span,
.video-job-row small {
  color: var(--muted);
  font-size: 12px;
}

.video-job-row {
  justify-content: flex-start;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.video-job-row div {
  min-width: 0;
}

.video-job-row strong,
.video-job-row small {
  display: block;
  overflow-wrap: anywhere;
}

.asset-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.asset-preview {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.asset-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-preview-head div {
  min-width: 0;
}

.asset-preview-head strong,
.asset-preview-head span {
  display: block;
  overflow-wrap: anywhere;
}

.asset-preview-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.asset-preview video,
.asset-preview iframe,
.asset-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

.asset-preview video {
  aspect-ratio: 16 / 9;
  max-height: 420px;
}

.asset-preview iframe {
  min-height: 360px;
  background: var(--field-bg);
}

.asset-preview img {
  max-height: 360px;
  object-fit: contain;
  background: var(--field-bg);
}

.asset-list-summary {
  color: var(--muted);
  font-size: 13px;
}

.asset-card code,
.asset-playback-status {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 7px;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.asset-playback-status {
  background: var(--surface-tint);
}

.asset-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 96px;
}

.asset-card.selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.lesson-asset-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lesson-asset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lesson-asset-head div {
  min-width: 0;
}

.lesson-asset-head strong,
.lesson-asset-head span {
  display: block;
  overflow-wrap: anywhere;
}

.lesson-asset-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.lesson-asset-preview video,
.lesson-asset-preview iframe,
.lesson-asset-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
}

.lesson-asset-preview video {
  aspect-ratio: 16 / 9;
  max-height: 260px;
  background: #000;
}

.lesson-asset-preview iframe {
  min-height: 260px;
}

.lesson-asset-preview img {
  max-height: 260px;
  object-fit: contain;
}

.asset-warning,
.compact-preview-placeholder {
  padding: 9px 10px;
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.1);
  color: var(--text);
  font-size: 13px;
}

.asset-warning.bad {
  border-color: rgba(220, 38, 38, 0.32);
  background: rgba(220, 38, 38, 0.1);
}

.video-compat {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.upload-form {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-tint);
}

.lesson-player-root {
  margin-top: 18px;
}

.lesson-player {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.lesson-player-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.lesson-nav-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--field-bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.lesson-nav-item.active {
  border-color: var(--blue);
  background: var(--surface-tint);
  box-shadow: inset 3px 0 0 var(--blue);
}

.lesson-nav-item span {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.lesson-nav-item small {
  color: var(--muted);
}

.lesson-player-main {
  min-width: 0;
}

.lesson-player-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.completion-box {
  min-width: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.completion-box strong,
.completion-box span {
  display: block;
}

.completion-box span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.media-frame {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

.media-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 58vh;
  background: #000;
}

.pdf-frame {
  background: var(--surface-soft);
}

.pdf-frame iframe {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  background: #fff;
}

.pdf-viewer-shell {
  display: grid;
  gap: 10px;
  width: 100%;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.pdf-toolbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.pdf-canvas-wrap {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.pdf-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-quiet);
}

.pdf-fallback {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--muted);
}

.tracking-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--muted);
  font-size: 13px;
}

.video-warning,
.video-fallback {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(180, 107, 0, 0.26);
  border-radius: 8px;
  background: rgba(180, 107, 0, 0.09);
  color: var(--amber);
}

.video-fallback {
  margin-top: 10px;
}

.video-fallback span {
  color: var(--muted);
  line-height: 1.45;
}

.video-fallback .file-link {
  width: fit-content;
}

.video-control-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow-x: auto;
}

.video-speed-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.video-speed-group .active {
  border-color: var(--blue);
  background: var(--surface-tint);
  color: var(--blue-dark);
  box-shadow: 0 0 0 3px rgba(36, 94, 245, 0.09);
}

.player-text {
  margin-top: 12px;
  color: var(--text);
  white-space: pre-wrap;
}

.file-download-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.file-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-top: 8px;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-quiet);
}

.employee-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.employee-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.employee-summary strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}

.employee-summary span {
  color: var(--muted);
  font-size: 13px;
}

.invite-list {
  display: grid;
  gap: 10px;
}

.invite-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-quiet);
}

.invite-row code {
  display: block;
  max-width: 760px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--surface-tint);
  color: #344054;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  background: #eef2f7;
  color: #475467;
  white-space: nowrap;
}

.quality.good { background: #e8f8f1; color: #08734f; }
.quality.warn { background: #fff4df; color: #9a5b00; }
.quality.good { background: rgba(20, 150, 111, 0.14); color: var(--green); }
.quality.warn { background: rgba(180, 107, 0, 0.14); color: var(--amber); }
.quality.mid { background: var(--surface-tint); color: var(--blue-dark); }
.quality.muted { background: #eef2f7; color: #475467; }

.media-report-stack {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

.next-action {
  max-width: 240px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.integrity-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  max-width: 280px;
}

.integrity-chip {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(180, 107, 0, 0.14);
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.integrity-chip.high {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
}

.integrity-chip.low,
.integrity-chip.muted {
  background: var(--surface-tint);
  color: var(--muted);
}

.backup-panel {
  margin-top: 16px;
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.backup-grid > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.backup-grid strong {
  font-size: 18px;
}

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

.backup-paths {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.backup-paths code {
  display: block;
  padding: 8px;
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.partner-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--glass-strong), var(--surface-tint));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.muted-card {
  background: var(--surface-soft);
}

.form, .dialog-form, .ai-console {
  display: grid;
  gap: 12px;
}

.form-grid, .template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 750;
  color: #344054;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--field-bg);
  color: var(--text);
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(19, 34, 56, 0.02);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 94, 245, 0.12);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

textarea.font-small { font-size: 14px; }
textarea.font-large { font-size: 19px; }

.checkbox-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  font-weight: 600;
}

.checkbox-row input { width: auto; }

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

dialog {
  width: min(680px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

dialog.wide-dialog {
  width: min(980px, calc(100vw - 24px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.dialog-section-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.assign-course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.assign-users-list {
  display: grid;
  gap: 8px;
  max-height: min(360px, 45vh);
  overflow: auto;
  padding-right: 2px;
}

.assign-user-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
  cursor: pointer;
}

.assign-user-row input {
  width: 18px;
  height: 18px;
}

.assign-user-row strong,
.assign-user-row small {
  display: block;
}

.assign-user-row small {
  margin-top: 2px;
  color: var(--muted);
}

.ok { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--red); }

.invite-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(36, 94, 245, 0.18), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(11, 159, 154, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--surface-soft));
}

.invite-card {
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.invite-brand {
  margin-bottom: 18px;
}

.invite-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.invite-details div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.invite-details strong,
.invite-details span {
  display: block;
}

.invite-details strong {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.lesson-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-content: start;
}

.assessment-strip {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.assessment-pill {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assessment-pill span,
.assessment-pill small {
  color: var(--muted);
  font-size: 12px;
}

.assessment-question-seed {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.lesson-assessments {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.assessment-runtime-list {
  display: grid;
  gap: 10px;
}

.assessment-launch-card,
.assessment-attempt,
.assessment-result,
.assessment-report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  min-width: 0;
}

.assessment-launch-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.assessment-launch-card p {
  margin-bottom: 0;
}

.assessment-attempt {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.assessment-attempt-head,
.assessment-question,
.assessment-result,
.answer-review {
  display: grid;
  gap: 12px;
}

.answer-options {
  display: grid;
  gap: 10px;
}

.answer-option {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--text);
  padding: 12px;
  cursor: pointer;
}

.answer-option.selected {
  border-color: var(--blue);
  background: var(--surface-tint);
  box-shadow: 0 0 0 3px rgba(36, 94, 245, 0.1);
}

.scale-options {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.scale-options .answer-option {
  grid-template-columns: 1fr;
  place-items: center;
  text-align: center;
}

.assessment-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  background: linear-gradient(180deg, transparent, var(--glass-strong) 30%);
}

.assessment-result h2 {
  font-size: 42px;
  margin-bottom: 0;
}

.assessment-result.passed {
  border-color: rgba(20, 150, 111, 0.34);
}

.assessment-result.failed {
  border-color: rgba(180, 107, 0, 0.34);
}

.answer-review-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.answer-review-row.ok {
  border-color: rgba(20, 150, 111, 0.24);
}

.answer-review-row.warn {
  border-color: rgba(180, 107, 0, 0.24);
}

.assessment-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.assessment-report-card {
  display: grid;
  gap: 14px;
}

.assessment-report-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.assessment-report-metrics div {
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.assessment-report-metrics strong {
  display: block;
  font-size: 20px;
}

.assessment-report-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.detail-button {
  display: flex;
  margin-top: 8px;
}

.assignment-detail-body {
  display: grid;
  gap: 14px;
}

.assignment-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
}

.assignment-detail-grid section,
.assignment-detail-body > section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assignment-detail-grid h3,
.assignment-detail-body h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.compact-checks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-empty {
  padding: 10px;
}

.detail-flag-list,
.lesson-detail-list {
  display: grid;
  gap: 8px;
}

.detail-flag {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(180, 107, 0, 0.2);
  border-radius: 8px;
  background: rgba(180, 107, 0, 0.08);
}

.detail-flag.high {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(220, 38, 38, 0.08);
}

.detail-flag strong {
  font-size: 13px;
}

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

.lesson-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.75fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
}

.lesson-detail-row h4 {
  margin: 8px 0 4px;
  font-size: 15px;
}

.lesson-detail-row p {
  color: var(--muted);
  font-size: 13px;
}

.lesson-detail-metrics {
  display: grid;
  justify-items: start;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.manage-question-list,
.question-risk-list {
  display: grid;
  gap: 10px;
}

.manage-question-row,
.question-risk-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.question-risk-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.manage-question-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--blue-dark);
  font-weight: 850;
}

.option-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.option-preview span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--field-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.manage-question-actions {
  justify-content: flex-end;
}

.question-risk-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar,
  .sidebar,
  .assistant-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root {
    --glass: #ffffff;
    --glass-strong: #ffffff;
  }

  :root[data-theme="dark"] {
    --glass: #121e31;
    --glass-strong: #121e31;
  }
}

@media (max-width: 1260px) {
  .builder-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .assistant-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-library-grid,
  .partner-grid {
    grid-template-columns: 1fr;
  }

  .library-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    padding: 14px;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 14px;
  }

  .app-shell.sidebar-collapsed .brand {
    display: flex;
    justify-items: initial;
    gap: 12px;
    padding: 10px;
  }

  .app-shell.sidebar-collapsed .brand-copy {
    display: block;
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 128px;
    text-align: center;
  }

  .app-shell.sidebar-collapsed .nav-item {
    display: flex;
    min-height: 44px;
    padding: 10px 13px;
  }

  .app-shell.sidebar-collapsed .nav-icon {
    width: 22px;
    height: 22px;
    background: transparent;
  }

  .app-shell.sidebar-collapsed .nav-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .hero-grid,
  .hero-panel,
  .learner-layout,
  .assignment-detail-grid,
  .lesson-detail-row,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .course-list-panel {
    position: static;
  }

  .builder-layout {
    grid-template-columns: 1fr;
  }

  .lesson-player-sidebar {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  .lesson-nav-item {
    flex: 0 0 min(280px, 82vw);
    scroll-snap-align: start;
  }
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .main {
    padding: 12px;
  }

  .topbar {
    margin-bottom: 14px;
    padding: 14px;
  }

  .topbar,
  .panel-head,
  .editor-course-head,
  .partner-hero,
  .library-hero {
    display: grid;
  }

  .top-actions,
  .button-row,
  .hero-actions {
    justify-content: stretch;
  }

  .top-actions > *,
  .button-row > *,
  .hero-actions > * {
    width: 100%;
  }

  .primary,
  .secondary,
  .compact-text {
    min-height: 44px;
    white-space: normal;
  }

  h1 {
    font-size: 24px;
  }

  .hero-content h2 {
    font-size: 27px;
  }

  .hero-panel {
    min-height: auto;
    padding: 18px;
  }

  .side-stack,
  .feature-grid,
  .asset-toolbar,
  .media-usage-card,
  .library-toolbar,
  .library-stats,
  .library-meta-grid,
  .partner-rules,
  .report-metrics,
  .check-grid,
  .employee-summary,
  .invite-details,
  .form-grid,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .invite-row {
    display: grid;
  }

  .lesson-card,
  .asset-card,
  .file-download-card,
  .library-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .lesson-card .badge,
  .asset-card .badge {
    grid-column: 2;
  }

  .asset-actions {
    grid-column: 2;
    align-items: stretch;
    width: 100%;
  }

  .asset-preview-head {
    display: grid;
  }

  .lesson-asset-head {
    display: grid;
  }

  .asset-preview iframe {
    min-height: 300px;
  }

  .lesson-asset-preview iframe {
    min-height: 220px;
  }

  .library-card {
    grid-template-columns: 1fr;
  }

  .library-card-cover {
    min-height: 96px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .library-hero-actions,
  .library-card-actions {
    justify-content: stretch;
  }

  .library-hero-actions > *,
  .library-card-actions > * {
    width: 100%;
  }

  .phone {
    min-height: auto;
    border-width: 0;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
  }

  .phone-shell {
    justify-items: stretch;
  }

  .phone-card {
    margin: 10px;
  }

  .student-workspace {
    padding: 16px;
  }

  .lesson-player,
  .lesson-player-head,
  .assessment-launch-card,
  .assessment-report-grid,
  .manage-question-row,
  .question-risk-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .assessment-report-metrics,
  .scale-options {
    grid-template-columns: 1fr;
  }

  .assessment-nav {
    display: grid;
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 -16px -16px;
    padding: 10px 16px 12px;
    border-top: 1px solid var(--line);
    background: var(--glass-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .preview-banner {
    display: grid;
  }

  .lesson-actions,
  .manage-question-actions,
  .question-risk-metrics {
    justify-content: stretch;
    justify-items: stretch;
  }

  .completion-box {
    min-width: 0;
  }

  .dialog-actions {
    display: grid;
  }

  .lesson-player {
    padding: 12px;
    gap: 12px;
  }

  .lesson-player-sidebar {
    margin: -2px -2px 0;
    padding: 2px 2px 6px;
  }

  .lesson-player-head {
    margin-bottom: 10px;
  }

  .media-frame video {
    max-height: 46vh;
  }

  .pdf-frame iframe,
  .pdf-canvas-wrap {
    max-height: 68vh;
  }

  .pdf-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pdf-toolbar span {
    grid-column: 1 / -1;
  }

  dialog {
    width: min(100vw - 16px, 680px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
    overflow: auto;
  }
}

@media (max-width: 440px) {
  .sidebar {
    overflow: hidden;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    gap: 6px;
  }

  .nav-item {
    min-width: 0;
    white-space: normal;
  }

  .panel,
  .student-workspace,
  .metric-card,
  .feature-card,
  .partner-card,
  .library-card-body {
    padding: 14px;
  }

  .lesson-player {
    margin-left: -2px;
    margin-right: -2px;
  }

  .lesson-nav-item {
    flex-basis: 78vw;
  }

  .lesson-player-head h2 {
    font-size: 19px;
  }

  .media-frame {
    margin-left: -8px;
    margin-right: -8px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .pdf-frame iframe {
    height: 62vh;
  }

  .hero-card {
    padding: 14px;
  }

  .circle-progress {
    width: 132px;
  }

  .circle-progress span {
    width: 92px;
    font-size: 24px;
  }
}
