:root {
  color-scheme: light;
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-2: #eef3ff;
  --text: #15233a;
  --muted: #68758c;
  --line: rgba(55, 78, 117, 0.13);
  --blue: #4d7cff;
  --purple: #8864f6;
  --coral: #ff6d67;
  --amber: #f2a722;
  --green: #14b88b;
  --cyan: #15a9d8;
  --pink: #e95ca9;
  --primary: var(--blue);
  --secondary: var(--purple);
  --primary-soft: #e6edff;
  --success: #11a97e;
  --danger: #e54d5e;
  --shadow: 0 20px 55px rgba(66, 91, 137, 0.12);
  --sidebar: 260px;
  --topbar: 70px;
  --radius: 18px;
  --sans: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body[data-role="project"] {
  --primary: var(--green);
  --secondary: var(--cyan);
  --primary-soft: #ddf8ef;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151c22;
  --surface: #1e2831;
  --surface-2: #25313c;
  --text: #eef4f8;
  --muted: #a8b4bf;
  --line: rgba(228, 237, 244, 0.12);
  --primary-soft: #293756;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.26);
}

:root[data-theme="dark"] body[data-role="project"] {
  --primary-soft: #203f38;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 4%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 28rem),
    var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 10px;
  top: 10px;
  padding: 9px 12px;
  color: white;
  background: var(--primary);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.system-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  padding-top: var(--topbar);
}

.system-sidebar {
  position: fixed;
  z-index: 50;
  inset: var(--topbar) auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.system-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  border-radius: 13px 13px 13px 5px;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 25%, transparent);
  font-size: 18px;
  font-weight: 800;
}

.system-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.system-brand strong {
  font-size: 14px;
  font-weight: 800;
}

.system-brand small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.role-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 3px 14px;
  padding: 9px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.role-pill i {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
}

.system-nav {
  display: grid;
  gap: 5px;
}

.system-nav button {
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  padding: 10px 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
}

.system-nav button > span {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
}

.system-nav button b {
  color: inherit;
  font-size: 13px;
}

.system-nav button small {
  color: var(--muted);
  font-size: 10px;
}

.system-nav button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.system-nav button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.system-nav button.active > span {
  color: white;
  background: var(--primary);
}

.sidebar-status {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 12px;
}

.sidebar-status span {
  font-size: 10px;
}

.sidebar-status strong {
  color: var(--primary);
  font-size: 12px;
}

.switch-role {
  margin-top: 9px;
  padding: 10px;
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line));
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.system-content {
  grid-column: 2;
  min-width: 0;
}

