:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy-950: #071a33;
  --navy-900: #0b2344;
  --navy-800: #12345f;
  --blue-700: #174bb8;
  --blue-600: #2057d4;
  --blue-100: #e9f0ff;
  --teal-700: #0f766e;
  --teal-100: #e6f5f2;
  --amber-700: #9a5a00;
  --amber-100: #fff4dc;
  --red-700: #a12b35;
  --red-100: #fdecee;
  --violet-700: #6246b8;
  --violet-100: #f0ecff;
  --ink-950: #102036;
  --ink-800: #26384f;
  --ink-600: #5e6d82;
  --ink-500: #718097;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --line: #dbe2ea;
  --line-strong: #c6d0dc;
  --shadow-sm: 0 2px 8px rgba(17, 36, 60, 0.06);
  --shadow-md: 0 16px 40px rgba(17, 36, 60, 0.12);
  --shadow-lg: 0 28px 80px rgba(5, 22, 45, 0.24);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --sidebar-width: 264px;
  --topbar-height: 88px;
  --mobile-nav-height: 72px;
}

* { box-sizing: border-box; }
html { min-height: 100%; overflow-x: hidden; background: var(--surface-2); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; margin: 0; overflow-x: hidden; color: var(--ink-950); background: var(--surface-2); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue-700); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-600); }
[hidden] { display: none !important; }

.offline-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 2000;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--amber-100);
  color: var(--amber-700);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid #f1d28e;
}

.screen { min-height: 100vh; min-height: 100dvh; }
.center-screen { display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, var(--navy-950), var(--navy-800)); }
.loader-card { width: min(440px, 92vw); text-align: center; color: white; }
.loader-card h1 { margin: 18px 0 6px; font-size: clamp(28px, 5vw, 42px); }
.loader-card p { color: #c7d6e9; }
.loader-line { height: 3px; margin-top: 28px; overflow: hidden; border-radius: 999px; background: #ffffff20; }
.loader-line span { display: block; width: 40%; height: 100%; background: white; animation: loading 1.2s infinite ease-in-out; }
@keyframes loading { from { transform: translateX(-120%); } to { transform: translateX(350%); } }

.brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, #4d83ff, #0f766e);
  color: white;
  font-size: 34px;
  font-weight: 800;
  box-shadow: 0 18px 40px #0005;
}
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px; font-size: 20px; box-shadow: none; }

