:root {
  --ink: #07152f;
  --ink-soft: #3e4c65;
  --muted: #6c788c;
  --line: #dce3ec;
  --line-strong: #c8d3e1;
  --surface: #ffffff;
  --surface-soft: #f5f8fb;
  --surface-blue: #edf5ff;
  --blue: #075dd8;
  --blue-dark: #0444a4;
  --teal: #08afa5;
  --green: #198754;
  --amber: #d88900;
  --rose: #ce4a65;
  --shadow: 0 18px 50px rgba(24, 47, 82, 0.12);
  --topbar-height: 72px;
  --rail-width: 64px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: fixed;
  z-index: 80;
  inset: 0 0 auto 0;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(148px, 220px) minmax(390px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 0 22px 0 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  width: 138px;
  height: 58px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand img {
  width: 118px;
  height: 56px;
  object-fit: contain;
}

.topnav {
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 28px;
}

.nav-link {
  position: relative;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  transform: scaleX(1);
}

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

.search-box {
  width: clamp(210px, 20vw, 320px);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px 0 12px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  transition: border-color 160ms ease, background 160ms ease;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--blue);
}

.search-box svg {
  width: 17px;
  height: 17px;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search-box kbd {
  padding: 2px 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
}

.icon-button,
.profile-button,
.rail-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.icon-button:hover {
  color: var(--blue);
  background: var(--surface-blue);
  border-color: #b8d5fb;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 6px;
  height: 6px;
  background: var(--rose);
  border: 1px solid white;
  border-radius: 50%;
}

.profile-button {
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.rail {
  position: fixed;
  z-index: 70;
  inset: var(--topbar-height) auto 0 0;
  width: var(--rail-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.rail-item {
  width: 42px;
  height: 42px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.rail-item:hover,
.rail-item.is-active {
  color: var(--blue);
  background: var(--surface-blue);
}

.rail-item svg {
  width: 19px;
  height: 19px;
}

.rail-spacer {
  flex: 1;
}

.main-content {
  padding-top: var(--topbar-height);
  padding-left: var(--rail-width);
  overflow: hidden;
}

.hero {
  position: relative;
  min-height: 590px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 64px clamp(36px, 6vw, 96px);
  background: var(--ink);
  border-bottom: 1px solid var(--line);
  isolation: isolate;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 14, 33, 0.68);
}

.hero-copy {
  z-index: 2;
  max-width: 650px;
}

.eyebrow,
.section-kicker {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.hero .eyebrow {
  color: #66e1d8;
}

.eyebrow > span {
  width: 24px;
  height: 3px;
  background: var(--teal);
}

.hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(64px, 7vw, 104px);
  line-height: 0.95;
  font-weight: 850;
}

.hero-copy > p {
  max-width: 590px;
  margin: 26px 0 0;
  color: #d7e0ed;
  font-size: 20px;
  line-height: 1.55;
}

.hero .button-secondary {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.48);
}

.hero .button-secondary:hover {
  color: var(--ink);
  background: #fff;
  border-color: #fff;
}

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

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  box-shadow: 0 8px 20px rgba(7, 93, 216, 0.2);
}

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

.button-secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
}

.button-secondary:hover,
.button-quiet:hover {
  color: var(--blue);
  border-color: #9fc7f6;
  background: var(--surface-blue);
}

.button-quiet {
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
}

.hero-meta {
  display: flex;
  gap: 28px;
  margin-top: 38px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.hero-meta > div {
  min-width: 96px;
}

.hero-meta strong,
.hero-meta span {
  display: block;
}

.hero-meta strong {
  color: #fff;
  font-size: 21px;
  line-height: 1;
}

.hero-meta span {
  margin-top: 7px;
  color: #c2cede;
  font-size: 11px;
}

.hero-visual {
  position: absolute;
  z-index: -2;
  inset: 0;
  overflow: hidden;
}

.hero-visual img {
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: blur(2.4px) saturate(0.82) contrast(1.04);
  transform: scale(1.015);
}

.daily-strip {
  min-height: 90px;
  display: grid;
  grid-template-columns: auto minmax(230px, 1fr) minmax(240px, 420px) auto;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(28px, 5vw, 80px);
  color: #fff;
  background: var(--ink);
}

.daily-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.daily-icon svg {
  width: 20px;
}

.daily-copy span,
.daily-copy strong {
  display: block;
}

.daily-copy span {
  color: #9fb0c9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.daily-copy strong {
  margin-top: 2px;
  font-size: 14px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #c5cfdd;
  font-size: 11px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.daily-strip .button-quiet {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.section-block {
  padding: 74px clamp(28px, 6vw, 96px);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 36px;
  margin-bottom: 30px;
}

.section-heading h2,
.panel-heading h2,
.league-band h2 {
  margin: 6px 0 0;
  font-size: 30px;
  line-height: 1.18;
}

.section-heading > p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.module-card {
  position: relative;
  min-height: 265px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.module-card:hover {
  z-index: 1;
  background: #fbfdff;
  box-shadow: 0 12px 32px rgba(20, 44, 78, 0.09);
  transform: translateY(-2px);
}

.module-card.featured {
  background: var(--ink);
  color: #fff;
}

.module-card.featured:hover {
  background: #0b1d3d;
}

.module-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.module-icon svg {
  width: 21px;
  height: 21px;
}

.icon-ai { color: #fff; background: var(--blue); }
.icon-apg { color: #924254; background: #fcebf0; }
.icon-cases { color: #08776e; background: #e5f8f5; }
.icon-review { color: #925a00; background: #fff4db; }
.icon-calc { color: #2258a5; background: #eaf2ff; }
.icon-flash { color: #845400; background: #fff0c7; }
.icon-questions { color: #287146; background: #e5f5ec; }
.icon-league { color: #4e526c; background: #edeef5; }

.status-pill,
.module-count {
  position: absolute;
  top: 27px;
  right: 23px;
  font-size: 10px;
  font-weight: 800;
}

.status-pill {
  padding: 4px 8px;
  color: #92f3e8;
  background: rgba(8, 175, 165, 0.13);
  border: 1px solid rgba(146, 243, 232, 0.25);
  border-radius: 999px;
  text-transform: uppercase;
}

.module-count {
  color: var(--muted);
}

.module-card h3 {
  margin: 26px 0 8px;
  font-size: 18px;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.module-card.featured p {
  color: #afbdd1;
}

.card-action {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 18px 0 0;
  color: var(--blue-dark);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.module-card.featured .card-action {
  color: #fff;
}

.card-action svg {
  width: 15px;
  transition: transform 160ms ease;
}

.card-action:hover svg {
  transform: translateX(3px);
}

.empty-search {
  padding: 40px;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--line);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  gap: 28px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.study-panel,
.news-panel {
  min-width: 0;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 23px;
}

.panel-heading > svg {
  color: var(--teal);
}

.study-list {
  display: grid;
}

.study-item {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.study-item:last-child {
  border-bottom: 0;
}

.study-item:hover strong {
  color: var(--blue);
}

.study-status {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.study-status svg {
  width: 14px;
}

.study-status.done {
  color: var(--green);
  background: #eaf7ef;
  border-color: #bde2ca;
}

.study-status.current {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.study-item strong,
.study-item small {
  display: block;
}

.study-item strong {
  font-size: 13px;
}

.study-item small,
.study-item time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.news-lead {
  display: block;
  padding: 22px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.news-source {
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.news-lead strong {
  display: block;
  margin: 9px 0 18px;
  font-size: 16px;
  line-height: 1.45;
}

.news-lead > span:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.news-lead svg,
.news-links svg {
  width: 14px;
}

.news-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
}

.news-links a:last-child {
  border-bottom: 0;
}

.news-links a:hover,
.news-lead:hover strong {
  color: var(--blue);
}

.league-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  margin: 72px clamp(28px, 6vw, 96px);
  padding: 34px 38px;
  border: 1px solid var(--line-strong);
}

.league-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
}

.league-mark svg {
  width: 29px;
  height: 29px;
}

.league-band h2 {
  font-size: 24px;
}

.league-band p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.footer {
  min-height: 120px;
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 30px clamp(28px, 6vw, 96px);
  background: var(--ink);
  color: #fff;
}

.footer img {
  width: 105px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.08));
}

.footer p {
  margin: 0;
  color: #a9b7ca;
  font-size: 11px;
}

.footer > span {
  color: #a9b7ca;
  font-size: 11px;
}

.ai-launcher {
  position: fixed;
  z-index: 75;
  right: 22px;
  bottom: 22px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(7, 93, 216, 0.3);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.ai-launcher svg {
  width: 17px;
}

.ai-panel {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.ai-panel.is-open {
  transform: translateX(0);
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--line);
}

.ai-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ai-identity > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
}

.ai-identity svg {
  width: 18px;
}

.ai-identity strong,
.ai-identity small {
  display: block;
}

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

.ai-context {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  color: var(--blue-dark);
  background: var(--surface-blue);
  border-bottom: 1px solid #d8e7f9;
  font-size: 11px;
  font-weight: 700;
}

.ai-context svg {
  width: 14px;
}

.ai-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 20px;
}

.message {
  max-width: 86%;
  margin-bottom: 14px;
}

.message p {
  margin: 0;
  padding: 11px 13px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.55;
}

.message.assistant p {
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.message.user {
  margin-left: auto;
}

.message.user p {
  color: #fff;
  background: var(--blue);
}

.suggestion-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 20px 10px;
}

.suggestion-row button {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.ai-form {
  display: grid;
  grid-template-columns: 1fr 38px;
  align-items: end;
  gap: 8px;
  margin: 0 16px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.ai-form:focus-within {
  border-color: var(--blue);
}

.ai-form textarea {
  min-height: 38px;
  max-height: 110px;
  resize: none;
  padding: 8px;
  border: 0;
  outline: 0;
}

.send-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  cursor: pointer;
}

.send-button svg {
  width: 17px;
}

.ai-disclaimer {
  margin: 9px 18px 14px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  background: rgba(5, 16, 36, 0.42);
}

.home-view[hidden],
.environment-view[hidden] {
  display: none;
}

.environment-view {
  min-height: calc(100vh - var(--topbar-height));
  background: var(--surface-soft);
}

.environment-header {
  position: relative;
  z-index: 45;
  top: auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(28px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.environment-header .button[hidden] {
  display: none;
}

.environment-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.environment-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
}

.environment-icon svg {
  width: 21px;
  height: 21px;
}

.environment-heading > div:last-child {
  min-width: 0;
}

.environment-heading > div:last-child > span {
  display: block;
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.environment-heading h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.environment-content {
  min-height: calc(100vh - var(--topbar-height) - 88px);
  padding: 34px clamp(28px, 5vw, 72px) 64px;
}

.environment-content > * {
  width: 100%;
  max-width: 1220px;
  margin-right: auto;
  margin-left: auto;
}

.ai-environment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
}

.ai-environment-main {
  min-width: 0;
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto auto auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.environment-context {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  color: var(--blue-dark);
  background: var(--surface-blue);
  border-bottom: 1px solid #d8e7f9;
  font-size: 11px;
  font-weight: 750;
}

.environment-context svg {
  width: 15px;
  height: 15px;
}

.environment-ai-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 28px;
}

.environment-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 24px 14px;
}

.environment-suggestions button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}

.environment-suggestions button:hover {
  color: var(--blue);
  background: var(--surface-blue);
  border-color: #b8d5fb;
}

.environment-ai-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: end;
  gap: 10px;
  margin: 0 24px;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.environment-ai-form:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 93, 216, 0.09);
}

.environment-ai-form textarea {
  min-height: 48px;
  max-height: 140px;
  padding: 10px;
  resize: vertical;
  background: transparent;
  border: 0;
  outline: 0;
}

.ai-environment-main > .ai-disclaimer {
  margin: 10px 24px 16px;
}

.ai-environment-aside {
  align-self: start;
}

.tnia-workspace {
  min-height: 610px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 860px !important;
  padding: 48px 0 20px;
}

.tnia-intro {
  max-width: 560px;
  margin: auto auto 34px;
  text-align: center;
}

.tnia-intro.has-conversation {
  margin-top: 0;
}

.tnia-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: var(--blue);
  background: #e8f2ff;
  border: 1px solid #c7def9;
  border-radius: 50%;
}

.tnia-mark svg {
  width: 27px;
  height: 27px;
}

.tnia-intro h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.tnia-intro p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tnia-messages {
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  padding: 0 4px 12px;
}

.tnia-messages:empty {
  display: none;
}

.tnia-messages .message {
  max-width: 78%;
}

.tnia-composer {
  width: 100%;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(21, 44, 76, 0.1);
}

.tnia-composer:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 93, 216, 0.09), 0 14px 38px rgba(21, 44, 76, 0.1);
}

.tnia-composer textarea {
  width: 100%;
  min-height: 82px;
  max-height: 180px;
  padding: 5px 6px;
  resize: vertical;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
  line-height: 1.5;
}

.tnia-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.tnia-composer-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.tnia-composer-footer > span svg {
  width: 14px;
  height: 14px;
}

.tnia-disclaimer {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.workspace-dialog {
  width: min(960px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  max-width: none;
  max-height: none;
  padding: 0;
  background: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace-dialog::backdrop {
  background: rgba(5, 16, 36, 0.54);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.dialog-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px 14px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-title-wrap,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
}

.dialog-icon svg {
  width: 20px;
}

.dialog-title-wrap span:not(.dialog-icon) {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.dialog-title-wrap h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.dialog-content {
  min-height: 0;
  overflow-y: auto;
  padding: 28px;
  background: var(--surface-soft);
}

.academic-library {
  display: grid;
  gap: 26px;
}

.academic-navigator {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(24, 47, 82, 0.07);
}

.academic-navigator::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 3px;
  background: var(--teal);
}

.academic-navigator-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 22px 24px 20px;
  background: #fbfdff;
  border-bottom: 1px solid var(--line);
}

.academic-navigator-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 7px 16px rgba(7, 93, 216, 0.2);
}

.academic-navigator-icon svg {
  width: 19px;
  height: 19px;
}

.academic-navigator-header div {
  min-width: 0;
}

.academic-navigator-header span:not(.academic-navigator-icon),
.academic-navigator-header strong {
  display: block;
}

.academic-navigator-header span:not(.academic-navigator-icon) {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.academic-navigator-header strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 17px;
}

.academic-control-group {
  min-width: 0;
}

.academic-stage {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  animation: academic-stage-in 220ms ease-out both;
}

.academic-control-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.academic-control-label b {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 50%;
  font-size: 9px;
}

.academic-periods {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  overflow: visible;
}

.academic-navigator > .academic-control-group {
  overflow: visible;
  padding: 24px;
}

.academic-period-button,
.academic-subject-button,
.academic-week-button {
  min-width: 0;
  min-height: 38px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.academic-period-button {
  position: relative;
  width: 100%;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 17px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 5px 15px rgba(24, 47, 82, 0.05);
}

.academic-period-number {
  margin-bottom: auto;
  color: var(--blue);
  font-size: 26px;
  font-weight: 850;
  line-height: 1;
}

.academic-period-name {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.academic-period-button svg {
  position: absolute;
  top: 17px;
  right: 15px;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.academic-subject-button {
  min-height: 64px;
  padding: 0 14px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(24, 47, 82, 0.04);
}

.academic-week-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  justify-self: center;
  padding: 0;
  border-radius: 50%;
}

.academic-period-button:hover,
.academic-subject-button:hover,
.academic-week-button:hover {
  color: var(--blue-dark);
  border-color: #9dbfe5;
  background: var(--surface-blue);
  transform: translateY(-1px);
}

.academic-period-button.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 10px 22px rgba(7, 93, 216, 0.2);
  transform: translateY(-2px);
}

.academic-period-button.is-active .academic-period-number,
.academic-period-button.is-active .academic-period-name,
.academic-period-button.is-active svg {
  color: #fff;
}

.academic-subject-button.is-active {
  color: #fff;
  background: #078f88;
  border-color: #078f88;
  box-shadow: 0 4px 10px rgba(8, 143, 136, 0.18);
}

.academic-week-button.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 5px 12px rgba(7, 21, 47, 0.18);
}

.academic-subject-stage {
  background: #fbfdff;
}

.academic-subjects {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  background: transparent;
}

.academic-subject-button:first-child {
  grid-column: auto;
}

.academic-weeks {
  display: grid;
  grid-template-columns: repeat(17, minmax(42px, 1fr));
  gap: 8px;
}

.academic-week-stage {
  background: #fff;
}

@keyframes academic-stage-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.academic-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 24px 24px;
  padding: 18px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}

.academic-empty svg {
  width: 22px;
  flex: 0 0 22px;
  color: var(--blue);
}

.academic-empty strong,
.academic-empty span {
  display: block;
}

.academic-empty strong {
  color: var(--ink);
  font-size: 12px;
}

.academic-empty span {
  margin-top: 3px;
  font-size: 10px;
}

.academic-material-body {
  min-width: 0;
  animation: academic-stage-in 260ms ease-out both;
}

.material-empty {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(24, 47, 82, 0.06);
}

.material-empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 9px 20px rgba(7, 93, 216, 0.2);
}

.material-empty-icon svg {
  width: 24px;
  height: 24px;
}

.material-empty-context {
  margin-top: 20px;
  color: #078f88;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.material-empty h3 {
  margin: 8px 0 0;
  font-size: 23px;
}

.material-empty p {
  max-width: 480px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-empty {
  min-height: 190px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 26px 4px 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.panel-empty > svg {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 9px;
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 50%;
}

.panel-empty strong,
.panel-empty span {
  display: block;
}

.panel-empty strong {
  color: var(--ink);
  font-size: 13px;
}

.panel-empty span {
  margin-top: 4px;
  font-size: 11px;
}

.academic-material-body > .workspace-grid {
  gap: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(24, 47, 82, 0.06);
}

.academic-material-body .workspace-main,
.academic-material-body .workspace-aside {
  background: transparent;
  border: 0;
  border-radius: 0;
}

.academic-material-body .workspace-main {
  padding: 30px;
}

.academic-material-body .workspace-aside {
  padding: 30px 24px;
  background: #f9fbfd;
  border-left: 1px solid var(--line);
}

.academic-material-body .workspace-main h3,
.academic-material-body .tool-surface h3 {
  font-size: 23px;
}

.academic-material-body .tool-surface {
  padding: 6px 0 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
}

.workspace-main,
.workspace-aside,
.tool-surface {
  min-width: 0;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workspace-main h3,
.tool-surface h3 {
  margin: 0;
  font-size: 20px;
}

.workspace-main > p,
.tool-surface > p {
  margin: 8px 0 0;
  color: var(--muted);
}

.workspace-aside h4 {
  margin: 0 0 14px;
  font-size: 13px;
}

.workspace-note {
  margin-top: 18px;
  padding: 12px;
  color: #536177;
  background: var(--surface-blue);
  border-left: 3px solid var(--blue);
  font-size: 11px;
}

.topic-list,
.review-list,
.league-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.topic-item,
.review-item,
.league-item {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.topic-item {
  grid-template-columns: 36px 1fr auto;
}

.topic-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  background: var(--surface-blue);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
}

.topic-item strong,
.topic-item small {
  display: block;
}

.topic-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.topic-item button,
.mini-button {
  min-height: 32px;
  padding: 0 11px;
  color: var(--blue-dark);
  background: var(--surface-blue);
  border: 1px solid #cfe2f8;
  border-radius: 5px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.academic-material-body .topic-list,
.academic-material-body .review-list {
  gap: 0;
  border-top: 1px solid var(--line);
}

.academic-material-body .topic-item,
.academic-material-body .review-item {
  padding: 16px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  transition: background 160ms ease;
}

.academic-material-body .topic-item:hover,
.academic-material-body .review-item:hover {
  background: #f9fbfd;
}

.academic-material-body .topic-item:last-child,
.academic-material-body .review-item:last-child {
  border-bottom: 0;
}

.academic-material-body .topic-number {
  border-radius: 50%;
}

.academic-material-body .topic-item button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.academic-material-body .topic-item button:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.academic-material-body .topic-item button svg {
  width: 16px;
  height: 16px;
}

.metric-stack {
  display: grid;
  gap: 10px;
}

.metric-box {
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

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

.metric-box strong {
  font-size: 19px;
}

.metric-box span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.academic-material-body .metric-stack {
  gap: 0;
}

.academic-material-body .metric-box {
  padding: 15px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.academic-material-body .metric-box:last-child {
  border-bottom: 0;
}

.case-vignette {
  margin-top: 20px;
  padding: 18px;
  color: #26364e;
  background: #f8fafc;
  border-left: 3px solid var(--teal);
  font-size: 13px;
  line-height: 1.7;
}

.case-steps {
  display: flex;
  gap: 6px;
  margin: 18px 0 12px;
}

.case-step {
  height: 5px;
  flex: 1;
  background: var(--line);
  border-radius: 5px;
}

.case-step.is-active {
  background: var(--teal);
}

.option-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.option-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}

.option-button:hover,
.option-button.is-selected {
  border-color: var(--blue);
  background: var(--surface-blue);
}

.option-button.is-correct {
  color: #0d6c3d;
  background: #eaf7ef;
  border-color: #92cca8;
}

.option-button.is-wrong {
  color: #9d3146;
  background: #fff0f3;
  border-color: #e3a8b4;
}

.option-letter {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.feedback-box {
  margin-top: 14px;
  padding: 14px;
  background: #eef7ff;
  border: 1px solid #c5ddf6;
  border-radius: 6px;
  font-size: 12px;
}

.review-item {
  grid-template-columns: auto 1fr auto;
}

.review-item input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.review-item strong,
.review-item small {
  display: block;
}

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

.review-item time {
  color: var(--muted);
  font-size: 10px;
}

.review-item.is-done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.tool-tabs {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding: 4px;
  background: #eaf0f6;
  border-radius: 6px;
}

.tool-tab {
  min-height: 36px;
  flex: 1 0 auto;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.tool-tab.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(27, 46, 72, 0.13);
}

.calculator-pane[hidden] {
  display: none;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: 0;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 93, 216, 0.1);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.result-panel {
  display: none;
  margin-top: 18px;
  padding: 18px;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
}

.result-panel.is-visible {
  display: block;
}

.result-panel strong,
.result-panel span {
  display: block;
}

.result-panel strong {
  font-size: 26px;
}

.result-panel span {
  margin-top: 3px;
  color: #b9c6d7;
  font-size: 11px;
}

.clinical-warning {
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.flashcard-stage {
  max-width: 620px;
  margin: 22px auto;
}

.flashcard {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 12px 30px rgba(26, 51, 87, 0.08);
}

.flashcard::before {
  content: attr(data-side);
  position: absolute;
  top: 17px;
  left: 18px;
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.flashcard p {
  max-width: 510px;
  margin: 0;
  font-size: 23px;
  font-weight: 750;
  line-height: 1.35;
}

.flashcard small {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--muted);
  font-size: 10px;
}

.flashcard-controls {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}

.flashcard-progress {
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.league-item {
  grid-template-columns: 42px 1fr auto;
}

.date-box {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface-blue);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 850;
}

.league-item strong,
.league-item small {
  display: block;
}

.league-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 30px));
  padding: 11px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 12px;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-nav {
  display: none;
}

.profile-button {
  width: auto;
  min-width: 58px;
  padding: 0 12px;
  border-radius: 6px;
}

.profile-button.is-authenticated {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}

.profile-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-pill.is-ready {
  color: #087b70;
  background: #e6f8f5;
  border-color: #a8e3dc;
}

.send-button:disabled,
.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.message.is-pending {
  color: var(--muted);
}

.message-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.message-sources span {
  padding: 5px 8px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.material-library {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 8px 0;
}

.material-library > header,
.admin-library > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.material-library > header span,
.admin-library > header span,
.admin-heading span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.material-library > header strong,
.admin-library > header > strong {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-size: 12px;
}

.library-material-list {
  display: grid;
}

.library-material {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.library-material-icon,
.admin-material-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  background: var(--surface-blue);
  border: 1px solid #cfe2fb;
  border-radius: 6px;
}

.library-material-icon svg,
.admin-material-icon svg {
  width: 20px;
  height: 20px;
}

.library-material-copy {
  min-width: 0;
}

.library-material-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.library-material-tags span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.library-material-tags .is-ai-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #087b70;
}

.library-material-tags .is-viewed,
.library-material-tags .is-reviewed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
}

.library-material-tags .is-reviewed {
  color: var(--green);
}

.library-material-tags .is-viewed svg,
.library-material-tags .is-reviewed svg {
  width: 12px;
  height: 12px;
}

.library-material-actions {
  display: flex;
  gap: 7px;
}

.review-material-button.is-active {
  color: var(--green);
  background: #edf9f3;
  border-color: #b9e4ce;
}

.library-material-tags .is-ai-source svg {
  width: 12px;
  height: 12px;
}

.library-material h3,
.admin-material-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.library-material p,
.admin-material-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account-access {
  width: min(440px, 100%);
  margin: 42px auto;
}

.account-access-heading {
  margin-bottom: 30px;
  text-align: center;
}

.account-mark {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
}

.account-mark svg {
  width: 24px;
  height: 24px;
}

.account-access-heading > span:not(.account-mark) {
  display: block;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.account-access-heading h2 {
  margin: 5px 0 8px;
  font-size: 30px;
}

.account-access-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.google-button {
  width: 100%;
  justify-content: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
}

.access-divider {
  position: relative;
  margin: 22px 0;
  text-align: center;
}

.access-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  border-top: 1px solid var(--line);
}

.access-divider span {
  position: relative;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
}

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

.account-form .button {
  width: 100%;
  justify-content: center;
}

.text-button {
  justify-self: center;
  padding: 4px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.form-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.account-workspace {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding-bottom: 38px;
}

.account-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 12px 0 30px;
  border-bottom: 1px solid var(--line);
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 20px;
}

.account-avatar {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(145deg, var(--blue), var(--teal));
  border-radius: 50%;
  font-size: 22px;
  font-weight: 850;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-editor {
  position: relative;
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
}

.account-photo-action {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--ink);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
}

.account-photo-action svg {
  width: 13px;
  height: 13px;
}

.account-identity span:not(.account-avatar) {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-identity h2 {
  margin: 4px 0 2px;
  font-size: 30px;
}

.account-identity p {
  margin: 0;
  color: var(--muted);
}

.account-photo-links {
  display: flex;
  gap: 12px;
  margin-top: 7px;
}

.account-photo-links label,
.account-photo-links button {
  padding: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.account-photo-links button {
  color: var(--muted);
}

.account-identity #account-photo-status {
  min-height: 0;
  margin-top: 4px;
  text-transform: none;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.account-setting-section {
  min-width: 0;
  padding: 30px 32px 32px 0;
  border-bottom: 1px solid var(--line);
}

.account-setting-section:nth-child(odd) {
  padding-right: 34px;
  border-right: 1px solid var(--line);
}

.account-setting-section:nth-child(even) {
  padding-left: 34px;
}

.account-setting-section:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.account-setting-heading {
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 22px;
}

.account-setting-heading > span {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 50%;
}

.account-setting-heading svg {
  width: 17px;
  height: 17px;
}

.account-setting-heading h3 {
  margin: 0;
  font-size: 17px;
}

.account-setting-heading p,
.account-danger-zone p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.account-settings-form {
  display: grid;
  gap: 13px;
}

.account-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
}

.account-form-footer .form-status {
  flex: 1;
}

.account-history-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.account-history-metrics > div {
  display: grid;
  gap: 1px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border-left: 3px solid var(--blue);
  border-radius: 4px;
}

.account-history-metrics strong {
  font-size: 22px;
}

.account-history-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.account-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account-danger-zone strong {
  color: #a92f49;
  font-size: 13px;
}

.button-danger {
  color: #a92f49;
  background: #fff;
  border: 1px solid #e5b9c3;
}

.button-danger:hover {
  color: #8e213a;
  background: #fff4f6;
  border-color: #d98fa0;
}

.admin-workspace {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding-bottom: 30px;
}

.admin-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: end;
  gap: 40px;
  margin-bottom: 24px;
}

.admin-heading h2,
.admin-library h2 {
  margin: 4px 0 0;
  font-size: 27px;
}

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

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.toggle-field {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  cursor: pointer;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
}

.toggle-field > span {
  position: relative;
  width: 38px;
  height: 22px;
  margin-top: 1px;
  background: var(--line-strong);
  border-radius: 11px;
  transition: background 160ms ease;
}

.toggle-field > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(7, 21, 47, 0.24);
  transition: transform 160ms ease;
}

.toggle-field input:checked + span {
  background: var(--teal);
}

.toggle-field input:checked + span::after {
  transform: translateX(16px);
}

.toggle-field input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.toggle-field strong,
.toggle-field small {
  display: block;
}

.toggle-field strong {
  font-size: 12px;
}

.toggle-field small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.admin-submit-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, auto) auto;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.upload-progress {
  height: 5px;
  overflow: hidden;
  background: var(--line);
  border-radius: 3px;
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 180ms ease;
}

.admin-library {
  margin-top: 38px;
}

.admin-material-list {
  display: grid;
}

.admin-material-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.admin-material-row > div > span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
}

.danger-button:hover {
  color: var(--rose);
  background: #fff1f4;
  border-color: #f1bdc8;
}

.admin-empty {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
}

.admin-empty > svg {
  width: 28px;
  height: 28px;
}

.admin-empty strong,
.admin-empty span {
  display: block;
}

.admin-empty strong {
  color: var(--ink);
}

.admin-empty span {
  margin-top: 2px;
  font-size: 12px;
}

body.auth-pending,
body.auth-required {
  overflow: hidden;
}

.app-shell[hidden],
.login-view[hidden] {
  display: none;
}

.login-view {
  position: fixed;
  z-index: 150;
  inset: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(430px, 0.92fr);
  background: #fff;
}

.login-visual {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--ink);
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(3, 14, 33, 0.56);
}

.login-visual > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(1.5px);
  transform: scale(1.015);
}

.login-visual-brand {
  position: absolute;
  z-index: 1;
  right: clamp(28px, 5vw, 76px);
  bottom: clamp(30px, 7vh, 72px);
  left: clamp(28px, 5vw, 76px);
  color: #fff;
}

.login-visual-brand img {
  width: 210px;
  height: 210px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.18));
}

.login-visual-brand p {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 650;
}

.login-panel {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(28px, 5vw, 76px);
  background: #fff;
}

.login-content {
  width: min(420px, 100%);
}

.login-heading {
  margin-bottom: 30px;
}

.login-heading img {
  display: none;
  width: 156px;
  height: 156px;
  margin-bottom: 14px;
  object-fit: contain;
  object-position: left center;
}

.login-heading > span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.login-heading h1,
.login-content > h1 {
  margin: 6px 0 9px;
  font-size: 34px;
  line-height: 1.15;
}

.login-heading p,
.login-content > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.site-login-form {
  display: grid;
  gap: 15px;
}

.site-google-button {
  height: 44px;
  gap: 10px;
}

.site-google-button img {
  width: 20px;
  height: 20px;
}

.site-login-divider {
  margin: 20px 0;
}

.site-login-divider span {
  background: #fff;
}

.site-login-form > .button {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

.login-secondary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.login-secondary-actions .text-button {
  justify-self: auto;
  padding: 2px 0;
}

.password-control {
  position: relative;
}

.field .password-control input {
  padding-right: 46px;
}

.password-visibility {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.password-visibility:hover,
.password-visibility:focus-visible {
  color: var(--blue);
  background: var(--surface-blue);
  outline: 0;
}

.password-visibility svg {
  width: 18px;
  height: 18px;
}

.login-loading-icon {
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 50%;
}

.login-loading-icon svg {
  width: 22px;
  height: 22px;
  animation: login-spin 900ms linear infinite;
}

.login-loading-icon.is-error {
  color: var(--rose);
  background: #fff1f4;
}

.login-loading-icon.is-error svg {
  animation: none;
}

.login-retry {
  margin-top: 22px;
}

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

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 150px 1fr auto;
  }

  .topnav {
    gap: 18px;
  }

  .topnav .nav-link:nth-child(3),
  .topnav .nav-link:nth-child(4),
  .search-box kbd {
    display: none;
  }

  .search-box {
    width: 210px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-right: 34px;
    padding-left: 46px;
  }

  .hero-copy > p {
    font-size: 17px;
  }

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

@media (max-width: 860px) {
  :root {
    --topbar-height: 64px;
  }

  body {
    padding-bottom: 66px;
  }

  .topbar {
    grid-template-columns: 132px 1fr;
    gap: 10px;
    padding: 0 14px;
  }

  .brand {
    width: 122px;
    height: 54px;
  }

  .brand img {
    width: 94px;
    height: 52px;
  }

  .topnav,
  .topbar-actions .icon-button,
  .topbar-actions .profile-button,
  .rail {
    display: none;
  }

  .topbar-actions {
    min-width: 0;
  }

  .search-box {
    width: 100%;
    max-width: none;
  }

  .main-content {
    padding-left: 0;
  }

  .hero {
    min-height: 650px;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 0;
    padding: 58px 24px;
  }

  .hero::before {
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .hero h1 {
    font-size: 66px;
  }

  .hero-copy > p {
    font-size: 16px;
  }

  .hero-meta {
    gap: 15px;
  }

  .hero-meta > div {
    min-width: 0;
    flex: 1;
  }

  .hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 58% center;
  }

  .daily-strip {
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 18px 24px;
  }

  .daily-progress,
  .daily-strip .button {
    grid-column: 1 / -1;
  }

  .section-block {
    padding: 56px 24px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 12px;
  }

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

  .league-band {
    grid-template-columns: auto 1fr;
    margin: 50px 24px;
    padding: 26px;
  }

  .league-band .button {
    grid-column: 1 / -1;
  }

  .footer {
    grid-template-columns: 110px 1fr;
  }

  .footer > span {
    grid-column: 1 / -1;
  }

  .mobile-nav {
    position: fixed;
    z-index: 85;
    right: 0;
    bottom: 0;
    left: 0;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--line);
  }

  .mobile-nav button {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    background: transparent;
    font-size: 9px;
  }

  .mobile-nav button.is-active {
    color: var(--blue);
    background: var(--surface-blue);
  }

  .mobile-nav svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav .mobile-ai {
    color: var(--muted);
    background: transparent;
  }

  .mobile-nav .mobile-ai.is-active {
    color: #fff;
    background: var(--blue);
  }

  .ai-launcher {
    display: none;
  }

  .environment-header {
    top: auto;
    min-height: 76px;
    padding: 12px 14px;
  }

  .environment-heading {
    gap: 9px;
  }

  .environment-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .environment-heading h1 {
    font-size: 19px;
  }

  .environment-header > .button {
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 0;
  }

  .environment-content {
    min-height: calc(100vh - var(--topbar-height) - 76px);
    padding: 18px 14px 92px;
  }

  .ai-environment-grid {
    grid-template-columns: 1fr;
  }

  .ai-environment-main {
    min-height: 560px;
  }

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

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

  .academic-weeks {
    grid-template-columns: repeat(9, minmax(42px, 1fr));
  }

  .academic-material-body .workspace-aside {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

@media (max-width: 560px) {
  .hero {
    min-height: 690px;
    grid-template-rows: none;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .button {
    width: 100%;
  }

  .hero-meta strong {
    font-size: 17px;
  }

  .hero-meta span {
    font-size: 9px;
  }

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

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

  .module-card {
    min-height: 240px;
  }

  .study-panel,
  .news-panel {
    padding: 20px;
  }

  .league-band {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .footer {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .workspace-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .dialog-header {
    padding: 10px 12px;
  }

  .dialog-icon {
    display: none;
  }

  .dialog-title-wrap h2 {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-actions .button {
    width: 40px;
    padding: 0;
  }

  .dialog-actions .button:not(.icon-button) {
    font-size: 0;
  }

  .dialog-content {
    padding: 14px;
  }

  .environment-icon {
    display: none;
  }

  .environment-heading h1 {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .environment-ai-messages {
    padding: 20px 16px;
  }

  .environment-suggestions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .environment-ai-form {
    margin: 0 16px;
  }

  .tnia-workspace {
    min-height: 560px;
    padding: 30px 2px 14px;
  }

  .tnia-intro {
    margin-bottom: 26px;
  }

  .tnia-intro h2 {
    font-size: 24px;
  }

  .tnia-intro p {
    font-size: 12px;
  }

  .tnia-messages .message {
    max-width: 92%;
  }

  .tnia-composer {
    padding: 12px;
  }

  .workspace-main,
  .workspace-aside,
  .tool-surface {
    padding: 18px;
  }

  .academic-navigator {
    padding: 0;
  }

  .academic-navigator-header {
    align-items: flex-start;
    padding: 20px 16px 18px;
  }

  .academic-navigator-header strong {
    font-size: 15px;
  }

  .academic-navigator > .academic-control-group {
    padding: 18px 16px;
  }

  .academic-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
  }

  .academic-period-button {
    min-height: 94px;
    padding: 14px;
  }

  .academic-period-button svg {
    top: 14px;
    right: 13px;
  }

  .academic-period-number {
    font-size: 23px;
  }

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

  .academic-subject-button:first-child {
    grid-column: auto;
  }

  .academic-weeks {
    grid-template-columns: repeat(6, minmax(34px, 1fr));
  }

  .academic-empty {
    margin: 18px 16px 20px;
  }

  .academic-material-body .workspace-main,
  .academic-material-body .workspace-aside {
    padding: 22px 18px;
  }

  .academic-material-body .workspace-main h3,
  .academic-material-body .tool-surface h3 {
    font-size: 21px;
  }

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

  .field.full,
  .form-actions {
    grid-column: 1;
  }

  .flashcard {
    min-height: 300px;
    aspect-ratio: auto;
    padding: 28px 20px;
  }

  .flashcard p {
    font-size: 19px;
  }

  .topic-item,
  .league-item {
    grid-template-columns: 36px 1fr;
  }

  .academic-material-body .topic-item {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .topic-item button,
  .league-item button {
    grid-column: 1 / -1;
  }

  .academic-material-body .topic-item button {
    grid-column: 3;
  }
}

@media (max-width: 860px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    padding: 34px 24px;
  }

  .login-heading img {
    display: block;
  }

  .account-profile {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
    padding-top: 0;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .account-setting-section,
  .account-setting-section:nth-child(odd),
  .account-setting-section:nth-child(even) {
    padding: 26px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .account-setting-section:last-child {
    border-bottom: 0;
  }

  .admin-heading {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .admin-form .field.full,
  .admin-submit-row {
    grid-column: 1;
  }

  .admin-submit-row {
    grid-template-columns: 1fr auto;
  }

  .admin-submit-row .upload-progress {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .login-panel {
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px 18px;
  }

  .login-heading {
    margin-bottom: 24px;
  }

  .login-heading img {
    width: 142px;
    height: 142px;
    margin-bottom: 10px;
  }

  .login-heading h1,
  .login-content > h1 {
    font-size: 28px;
  }

  .login-secondary-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .account-access {
    margin: 20px auto;
  }

  .account-access-heading h2,
  .account-identity h2 {
    font-size: 24px;
  }

  .account-profile {
    padding-bottom: 24px;
  }

  .account-identity {
    width: 100%;
    gap: 14px;
  }

  .account-avatar,
  .account-avatar-editor {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .account-actions,
  .account-actions .button {
    width: 100%;
  }

  .account-actions .button {
    justify-content: center;
  }

  .account-form-footer,
  .account-danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .account-form-footer .button,
  .account-danger-zone .button {
    width: 100%;
  }

  .account-setting-heading {
    min-height: 0;
  }

  .library-material,
  .admin-material-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
  }

  .library-material-actions {
    grid-column: 2;
    justify-content: flex-end;
  }

  .library-material-icon,
  .admin-material-icon {
    width: 40px;
    height: 40px;
  }

  .admin-form {
    margin: 0 -2px;
    padding: 18px 14px;
  }

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

  .admin-submit-row .button {
    width: 100%;
    justify-content: center;
  }

  .admin-row-actions {
    flex-direction: column;
  }

  .admin-material-row:has(.admin-row-actions .icon-button:nth-child(2)) {
    grid-template-columns: 40px minmax(0, 1fr) 36px;
  }
}

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

/* Interactive study environments. */
.library-start-button {
  min-width: 104px;
  justify-content: center;
}

.study-workspace,
.activity-workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.study-workspace-header,
.activity-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 4px 0 22px;
  border-bottom: 1px solid var(--line);
}

.study-workspace-header > div:nth-child(2),
.activity-header > div {
  min-width: 0;
}

.study-workspace-header span,
.activity-header span {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.study-workspace-header h2,
.activity-header h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.25;
}

.study-workspace-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.study-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  min-height: min(760px, calc(100vh - 210px));
}

.study-document {
  min-width: 0;
  padding: 22px 22px 0 0;
}

.study-document-frame,
.study-document-loading {
  width: 100%;
  height: min(760px, calc(100vh - 230px));
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.study-document-loading {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
}

.study-document-loading svg {
  width: 28px;
  height: 28px;
  color: var(--blue);
  animation: spin 1s linear infinite;
}

.study-notes {
  min-width: 0;
  padding: 22px 0 0 22px;
  border-left: 1px solid var(--line);
}

.study-notes > header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.study-notes > header > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--teal);
  background: #e8faf8;
  border-radius: 6px;
}

.study-notes header strong,
.study-notes header p {
  display: block;
  margin: 0;
}

.study-notes header p {
  color: var(--muted);
  font-size: 12px;
}

.study-notes form {
  display: flex;
  min-height: 430px;
  flex-direction: column;
}

.study-notes textarea {
  width: 100%;
  min-height: 360px;
  flex: 1;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.65;
  outline: none;
}

.study-notes textarea:focus {
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 93, 216, 0.1);
}

.study-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.activity-header > strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.activity-progress {
  height: 4px;
  margin: 0 0 28px;
  overflow: hidden;
  background: var(--line);
}

.activity-progress span {
  display: block;
  height: 100%;
  background: var(--teal);
  transition: width 180ms ease;
}

.flashcard-activity {
  max-width: 980px;
}

.flashcard-stage {
  width: 100%;
  max-width: none;
  min-height: 390px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  padding: 44px clamp(24px, 6vw, 76px);
  color: var(--ink);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 5px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(24, 47, 82, 0.1);
  cursor: pointer;
  margin: 0;
}

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

.flashcard-stage.is-revealed {
  border-top-color: var(--teal);
  background: #f6fcfb;
}

.flashcard-stage > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.flashcard-stage strong {
  max-width: 760px;
  font-size: 30px;
  line-height: 1.4;
  white-space: pre-line;
}

.flashcard-stage small {
  max-width: 640px;
  color: var(--muted);
  font-size: 14px;
}

.flashcard-stage > svg {
  width: 20px;
  color: var(--muted);
}

.activity-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 74px;
  padding: 16px 0;
}

.activity-summary {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--muted);
  font-size: 13px;
}

.activity-summary span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.activity-summary svg {
  width: 16px;
  color: var(--teal);
}

.question-activity,
.case-activity {
  max-width: 1040px;
}

.question-surface,
.case-surface {
  padding: 4px clamp(0px, 3vw, 32px) 8px;
}

.question-surface > span,
.case-surface > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.question-surface h3,
.case-surface h3 {
  max-width: 900px;
  margin: 10px 0 24px;
  font-size: 26px;
  line-height: 1.45;
  white-space: pre-line;
}

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

.question-option {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.question-option:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--surface-blue);
}

.question-option > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 850;
}

.question-option strong {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
  white-space: pre-line;
}

.question-option.is-correct {
  border-color: #6fc89a;
  background: #effaf4;
}

.question-option.is-wrong {
  border-color: #e6a4b1;
  background: #fff3f5;
}

.question-option.is-correct > span {
  color: #fff;
  background: var(--green);
}

.question-option.is-wrong > span {
  color: #fff;
  background: var(--rose);
}

.question-option svg {
  width: 18px;
  color: var(--green);
}

.question-feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-left: 4px solid var(--blue);
  background: var(--surface-soft);
}

.question-feedback.is-correct {
  border-left-color: var(--green);
  background: #effaf4;
}

.question-feedback.is-wrong {
  border-left-color: var(--rose);
  background: #fff3f5;
}

.question-feedback strong,
.question-feedback p {
  display: block;
  margin: 0;
}

.question-feedback p,
.case-content {
  margin-top: 6px;
  color: var(--ink-soft);
  line-height: 1.7;
  white-space: pre-line;
}

.question-controls,
.case-controls {
  justify-content: space-between;
  padding-inline: clamp(0px, 3vw, 32px);
}

.question-controls > span {
  color: var(--muted);
  font-size: 13px;
}

.case-content {
  max-width: 900px;
  margin: 0 0 24px;
  font-size: 16px;
}

.case-question {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.case-question > strong {
  display: block;
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.45;
}

.activity-complete {
  max-width: 900px;
}

.activity-complete-content {
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 440px;
  padding: 40px;
  text-align: center;
}

.activity-complete-content > span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
}

.activity-complete-content h3 {
  margin: 20px 0 6px;
  font-size: 28px;
}

.activity-complete-content p {
  margin: 0;
  color: var(--muted);
}

.activity-complete-content > div {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

@media (max-width: 960px) {
  .study-workspace-grid {
    grid-template-columns: 1fr;
  }

  .study-document {
    padding-right: 0;
  }

  .study-notes {
    padding: 22px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .study-notes form {
    min-height: 300px;
  }

  .study-notes textarea {
    min-height: 240px;
  }
}

@media (max-width: 680px) {
  .study-workspace-header,
  .activity-header {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
  }

  .study-header-actions,
  .activity-header > strong {
    grid-column: 2;
    justify-self: start;
  }

  .study-header-actions {
    width: 100%;
  }

  .study-header-actions .button {
    flex: 1;
    justify-content: center;
  }

  .study-document-frame,
  .study-document-loading {
    height: 68vh;
    min-height: 420px;
  }

  .flashcard-stage {
    min-height: 330px;
    padding: 30px 20px;
  }

  .flashcard-stage strong {
    font-size: 22px;
  }

  .question-surface h3,
  .case-surface h3 {
    font-size: 21px;
  }

  .activity-controls {
    flex-wrap: wrap;
  }

  .flashcard-controls .button {
    flex: 1;
    justify-content: center;
  }

  .question-surface,
  .case-surface,
  .question-controls,
  .case-controls {
    padding-inline: 0;
  }

  .question-controls,
  .case-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .question-controls .button,
  .case-controls .button {
    width: 100%;
    justify-content: center;
  }

  .activity-complete-content {
    min-height: 360px;
    padding: 30px 8px;
  }

  .activity-complete-content > div {
    width: 100%;
    flex-direction: column;
  }

  .activity-complete-content .button {
    justify-content: center;
  }
}