.system-topbar {
  position: sticky;
  z-index: 40;
  top: var(--topbar);
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 44px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

body[data-role] .topbar {
  z-index: 70;
}

body[data-role] .brand {
  color: var(--ink);
  text-decoration: none;
}

body[data-role] .search-trigger {
  min-width: 0;
}

.context-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.menu-button {
  display: none;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.page-identity {
  display: grid;
  gap: 2px;
}

.page-identity small {
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.page-identity strong {
  font-size: 15px;
}

.system-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-actions a,
.system-actions button {
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
}

#systemView {
  width: min(1320px, 100%);
  min-height: calc(100vh - var(--topbar));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px);
}

.system-page {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.page-heading small,
.section-label {
  display: block;
  margin-bottom: 7px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.page-heading h1,
.section-heading h2 {
  margin: 0;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.page-heading h1 {
  font-size: clamp(30px, 4vw, 46px);
}

.page-heading p,
.section-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.primary-action,
.secondary-action,
.quiet-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.primary-action {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: 0;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 23%, transparent);
}

.secondary-action {
  color: var(--primary);
  background: var(--primary-soft);
  border: 0;
}

.quiet-action {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.dashboard-hero {
  position: relative;
  min-height: 310px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: center;
  gap: 38px;
  padding: clamp(28px, 5vw, 52px);
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  top: -150px;
  right: -80px;
  border: 40px solid color-mix(in srgb, var(--secondary) 10%, transparent);
  border-radius: 50%;
}

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

.hero-copy small {
  color: var(--primary);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.hero-copy h1 {
  max-width: 720px;
  margin: 12px 0 13px;
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.05em;
}

.hero-copy p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.hero-progress {
  display: grid;
  justify-items: center;
  gap: 13px;
}

.system-ring {
  width: 174px;
  height: 174px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) var(--progress), color-mix(in srgb, var(--primary) 12%, var(--surface)) 0);
  border-radius: 50%;
  box-shadow: 0 16px 36px color-mix(in srgb, var(--primary) 17%, transparent);
}

.system-ring > div {
  width: 126px;
  height: 126px;
  display: grid;
  place-content: center;
  gap: 4px;
  background: var(--surface);
  border-radius: 50%;
  text-align: center;
}

.system-ring strong {
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
}

.system-ring span,
.hero-progress > span {
  color: var(--muted);
  font-size: 11px;
}

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

.mastery-panel {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.8fr);
  gap: 20px;
  padding: 22px;
  background: linear-gradient(145deg, var(--surface), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: var(--radius);
}

.mastery-summary strong {
  display: block;
  margin: 4px 0 6px;
  color: var(--primary);
  font-size: 24px;
}

.mastery-summary p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.mastery-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.mastery-step {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.mastery-step.reached {
  color: var(--primary);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
}

.mastery-step span {
  font-size: 9px;
  font-weight: 850;
}

.mastery-step b {
  margin: 18px 0 5px;
  color: var(--text);
  font-size: 12px;
}

.mastery-step small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.live-metric {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.live-metric > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
}

.live-metric > div {
  display: grid;
  gap: 3px;
}

.live-metric strong {
  color: var(--tone);
  font-size: 18px;
}

.live-metric small {
  color: var(--muted);
  font-size: 10px;
}

.tone-blue { --tone: var(--blue); --tone-soft: #e6edff; }
.tone-purple { --tone: var(--purple); --tone-soft: #eee8ff; }
.tone-coral { --tone: var(--coral); --tone-soft: #ffe8e5; }
.tone-amber { --tone: var(--amber); --tone-soft: #fff2d8; }
.tone-green { --tone: var(--green); --tone-soft: #def8ef; }
.tone-cyan { --tone: var(--cyan); --tone-soft: #def5fd; }
.tone-pink { --tone: var(--pink); --tone-soft: #fde5f2; }

:root[data-theme="dark"] .tone-blue { --tone-soft: #293756; }
:root[data-theme="dark"] .tone-purple { --tone-soft: #362d55; }
:root[data-theme="dark"] .tone-coral { --tone-soft: #4b2e31; }
:root[data-theme="dark"] .tone-amber { --tone-soft: #493c25; }
:root[data-theme="dark"] .tone-green { --tone-soft: #214138; }
:root[data-theme="dark"] .tone-cyan { --tone-soft: #223e49; }
:root[data-theme="dark"] .tone-pink { --tone-soft: #4b2c40; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 16px;
}

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

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

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.next-task {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 17px;
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--surface) 82%, var(--primary-soft)));
  border-radius: 14px;
}

.next-task-index {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--primary);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
}

.next-task h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.next-task p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stage-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 16px;
}

.stage-node {
  display: grid;
  gap: 6px;
  padding: 9px 7px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 9px;
  border: 0;
  cursor: pointer;
  font-size: 10px;
  text-align: center;
}

.stage-node span {
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}

.stage-node b {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-node i {
  height: 4px;
  background: color-mix(in srgb, var(--primary) 15%, var(--line));
  border-radius: 99px;
  overflow: hidden;
}

.stage-node i::before {
  content: "";
  display: block;
  width: var(--stage-progress);
  height: 100%;
  background: var(--primary);
}

.competency-list {
  display: grid;
  gap: 13px;
}

.competency-row {
  display: grid;
  grid-template-columns: 90px 1fr 34px;
  align-items: center;
  gap: 10px;
}

.competency-row span,
.competency-row b {
  font-size: 11px;
}

.competency-row b {
  color: var(--primary);
  text-align: right;
}

.competency-bar {
  height: 7px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 99px;
}

.competency-bar i {
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: inherit;
  transition: width 180ms ease;
}

.section-heading h2 {
  font-size: 21px;
}

.path-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.path-step {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  padding: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
}

.path-step.active {
  border-color: var(--primary);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 12%, transparent);
}

.path-step.complete {
  background: var(--primary-soft);
}

.path-step > span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.path-step b {
  margin: 18px 0 5px;
  font-size: 14px;
}

.path-step small {
  color: var(--muted);
  font-size: 10px;
}

.path-step i {
  height: 4px;
  margin-top: auto;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 99px;
}

.path-step i::before {
  content: "";
  display: block;
  width: var(--stage-progress);
  height: 100%;
  background: var(--primary);
}

.module-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
}

.module-main,
.module-actions {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.module-kicker {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.module-main h2 {
  margin: 10px 0 8px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.module-main > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 22px 0;
}

.concept-grid div {
  padding: 13px;
  background: var(--primary-soft);
  border-radius: 11px;
}

.concept-grid b {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 12px;
}

.concept-grid span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.practice-prompt {
  padding: 16px;
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
}

.practice-prompt small {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.practice-prompt p {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.module-answer {
  width: 100%;
  min-height: 130px;
  margin-top: 13px;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.6;
}

.module-actions h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.module-actions > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.task-checklist {
  display: grid;
  gap: 8px;
}

.task-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  padding: 11px;
  background: var(--surface-2);
  border-radius: 9px;
  cursor: pointer;
}

.task-check input {
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.task-check span {
  font-size: 12px;
  line-height: 1.5;
}

.module-links {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.module-links a {
  padding: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.lab-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
}

.lab-progress,
.scenario-card {
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scenario-list {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.scenario-tab {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
}

.scenario-tab span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 8px;
}

.scenario-tab b {
  font-size: 11px;
}

.scenario-tab.active,
.scenario-tab.solved {
  color: var(--primary);
  background: var(--primary-soft);
}

.scenario-card > small {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.scenario-card h2 {
  margin: 10px 0 8px;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.scenario-context {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.option-grid {
  display: grid;
  gap: 9px;
}

.scenario-option {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
}

.scenario-option span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--surface);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
}

.scenario-option b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}

.scenario-option:hover,
.scenario-option.selected {
  border-color: var(--primary);
}

.scenario-option.correct {
  background: color-mix(in srgb, var(--green) 14%, var(--surface));
  border-color: var(--green);
}

.scenario-option.incorrect {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: var(--danger);
}

.scenario-feedback {
  margin-top: 16px;
  padding: 15px;
  background: var(--primary-soft);
  border-radius: 11px;
}

.scenario-feedback strong {
  color: var(--primary);
  font-size: 14px;
}

.scenario-feedback p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(400px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.studio-mobile-tabs {
  display: none;
}

.studio-form,
.studio-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.studio-form {
  padding: 22px;
}

.form-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.form-progress i {
  grid-column: 1 / 2;
  height: 7px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 99px;
}

.form-progress i::before {
  content: "";
  display: block;
  width: var(--form-progress);
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.form-progress b {
  grid-column: 2;
  grid-row: 1;
  color: var(--primary);
  font-size: 12px;
}

.form-progress span {
  grid-column: 1;
  grid-row: 1;
  color: var(--muted);
  font-size: 11px;
}

.field-list {
  display: grid;
  gap: 13px;
}

.field-list label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.field-list input,
.field-list textarea {
  width: 100%;
  padding: 10px 11px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 400;
}

.field-list textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.55;
}

.field-list input:focus,
.field-list textarea:focus {
  background: var(--surface);
  border-color: var(--primary);
}

.studio-preview {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.preview-toolbar span {
  font-size: 11px;
  font-weight: 750;
}

.preview-document {
  max-height: calc(100vh - 190px);
  min-height: 560px;
  padding: 30px;
  overflow: auto;
}

.preview-document h1 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.preview-document .preview-meta {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 10px;
}

.preview-section {
  margin-top: 22px;
}

.preview-section h2 {
  margin: 0 0 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.preview-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.preview-empty-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
}

.preview-empty-card b {
  color: var(--text);
  font-size: 11px;
}

.preview-empty-card span,
.preview-missing {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.preview-missing {
  margin-top: 10px;
  padding: 9px 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.assessment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}

.question-list,
.assessment-summary {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.assessment-question {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.assessment-question:first-child {
  padding-top: 0;
}

.assessment-question:last-child {
  border-bottom: 0;
}

.assessment-question > span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.assessment-question h3 {
  margin: 7px 0 12px;
  font-size: 15px;
  line-height: 1.5;
}

.answer-list {
  display: grid;
  gap: 6px;
}

.answer-list label {
  display: grid;
  grid-template-columns: 17px 1fr;
  gap: 8px;
  padding: 9px;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.45;
}

.answer-list input {
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.question-result {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.question-result.correct {
  color: var(--green);
}

.question-result.incorrect {
  color: var(--danger);
}

.assessment-summary {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  align-self: start;
  text-align: center;
}

.score-display {
  width: 150px;
  height: 150px;
  display: grid;
  place-content: center;
  gap: 4px;
  margin: 10px auto 18px;
  color: white;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  border-radius: 50%;
  box-shadow: 0 18px 36px color-mix(in srgb, var(--primary) 22%, transparent);
}

.score-display strong {
  font-size: 34px;
}

.score-display span {
  font-size: 10px;
}

.assessment-summary p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.expert-score-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: linear-gradient(145deg, var(--surface), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.expert-score {
  width: 132px;
  height: 132px;
  display: grid;
  place-content: center;
  gap: 4px;
  color: white;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  border-radius: 50%;
  text-align: center;
}

.expert-score strong {
  font-size: 36px;
  line-height: 1;
}

.expert-score span {
  font-size: 9px;
}

.expert-score-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.expert-score-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.expert-progress {
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 99px;
}

.expert-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.expert-level-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.expert-level {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  padding: 15px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.expert-level.reached {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--line));
}

.expert-level > span,
.expert-level > b {
  color: var(--primary);
  font-size: 9px;
  font-weight: 850;
}

.expert-level h3 {
  margin: 20px 0 6px;
  color: var(--text);
  font-size: 15px;
}

.expert-level p {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.expert-level > b {
  margin-top: auto;
}

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

.expert-check span {
  display: grid;
  gap: 4px;
}

.expert-check span b {
  color: var(--primary);
  font-size: 9px;
}

.expert-notes {
  position: sticky;
  top: calc(var(--topbar) * 2 + 18px);
}

.expert-notes h2 {
  margin: 0 0 7px;
  font-size: 17px;
}

.expert-notes > p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.expert-notes textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.6;
}

.expert-note-tip {
  display: grid;
  gap: 5px;
  margin-top: 13px;
  padding: 13px;
  color: var(--muted);
  background: var(--primary-soft);
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.55;
}

.expert-note-tip b {
  color: var(--primary);
}

.knowledge-search {
  padding: 22px;
  background: linear-gradient(145deg, var(--surface), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 17%, var(--line));
  border-radius: var(--radius);
}

.knowledge-search label {
  display: grid;
  gap: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-search input {
  width: 100%;
  padding: 13px 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
}

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

.knowledge-item {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  text-decoration: none;
}

.knowledge-item span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.knowledge-item h3 {
  margin: 15px 0 7px;
  font-size: 15px;
}

.knowledge-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.knowledge-item b {
  margin-top: auto;
  color: var(--primary);
  font-size: 10px;
}

.empty-message {
  grid-column: 1 / -1;
  padding: 30px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}

.system-scrim {
  position: fixed;
  z-index: 45;
  inset: 0;
  background: rgba(12, 19, 28, 0.48);
  border: 0;
}

.system-scrim[hidden],
.toast[hidden] {
  display: none;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  padding: 11px 14px;
  color: white;
  background: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 9px;
}

@media (max-width: 1080px) {
  .dashboard-grid,
  .module-workspace,
  .studio-layout,
  .assessment-layout,
  .expert-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .studio-preview,
  .assessment-summary,
  .expert-notes {
    position: static;
  }

  .preview-document {
    max-height: none;
  }

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

  .mastery-panel {
    grid-template-columns: 1fr;
  }

  .mastery-steps,
  .expert-level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  :root {
    --topbar: 62px;
  }

  .system-shell {
    display: block;
  }

  .system-sidebar {
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .system-sidebar.open {
    transform: none;
  }

  .system-content {
    min-width: 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .system-actions a {
    display: none;
  }

  .context-status {
    font-size: 10px;
  }

  #systemView {
    padding: 20px 14px 60px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 26px 20px;
  }

  .hero-progress {
    grid-template-columns: auto 1fr;
    justify-items: start;
  }

  .system-ring {
    width: 130px;
    height: 130px;
  }

  .system-ring > div {
    width: 94px;
    height: 94px;
  }

  .system-ring strong {
    font-size: 24px;
  }

  .live-metrics,
  .knowledge-grid {
    grid-template-columns: 1fr;
  }

  .next-task {
    grid-template-columns: 42px 1fr;
  }

  .next-task > b {
    grid-column: 2;
  }

  .stage-strip,
  .path-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .concept-grid {
    grid-template-columns: 1fr;
  }

  .lab-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .scenario-tab {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
  }

  .studio-mobile-tabs {
    position: sticky;
    z-index: 30;
    top: calc(var(--topbar) + 8px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
  }

  .studio-mobile-tabs button {
    min-height: 40px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
  }

  .studio-mobile-tabs button.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
  }

  .studio-layout[data-mobile-panel="form"] .studio-preview,
  .studio-layout[data-mobile-panel="preview"] .studio-form {
    display: none;
  }

  .assessment-summary {
    order: -1;
  }
}

@media (max-width: 480px) {
  .hero-progress {
    grid-template-columns: auto 1fr;
    justify-items: start;
  }

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

  .path-overview,
  .scenario-list {
    display: flex;
    gap: 8px;
    padding: 2px 2px 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
  }

  .path-step {
    min-height: 116px;
    flex: 0 0 148px;
    scroll-snap-align: start;
  }

  .scenario-tab {
    min-height: 76px;
    flex: 0 0 142px;
    scroll-snap-align: start;
  }

  .page-heading h1 {
    font-size: 32px;
  }

  .dashboard-hero {
    min-height: 0;
  }

  .system-page {
    gap: 22px;
  }

  .mastery-steps,
  .expert-level-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .expert-score-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .role-formula {
    display: none;
  }
}

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