.login-screen { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr); background: var(--surface); }
.login-visual {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  background:
    radial-gradient(circle at 25% 25%, #315e9b 0, transparent 35%),
    radial-gradient(circle at 76% 70%, #0f766e80 0, transparent 35%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}
.login-orbit { position: absolute; border: 1px solid #ffffff28; border-radius: 50%; }
.orbit-one { width: 520px; height: 520px; left: 12%; top: 13%; }
.orbit-two { width: 760px; height: 760px; left: -2%; top: -1%; }
.login-graph {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  color: white;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
}
.login-graph span { padding: 14px 16px; border: 1px solid #ffffff35; border-radius: 999px; background: #ffffff0d; text-align: center; backdrop-filter: blur(8px); }
.login-graph i { height: 1px; background: linear-gradient(90deg, #ffffff2b, #6c9fff, #ffffff2b); }
.login-panel-wrap { display: grid; place-items: center; padding: 48px; }
.login-panel { width: min(480px, 100%); }
.login-panel h1 { margin: 10px 0 12px; font-size: clamp(36px, 5vw, 54px); line-height: 1.05; letter-spacing: -1.8px; }
.login-copy { margin: 0 0 32px; color: var(--ink-600); font-size: 17px; }
.privacy-note { margin-top: 20px; color: var(--ink-500); font-size: 12px; }

.eyebrow { color: var(--blue-700); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.field { display: grid; gap: 7px; margin: 16px 0; }
.field > span { color: var(--ink-800); font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-950);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px #2057d41a; }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-3); color: var(--ink-500); }
.password-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.form-error { min-height: 20px; margin-top: 10px; color: var(--red-700); font-size: 13px; font-weight: 700; }

.button, .icon-button, .mentor-avatar {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 750;
  transition: transform .12s, box-shadow .12s, background .12s, opacity .12s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.button.primary { color: white; background: var(--blue-600); box-shadow: 0 8px 20px #2057d42b; }
.button.primary:hover { background: var(--blue-700); }
.button.secondary { color: var(--navy-900); background: var(--surface-3); border: 1px solid var(--line); }
.button.subtle { color: var(--blue-700); background: var(--blue-100); }
.button.danger { color: white; background: var(--red-700); }
.button.warning { color: var(--amber-700); background: var(--amber-100); }
.button.wide { width: 100%; }
.button.compact { min-height: 38px; padding: 8px 13px; font-size: 13px; }
.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-800);
  font-weight: 750;
}
.icon-button:hover { background: var(--surface-3); }

.notice { margin: 16px 0; padding: 14px 16px; border: 1px solid #cddcff; border-left: 4px solid var(--blue-600); border-radius: 10px; background: var(--blue-100); color: var(--ink-800); }
.notice.success { border-color: #b8ded7; border-left-color: var(--teal-700); background: var(--teal-100); }
.notice.warning { border-color: #f0d396; border-left-color: var(--amber-700); background: var(--amber-100); }
.notice.danger { border-color: #efc0c6; border-left-color: var(--red-700); background: var(--red-100); }
.notice:empty { display: none; }

.app-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 700;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  overflow: auto;
  color: white;
  background: linear-gradient(180deg, var(--navy-950), #091f3e 70%, #0b294e);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 18px; }
.sidebar-brand span { color: #9eb4cf; font-size: 12px; letter-spacing: 1.1px; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #c6d4e5;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}
.nav-item:hover { color: white; background: #ffffff0c; }
.nav-item.active { color: white; background: #ffffff16; box-shadow: inset 3px 0 0 #6f9cff; }
.nav-icon { width: 20px; text-align: center; color: #91aed1; font-size: 16px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: #e05e6b; color: white; font-size: 10px; }
.sidebar-bottom { margin-top: auto; padding-top: 22px; }
.identity-card { display: flex; align-items: center; gap: 10px; margin: 15px 5px 0; padding: 12px; border-top: 1px solid #ffffff18; }
.identity-card > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #ffffff15; font-weight: 800; }
.identity-card strong, .identity-card small { display: block; }
.identity-card strong { font-size: 13px; }
.identity-card small { max-width: 150px; overflow: hidden; color: #9eb4cf; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 690; background: #0414279c; backdrop-filter: blur(3px); }

.main-area { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(20px, 4vw, 52px);
  background: #f6f8fbeF;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.page-heading { min-width: 0; }
.page-heading h1 { margin: 3px 0 0; overflow: hidden; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; letter-spacing: -.8px; text-overflow: ellipsis; white-space: nowrap; }
.menu-button { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mentor-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg, var(--blue-600), var(--teal-700)); color: white; box-shadow: 0 8px 20px #2057d42b; font-weight: 850; }
.mentor-avatar span { font-size: 12px; letter-spacing: .4px; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 28px clamp(20px, 4vw, 52px) 64px; }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-intro h2 { margin: 6px 0 4px; font-size: clamp(24px, 3vw, 36px); line-height: 1.15; letter-spacing: -.8px; }
.page-intro p { max-width: 780px; margin: 0; color: var(--ink-600); }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel, .module-card, .stage-card, .resource-card, .belief-card, .journal-card, .review-card, .research-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.metric-card { min-height: 132px; padding: 18px; }
.metric-card .metric-label { color: var(--ink-600); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .8px; }
.metric-card strong { display: block; margin: 9px 0 2px; font-size: 32px; line-height: 1; letter-spacing: -1px; }
.metric-card small { color: var(--ink-500); }
.metric-card.accent { color: white; background: linear-gradient(145deg, var(--navy-900), var(--navy-800)); border-color: transparent; }
.metric-card.accent .metric-label, .metric-card.accent small { color: #c1d2e8; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; margin-top: 18px; }
.panel { padding: 22px; }
.panel h2, .panel h3 { margin-top: 0; }
.next-card { position: relative; overflow: hidden; padding: 28px; color: white; background: linear-gradient(135deg, var(--blue-700), #153a8c 56%, var(--teal-700)); border: 0; }
.next-card::after { content: ""; position: absolute; width: 330px; height: 330px; right: -110px; top: -145px; border: 1px solid #ffffff2b; border-radius: 50%; box-shadow: 0 0 0 45px #ffffff08, 0 0 0 90px #ffffff06; }
.next-card > * { position: relative; z-index: 1; }
.next-card .eyebrow { color: #dbe7ff; }
.next-card h2 { max-width: 780px; margin: 8px 0 8px; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -1.2px; }
.next-card p { max-width: 760px; color: #e3ebf8; }
.next-card .button { margin-top: 12px; color: var(--navy-900); background: white; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 30px 0 12px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.section-heading small { color: var(--ink-500); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-column { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stack { display: grid; gap: 14px; }
.compact-stack { display: grid; gap: 8px; }
.empty-state { padding: 38px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-600); text-align: center; background: #ffffff70; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink-800); font-size: 18px; }

.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-600), var(--teal-700)); }
.phase-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, 2fr) auto; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.phase-row:last-child { border-bottom: 0; }
.phase-row strong { font-size: 13px; }
.phase-row small { color: var(--ink-500); }

.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 200px 200px auto; gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.module-list { display: grid; gap: 12px; }
.module-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px 20px; }
.module-card:hover { border-color: #b9c7da; box-shadow: 0 7px 24px rgba(17,36,60,.09); }
.module-card h3 { margin: 5px 0 4px; font-size: 18px; }
.module-card p { margin: 0 0 12px; color: var(--ink-600); }
.module-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.module-action { display: grid; justify-items: end; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-600);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.badge.available, .badge.in_progress, .badge.awaiting_evaluation { color: var(--blue-700); background: var(--blue-100); }
.badge.provisional_mastery, .badge.review_due { color: var(--amber-700); background: var(--amber-100); }
.badge.durable_mastery, .badge.published { color: var(--teal-700); background: var(--teal-100); }
.badge.remediation { color: var(--red-700); background: var(--red-100); }
.badge.planned, .badge.locked { color: var(--ink-500); background: var(--surface-3); }
.badge.draft { color: var(--violet-700); background: var(--violet-100); }
.score-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-600); font-size: 11px; }
.score-chip b { color: var(--ink-800); }

.module-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, white, #f2f6fb); }
.module-hero h2 { max-width: 920px; margin: 7px 0 8px; font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -1.3px; }
.module-hero p { max-width: 860px; color: var(--ink-600); }
.module-hero-side { min-width: 210px; display: grid; align-content: start; gap: 10px; }
.module-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; margin-top: 20px; }
.module-main { min-width: 0; }
.module-aside { position: sticky; top: calc(var(--topbar-height) + 18px); display: grid; gap: 14px; }
.outcomes-list { margin: 10px 0 0; padding-left: 20px; }
.outcomes-list li { margin: 8px 0; }

.stage-card { overflow: hidden; margin-bottom: 14px; }
.stage-header { display: flex; align-items: flex-start; gap: 13px; padding: 19px 20px; cursor: pointer; }
.stage-number { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--ink-600); font-size: 12px; font-weight: 850; }
.stage-header-text { min-width: 0; flex: 1; }
.stage-header h3 { margin: 1px 0 3px; font-size: 18px; }
.stage-purpose { color: var(--ink-500); font-size: 12px; }
.stage-required { color: var(--red-700); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.stage-toggle { margin-left: auto; color: var(--ink-500); }
.stage-body { padding: 0 20px 22px 67px; }
.stage-body > p { margin-top: 0; color: var(--ink-800); white-space: pre-line; }
.stage-card.collapsed .stage-body { display: none; }
.stage-response { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.stage-response label { display: block; margin-bottom: 7px; color: var(--ink-800); font-size: 13px; font-weight: 750; }
.response-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; }
.save-state { color: var(--ink-500); font-size: 11px; }
.save-state.saved { color: var(--teal-700); }

.visual-block { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.visual-block h4 { margin: 0 0 14px; }
.visual-items.cards, .visual-items.comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.visual-item { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.visual-item strong { display: block; margin-bottom: 4px; }
.visual-item span { color: var(--ink-600); font-size: 12px; }
.visual-items.timeline { position: relative; display: grid; gap: 10px; padding-left: 25px; }
.visual-items.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line-strong); }
.visual-items.timeline .visual-item { position: relative; }
.visual-items.timeline .visual-item::before { content: ""; position: absolute; left: -24px; top: 18px; width: 9px; height: 9px; border: 3px solid var(--blue-600); border-radius: 50%; background: white; }
.visual-items.process, .visual-items.nested { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.visual-items.process .visual-item, .visual-items.nested .visual-item { flex: 1 1 145px; position: relative; }
.visual-items.process .visual-item:not(:last-child)::after { content: "→"; position: absolute; right: -9px; top: 50%; transform: translate(50%, -50%); z-index: 2; color: var(--blue-600); font-weight: 800; }
.connection-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.connection-list span { padding: 5px 8px; border-radius: 999px; background: var(--blue-100); color: var(--blue-700); font-size: 10px; }

.classification-grid { display: grid; gap: 11px; }
.classification-row { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(150px, .6fr) minmax(220px, 1.4fr); gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.classification-row strong { padding-top: 10px; }
.classification-row textarea { min-height: 72px; }

.evaluation-card { border: 1px solid var(--line); border-radius: var(--radius-md); background: white; overflow: hidden; }
.evaluation-header { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.evaluation-score { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal-700) var(--score-angle, 0deg), var(--surface-3) 0); position: relative; }
.evaluation-score::before { content: ""; position: absolute; width: 56px; height: 56px; border-radius: 50%; background: white; }
.evaluation-score strong { position: relative; font-size: 19px; }
.evaluation-body { padding: 20px; }
.dimension-row { display: grid; grid-template-columns: 160px 1fr 42px; gap: 10px; align-items: center; margin: 9px 0; font-size: 12px; }
.insight-list { margin: 8px 0; padding-left: 20px; }
.insight-list li { margin: 6px 0; }
.misconception-item { margin: 9px 0; padding: 12px; border-left: 3px solid var(--red-700); background: var(--red-100); border-radius: 7px; }
.misconception-item strong { display: block; }

.mentor-summary { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: linear-gradient(145deg, var(--navy-950), var(--navy-800)); color: white; }
.mentor-summary .eyebrow { color: #bcd0eb; }
.mentor-summary p { color: #d8e3f1; }
.mentor-summary .button { width: 100%; background: white; color: var(--navy-900); }
.confidence-control { display: grid; gap: 7px; }
.confidence-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-600); }
input[type="range"] { min-height: auto; padding: 0; border: 0; box-shadow: none; accent-color: var(--blue-600); }

.review-card { padding: 20px; }
.review-card h3 { margin: 6px 0; }
.review-question { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.review-question strong { display: block; margin-bottom: 8px; }
.review-question textarea { background: white; }
.retrieval-warning { padding: 14px; border-radius: 10px; background: var(--amber-100); color: var(--amber-700); font-weight: 650; }

.graph-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; min-height: 620px; }
.graph-controls { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.graph-controls button { width: 100%; margin: 4px 0; }
.graph-canvas { position: relative; overflow: auto; min-height: 620px; border: 1px solid var(--line); border-radius: var(--radius-md); background: radial-gradient(circle at 50% 10%, #ffffff, #eff3f8); }
.graph-canvas svg { display: block; min-width: 900px; width: 100%; min-height: 620px; }
.graph-node { cursor: pointer; }
.graph-node rect { fill: white; stroke: var(--line-strong); stroke-width: 1.2; rx: 10; }
.graph-node text { fill: var(--ink-800); font-size: 11px; font-weight: 700; pointer-events: none; }
.graph-node.mastered rect { stroke: var(--teal-700); fill: var(--teal-100); }
.graph-node.developing rect { stroke: var(--blue-600); fill: var(--blue-100); }
.graph-node.remediation rect { stroke: var(--red-700); fill: var(--red-100); }
.graph-edge { stroke: #a8b8ca; stroke-width: 1.2; fill: none; marker-end: url(#arrow); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.resource-card, .belief-card, .journal-card, .research-card { padding: 18px; }
.resource-card h3, .belief-card h3, .journal-card h3, .research-card h3 { margin: 7px 0; font-size: 17px; }
.resource-card p, .belief-card p, .journal-card p, .research-card p { color: var(--ink-600); }
.resource-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.resource-card .button { margin-top: 12px; }
.belief-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.belief-diff > div { padding: 12px; border-radius: 9px; background: var(--surface-2); }
.belief-diff small { display: block; margin-bottom: 5px; color: var(--ink-500); font-weight: 800; text-transform: uppercase; }

.flashcard-shell { max-width: 760px; margin: 0 auto; }
.flashcard { min-height: 370px; display: grid; place-items: center; padding: 36px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow-md); text-align: center; cursor: pointer; perspective: 1000px; }
.flashcard .card-side { max-width: 620px; }
.flashcard h2 { font-size: clamp(27px, 5vw, 42px); line-height: 1.2; }
.flashcard p { color: var(--ink-600); font-size: 18px; }
.rating-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rating-row button { min-height: 52px; }

.weekly-hero { padding: 28px; border-radius: var(--radius-lg); color: white; background: linear-gradient(145deg, var(--navy-900), var(--violet-700)); }
.weekly-hero h2 { margin: 7px 0; font-size: 32px; }
.weekly-columns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 16px; }
.weekly-block { padding: 18px; border: 1px solid #ffffff2b; border-radius: 13px; background: #ffffff0d; }
.weekly-block h3 { margin-top: 0; }
.weekly-block ul { padding-left: 19px; }

.studio-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; gap: 18px; }
.studio-list { position: sticky; top: calc(var(--topbar-height) + 18px); max-height: calc(100vh - 130px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.studio-list-header { position: sticky; top: 0; z-index: 2; padding: 14px; background: white; border-bottom: 1px solid var(--line); }
.studio-module-item { width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; cursor: pointer; }
.studio-module-item:hover, .studio-module-item.active { background: var(--blue-100); }
.studio-module-item strong, .studio-module-item small { display: block; }
.studio-module-item small { color: var(--ink-500); }
.studio-editor { min-width: 0; }
.editor-section { margin-bottom: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.editor-section h3 { margin-top: 0; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-stage { margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.editor-stage-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.editor-resource { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 10px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.quality-report { padding: 17px; border-radius: 12px; background: var(--surface-2); }
.quality-score { font-size: 30px; font-weight: 850; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.settings-card h3 { margin-top: 0; }
.usage-table, .data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.usage-table th, .usage-table td, .data-table th, .data-table td { padding: 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.usage-table th, .data-table th { color: var(--ink-600); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; }
.file-input { position: relative; overflow: hidden; }
.file-input input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.mentor-drawer, .more-drawer {
  position: fixed;
  z-index: 1200;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform .22s ease, visibility 0s linear .22s;
  background: white;
  box-shadow: var(--shadow-lg);
}
.mentor-drawer.open, .more-drawer.open { transform: translateX(0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
.mentor-drawer { width: min(520px, 100vw); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.mentor-drawer > header, .more-drawer > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 18px 14px; border-bottom: 1px solid var(--line); }
.mentor-drawer h2, .more-drawer h2 { margin: 3px 0 0; }
.mentor-context { padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-600); font-size: 12px; }
.mentor-messages { min-height: 0; overflow: auto; padding: 18px; }
.message { max-width: 88%; margin: 9px 0; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; }
.message.user { margin-left: auto; background: var(--blue-600); color: white; border-bottom-right-radius: 4px; }
.message.assistant { margin-right: auto; background: var(--surface-3); color: var(--ink-800); border-bottom-left-radius: 4px; }
.message.assistant p:first-child { margin-top: 0; }
.message.assistant p:last-child { margin-bottom: 0; }
.message-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.message-meta a { font-size: 10px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-500); animation: pulse 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .2s; }.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .2; transform: translateY(-3px); } }
.mentor-composer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
.composer-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; }
.composer-row textarea { min-height: 50px; max-height: 160px; }
.research-toggle { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--ink-600); font-size: 11px; }
.research-toggle input { width: auto; min-height: auto; }
.drawer-scrim { position: fixed; inset: 0; z-index: 1150; background: #05162c88; backdrop-filter: blur(2px); }
.more-drawer { width: min(420px, 92vw); padding-bottom: env(safe-area-inset-bottom); }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px; }
.more-grid button { min-height: 88px; display: grid; place-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink-800); font-weight: 700; }
.more-grid button span { font-size: 20px; color: var(--blue-700); }

.mobile-nav { display: none; }
.mobile-badge { position: absolute; top: 5px; right: calc(50% - 22px); min-width: 17px; height: 17px; display: grid; place-items: center; border-radius: 999px; background: var(--red-700); color: white; font-size: 9px; }

.search-overlay { position: fixed; inset: 0; z-index: 1500; padding: max(24px, env(safe-area-inset-top)) 18px 18px; background: #05162cd9; backdrop-filter: blur(9px); }
.search-dialog { width: min(900px, 100%); max-height: 90vh; margin: 0 auto; overflow: hidden; border-radius: 18px; background: white; box-shadow: var(--shadow-lg); }
.search-dialog header { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.search-dialog input { min-height: 50px; border: 0; font-size: 18px; box-shadow: none; }
.search-results { max-height: calc(90vh - 80px); overflow: auto; padding: 16px; }
.search-group { margin-bottom: 20px; }
.search-result { display: block; width: 100%; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; cursor: pointer; }
.search-result:hover { background: var(--surface-2); }
.search-result strong, .search-result small { display: block; }
.search-result small { color: var(--ink-500); }

.modal-shell { position: fixed; inset: 0; z-index: 1600; display: grid; place-items: center; padding: 18px; }
.modal-scrim { position: absolute; inset: 0; background: #05162ca8; backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border-radius: 18px; background: white; box-shadow: var(--shadow-lg); }
.modal-card > header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 0; }
.modal-body { overflow: auto; padding: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

.toast-region { position: fixed; z-index: 2200; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 380px; padding: 13px 16px; border-radius: 11px; background: var(--navy-950); color: white; box-shadow: var(--shadow-md); animation: toast-in .2s ease; }
.toast.error { background: var(--red-700); }
.toast.success { background: var(--teal-700); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.skeleton { min-height: 90px; border-radius: var(--radius-md); background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .module-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .studio-layout { grid-template-columns: 280px minmax(0, 1fr); }
}

@media (max-width: 920px) {
  :root { --topbar-height: 72px; }
  .app-shell { display: block; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .22s ease;
    width: min(310px, 86vw);
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); }
  .topbar { min-height: var(--topbar-height); padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
  .menu-button { display: grid; }
  .page-heading .eyebrow { display: none; }
  .page-heading h1 { font-size: 24px; }
  .search-button { display: none; }
  .content { padding: 20px 14px 36px; }
  .filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter-bar > :first-child { grid-column: 1 / -1; }
  .mobile-nav {
    position: fixed;
    z-index: 900;
    inset: auto 0 0 0;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: #ffffffef;
    backdrop-filter: blur(16px);
  }
  .mobile-nav button { position: relative; display: grid; place-items: center; gap: 1px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-500); }
  .mobile-nav button > span { font-size: 18px; line-height: 1; }
  .mobile-nav button small { font-size: 10px; font-weight: 750; }
  .mobile-nav button.active { color: var(--blue-700); background: var(--blue-100); }
  .module-layout { grid-template-columns: 1fr; }
  .module-aside { position: static; }
  .module-hero { grid-template-columns: 1fr; }
  .module-hero-side { grid-template-columns: 1fr 1fr; }
  .graph-shell, .studio-layout { grid-template-columns: 1fr; }
  .graph-controls, .studio-list { position: static; max-height: none; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .login-screen { display: block; background: linear-gradient(180deg, var(--navy-950) 0 28%, white 28%); }
  .login-visual { min-height: 28vh; }
  .login-orbit { display: none; }
  .login-graph { left: 5%; right: 5%; grid-template-columns: 1fr 18px 1fr 18px 1fr 18px 1fr; font-size: 8px; }
  .login-graph span { padding: 9px 4px; }
  .login-panel-wrap { margin-top: -24px; padding: 0 18px calc(28px + env(safe-area-inset-bottom)); position: relative; }
  .login-panel { padding: 24px 20px; border-radius: 22px; background: white; box-shadow: var(--shadow-lg); }
  .login-panel h1 { font-size: 36px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 112px; padding: 14px; }
  .metric-card strong { font-size: 26px; }
  .page-intro { display: block; }
  .page-intro .action-row { margin-top: 13px; }
  .two-column, .three-column, .weekly-columns { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .module-card { grid-template-columns: 1fr; padding: 16px; }
  .module-action { justify-items: stretch; }
  .module-action .button { width: 100%; }
  .module-hero { padding: 20px; }
  .module-hero h2 { font-size: 31px; }
  .module-hero-side { grid-template-columns: 1fr; }
  .stage-header { padding: 16px; }
  .stage-body { padding: 0 16px 18px; }
  .stage-number { display: none; }
  .visual-items.process .visual-item:not(:last-child)::after { display: none; }
  .classification-row { grid-template-columns: 1fr; }
  .belief-diff { grid-template-columns: 1fr; }
  .dimension-row { grid-template-columns: 120px 1fr 36px; }
  .editor-grid, .editor-resource { grid-template-columns: 1fr; }
  .mentor-drawer { width: 100vw; }
  .mentor-drawer > header { padding-top: calc(10px + env(safe-area-inset-top)); }
  .mentor-messages { padding: 14px; }
  .message { max-width: 94%; }
  .composer-row { grid-template-columns: minmax(0, 1fr) auto; }
  .composer-row .voice-button { display: none; }
  .rating-row { grid-template-columns: 1fr 1fr; }
  .flashcard { min-height: 320px; padding: 24px; }
  .toast-region { left: 12px; right: 12px; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px); }
  .toast { max-width: none; }
  .topbar-actions .button { display: none; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .phase-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .phase-row .progress-track { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .page-heading h1 { max-width: 190px; }
  .more-grid { grid-template-columns: 1fr; }
  .more-grid button { min-height: 58px; grid-template-columns: 35px 1fr; justify-items: start; padding: 10px 14px; }
}

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

/* v6 application details */
.centered-actions { justify-content: center; margin-top: 16px; }
.compact-card { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; text-align: left; cursor: pointer; }
.concept-summary strong,
.concept-summary small { display: block; }
.concept-summary small { margin-top: 4px; color: var(--ink-500); }
.compact-resource { display: grid; gap: 5px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.compact-resource:last-of-type { border-bottom: 0; }
.compact-resource strong, .compact-resource small { display: block; }
.compact-resource small { color: var(--ink-500); }
.self-end { align-self: end; margin-bottom: 16px; }
.checkbox-field input { width: auto; min-height: auto; justify-self: start; }
.journal-filter { grid-template-columns: minmax(240px, 1fr) auto; }
.graph-meta { fill: var(--ink-500) !important; font-size: 9px !important; font-weight: 500 !important; }
.graph-node.remediation rect { stroke: var(--red-700); fill: var(--red-100); }
.editor-outcome { align-items: end; }
.is-offline .mentor-avatar { filter: grayscale(1); opacity: .65; }
.stage-card:focus-within { border-color: #a7bbd6; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
@media (display-mode: standalone) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
}
@media (max-width: 680px) {
  .journal-filter { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .modal-shell { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .modal-card { max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 15px; }
  .resource-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .phase-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .phase-row .progress-track { grid-column: 1 / -1; grid-row: 2; width: 100%; }
}
.phase-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.phase-row > div:first-child small { display: block; }

/* ========================================================================== */
/* Frontier AI Companion v6.1 learning-experience refinements                  */
/* ========================================================================== */

/* Login continuity */
.password-field {
  position: relative;
  display: block;
}
.password-field input { padding-right: 78px; }
.password-field .icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 62px;
  min-height: 36px;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-700);
  font-size: 12px;
}

/* Shared tab and compact-control patterns */
.view-tabs,
.compact-tabs {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar,
.compact-tabs::-webkit-scrollbar { display: none; }
.view-tabs button,
.compact-tabs button {
  min-height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.view-tabs button:hover,
.compact-tabs button:hover { color: var(--ink-950); background: var(--surface-3); }
.view-tabs button.active,
.compact-tabs button.active { color: var(--blue-700); background: var(--blue-100); }
.compact-field { min-width: 150px; margin: 0; }
.compact-field input,
.compact-field select { min-height: 40px; }
.compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* First-use dashboard */
.first-run-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
  margin: 0 0 22px;
  padding: clamp(26px, 4vw, 48px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 86% 12%, #6fa4ff30 0, transparent 34%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
  color: white;
  box-shadow: var(--shadow-md);
}
.first-run-hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -130px;
  bottom: -170px;
  border: 1px solid #ffffff24;
  border-radius: 50%;
}
.first-run-hero > * { position: relative; z-index: 1; }
.first-run-hero .eyebrow { color: #9fc0ff; }
.first-run-hero h2 {
  max-width: 820px;
  margin: 12px 0 14px;
  font-size: clamp(31px, 4vw, 50px);
  line-height: 1.06;
  letter-spacing: -1.5px;
}
.first-run-hero p { max-width: 720px; margin: 0; color: #cfdbeb; font-size: 17px; }
.first-run-hero aside {
  padding: 22px;
  border: 1px solid #ffffff20;
  border-radius: 18px;
  background: #ffffff0d;
  backdrop-filter: blur(12px);
}
.first-run-steps { display: grid; gap: 13px; margin: 18px 0 0; padding: 0; list-style: none; }
.first-run-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; align-items: center; }
.first-run-steps b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #ffffff17; color: #a9c7ff; }
.first-run-steps span { color: #edf3fb; font-size: 14px; font-weight: 650; }
.first-run-support .panel { min-height: 168px; }
.first-run-support .panel h3 { margin: 10px 0 7px; }
.time-band {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 18px 0;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
}
.time-band span { display: inline-flex; align-items: center; gap: 7px; }
.time-band span::before { content: "◷"; opacity: .75; }
.mentor-state-card { align-self: stretch; }
.mentor-state-card h3 { margin: 9px 0 8px; }

/* Curriculum modes and context */
.curriculum-filter-bar { grid-template-columns: minmax(220px, 1.4fr) minmax(190px, .8fr) minmax(160px, .65fr) auto; }
.curriculum-context {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}
.curriculum-context:empty { display: none; }
.curriculum-context .notice { margin: 0; }
.author-ready {
  border-color: #b7d9d3 !important;
  background: linear-gradient(135deg, #ffffff, var(--teal-100));
}

/* Guided module mode */
.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.module-toolbar .view-tabs,
.module-toolbar .compact-tabs { margin: 0; box-shadow: none; }
.module-toolbar p { margin: 0; color: var(--ink-500); font-size: 12px; text-align: right; }
.stage-rail {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 16px;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  scrollbar-width: thin;
}
.stage-rail button {
  position: relative;
  min-width: 38px;
  min-height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-500);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.stage-rail button:hover { border-color: var(--blue-600); color: var(--blue-700); }
.stage-rail button.active { border-color: var(--blue-600); background: var(--blue-600); color: white; box-shadow: 0 5px 14px #2057d42f; }
.stage-rail button.complete { border-color: #abd6cf; background: var(--teal-100); color: var(--teal-700); }
.stage-rail button.complete.active { background: var(--teal-700); color: white; }
.guided-stage-shell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.guided-stage-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 750;
}
.guided-stage-shell .stage-card { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.guided-stage-shell .stage-header { border-radius: 0; }
.guided-response-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.guided-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.stage-optional {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.full-stage-map { display: grid; gap: 14px; }
.full-stage-map .stage-card { margin: 0; }

/* Mentor context, prompts and sources */
.mentor-context-summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #cad8ea;
  border-radius: 10px;
  background: #f3f7fd;
  color: var(--ink-800);
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
}
.mentor-context-summary::after { content: "⌄"; color: var(--blue-700); font-size: 18px; }
.mentor-context-summary[aria-expanded="true"]::after { content: "⌃"; }
.mentor-context-detail {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink-600);
  font-size: 12px;
}
.mentor-context-detail strong { color: var(--ink-950); }
.mentor-prompt-bar {
  display: flex;
  gap: 7px;
  padding: 10px 14px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  scrollbar-width: none;
}
.mentor-prompt-bar::-webkit-scrollbar { display: none; }
.mentor-prompt-bar button {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: white;
  color: var(--blue-700);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}
.mentor-prompt-bar button:hover { border-color: var(--blue-600); background: var(--blue-100); }
.source-stack { display: grid; gap: 8px; margin-top: 10px; }
.source-card {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
}
.source-card strong { color: var(--ink-950); }
.source-card small { color: var(--ink-500); }

/* Knowledge graph interaction */
.graph-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, .55fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.graph-search { margin: 0; }
.graph-zoom { display: flex; align-items: center; gap: 5px; min-height: 44px; }
.graph-zoom strong { min-width: 48px; color: var(--ink-600); font-size: 12px; text-align: center; }
.interactive-graph {
  position: relative;
  min-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle, #cdd7e3 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfe, #f5f8fb);
  background-size: 22px 22px, auto;
  cursor: grab;
}
.interactive-graph:active { cursor: grabbing; }
.graph-scaled {
  min-width: 820px;
  min-height: 530px;
  transform-origin: top left;
  transition: transform .14s ease;
}
.graph-detail {
  display: grid;
  gap: 12px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.graph-detail h3 { margin: 0; }
.graph-detail .compact-stack { gap: 7px; }
.graph-node.selected rect { stroke: var(--blue-600); stroke-width: 3; filter: drop-shadow(0 5px 8px #2057d438); }

/* In-app resource workspace */
.resource-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 18px;
  align-items: start;
}
.resource-reading-surface,
.resource-sidebar {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.resource-reading-surface { overflow: hidden; }
.resource-reading-surface > header { padding: clamp(20px, 3vw, 34px); border-bottom: 1px solid var(--line); }
.resource-reading-surface > header h2 { margin: 9px 0 8px; font-size: clamp(27px, 3vw, 40px); line-height: 1.12; }
.resource-reading-surface > header p { margin: 0; color: var(--ink-600); }
.resource-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--navy-950);
}
.resource-embed iframe,
.resource-embed video { width: 100%; height: 100%; border: 0; }
.resource-details { display: grid; gap: 16px; padding: clamp(20px, 3vw, 32px); }
.resource-details h3 { margin: 0 0 6px; }
.resource-facts {
  display: grid;
  grid-template-columns: minmax(74px, .55fr) minmax(0, 1.45fr);
  gap: 10px 16px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.resource-facts dt {
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.resource-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: break-word;
  word-break: normal;
}
.resource-sidebar { position: sticky; top: calc(var(--topbar-height) + 18px); padding: 20px; }
.resource-sidebar h3 { margin: 0 0 8px; }
.resource-sidebar textarea { min-height: 132px; }
.resource-sidebar .field { margin: 14px 0; }
.resource-sidebar .action-row { display: grid; grid-template-columns: 1fr; }

/* Curriculum Studio: simple and advanced modes */
.build-next-card,
.build-next-empty {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.build-next-empty { padding: clamp(28px, 5vw, 58px); text-align: center; }
.build-next-empty h2 { margin: 10px 0 8px; }
.build-next-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f9fbff, #eef4ff);
}
.build-next-header h2 { margin: 10px 0 7px; font-size: clamp(28px, 3vw, 42px); }
.build-next-header p { max-width: 780px; margin: 0; color: var(--ink-600); }
.build-next-header > div:last-child { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 7px; }
.build-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.build-flow > * {
  position: relative;
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 18px 8px 42px;
  color: var(--ink-500);
}
.build-flow > *::before {
  content: attr(data-step);
  position: absolute;
  left: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink-600);
  font-weight: 850;
}
.build-flow > *:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 34px;
  transform: translateY(-50%);
  background: var(--line);
}
.build-flow .active { color: var(--ink-950); }
.build-flow .active::before { background: var(--blue-600); color: white; }
.studio-preview { display: grid; gap: 16px; padding: clamp(20px, 3vw, 34px); }
.studio-preview h3 { margin: 0; }
.stage-preview-list { display: grid; gap: 10px; }
.stage-preview-list article {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.stage-preview-list article > b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); }
.stage-preview-list article small { color: var(--ink-500); }
.studio-fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.studio-fieldset legend { padding: 0 8px; color: var(--ink-800); font-weight: 800; }

/* Research, weekly synthesis and settings */
.research-list,
.weekly-list { display: grid; gap: 12px; }
.weekly-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.weekly-card h3 { margin: 0 0 6px; }
.setting-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}
.setting-toggle input { width: 20px; min-height: 20px; margin: 0; }
.setting-toggle strong,
.setting-toggle small { display: block; }
.setting-toggle small { margin-top: 2px; color: var(--ink-500); }
.setting-toggle.disabled { cursor: not-allowed; opacity: .65; }
.advanced-settings > summary { cursor: pointer; font-weight: 800; }
.advanced-settings-body { padding-top: 18px; }

/* Responsive v6.1 */
@media (max-width: 1040px) {
  .curriculum-filter-bar { grid-template-columns: 1fr 1fr; }
  .curriculum-filter-bar > :first-child { grid-column: 1 / -1; }
  .resource-workspace { grid-template-columns: 1fr; }
  .resource-sidebar { position: static; }
  .graph-toolbar { grid-template-columns: 1fr 1fr; }
  .graph-zoom { grid-column: 1 / -1; justify-content: flex-end; }
  .build-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
  .build-flow > *:nth-child(2)::after { display: none; }
}

@media (max-width: 900px) {
  .first-run-hero { grid-template-columns: 1fr; }
  .first-run-hero aside { max-width: 620px; }
  .module-toolbar { align-items: flex-start; flex-direction: column; }
  .module-toolbar p { text-align: left; }
}

@media (max-width: 680px) {
  .password-field input { padding-right: 68px; }
  .password-field .icon-button { min-width: 54px; font-size: 11px; }
  .view-tabs,
  .compact-tabs { width: 100%; }
  .view-tabs button,
  .compact-tabs button { flex: 1 0 auto; }
  .first-run-hero { padding: 24px 20px; border-radius: 18px; }
  .first-run-hero h2 { font-size: 32px; }
  .first-run-hero p { font-size: 15px; }
  .first-run-hero aside { padding: 16px; }
  .first-run-support .panel { min-height: auto; }
  .curriculum-filter-bar { grid-template-columns: 1fr; }
  .curriculum-filter-bar > :first-child { grid-column: auto; }
  .module-toolbar { padding: 8px; }
  .module-toolbar .view-tabs { width: 100%; }
  .stage-rail { margin-inline: -2px; border-radius: 10px; }
  .guided-stage-meta { padding: 13px 15px; }
  .guided-nav { padding: 13px 15px calc(15px + env(safe-area-inset-bottom)); }
  .guided-nav .button { flex: 1; min-width: 0; }
  .guided-response-actions { align-items: stretch; flex-direction: column; }
  .guided-response-actions .action-row { width: 100%; }
  .guided-response-actions .button { flex: 1; }
  .mentor-context-detail { font-size: 11px; }
  .mentor-prompt-bar { padding-inline: 10px; }
  .graph-toolbar { grid-template-columns: 1fr; }
  .graph-zoom { grid-column: auto; justify-content: flex-start; overflow-x: auto; }
  .interactive-graph { min-height: 450px; }
  .graph-scaled { min-width: 720px; min-height: 460px; }
  .resource-reading-surface,
  .resource-sidebar { border-radius: 16px; }
  .resource-facts { grid-template-columns: 72px minmax(0, 1fr); }
  .resource-sidebar { padding: 16px; }
  .build-next-header { align-items: flex-start; flex-direction: column; padding: 22px 18px; }
  .build-flow { grid-template-columns: 1fr; padding: 12px 18px; }
  .build-flow > * { min-height: 56px; padding-left: 42px; }
  .build-flow > *::after { display: none; }
  .stage-preview-list article { grid-template-columns: 34px minmax(0, 1fr); }
  .stage-preview-list article > :last-child { grid-column: 2; }
  .studio-preview { padding: 18px; }
  .compact-metrics { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .guided-nav { flex-direction: column-reverse; }
  .first-run-hero h2 { font-size: 29px; }
  .first-run-steps li { grid-template-columns: 30px minmax(0, 1fr); }
  .first-run-steps b { width: 30px; height: 30px; }
  .time-band { display: grid; }
}

/* v6.1 late interaction corrections */
.mentor-context-detail { display: none; }
.mentor-context-detail.open { display: grid; }
.stage-rail button small { display: none; }
.stage-rail button {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
}
.stage-rail button span { font-size: 12px; }
.build-flow > * { grid-template-columns: 30px minmax(0, 1fr); padding-left: 10px; }
.build-flow > *::before { display: none; }
.build-flow > * > b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink-600);
}
.build-flow > *.active > b,
.build-flow > *.complete > b { background: var(--blue-600); color: white; }
.stage-preview-list { margin: 0; padding: 0; list-style: none; }
.stage-preview-list li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.stage-preview-list li > b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); }
.stage-preview-list li strong,
.stage-preview-list li span { display: block; }
.stage-preview-list li span { color: var(--ink-500); font-size: 12px; }

@media (max-width: 680px) {
  .stage-rail button small { display: none; }
  .stage-rail button { min-width: 38px; }
  .build-flow > * { grid-template-columns: 30px minmax(0, 1fr); }
}
