:root {
  --paper: #f3f7fb;
  --ink: #17242d;
  --muted: #5f6f7a;
  --line: #d4e1ea;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --tyler-blue: #045590;
  --tyler-denim: #1278c0;
  --tyler-sycamore: #909b48;
  --tyler-sky: #d9edf8;
  --coral: #c85d4f;
  --shadow: 0 18px 50px rgba(4, 85, 144, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(18, 120, 192, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(18, 120, 192, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: "Segoe UI", "Aptos", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, var(--tyler-blue), #063b63);
  color: #ffffff;
  overflow: auto;
}

.brand-block {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: #ffffff;
  color: var(--tyler-blue);
  font-weight: 900;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.progress-card {
  padding: 16px;
  margin-bottom: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--tyler-sycamore);
  transition: width 180ms ease;
}

.progress-card p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.86rem;
}

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

.module-link {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.module-link:hover,
.module-link.is-active {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.14);
}

.module-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 800;
}

.module-name {
  display: block;
  font-size: 0.9rem;
  line-height: 1.18;
}

.module-time {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.76rem;
}

.checkmark {
  color: #dce6a9;
  font-size: 1rem;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  max-width: 1400px;
  margin: 0 auto 24px;
}

.topbar h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(1.6rem, 2.2vw, 2.55rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.icon-button,
.text-button {
  min-height: 42px;
  border: 1px solid var(--tyler-blue);
  border-radius: 8px;
  background: var(--tyler-blue);
  color: #ffffff;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
}

.text-button {
  padding: 0 16px;
}

.text-button.secondary {
  background: transparent;
  color: var(--tyler-blue);
}

.portfolio-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.portfolio-strip span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--tyler-blue);
  font-size: 0.78rem;
  font-weight: 800;
}

.text-button.full {
  width: 100%;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.lesson-stage,
.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.lesson-stage {
  padding: 28px;
}

.module-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  background: var(--tyler-sky);
  color: var(--tyler-blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

#moduleTitle {
  margin: 16px 0 8px;
  font-size: clamp(1.6rem, 2.4vw, 2.7rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.module-goal {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}

.pill {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin: 22px 0;
  border: 1px solid var(--line);
  background: #e8f1f7;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.tab.is-active {
  background: var(--panel-strong);
  box-shadow: 0 8px 20px rgba(29, 37, 40, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.lesson-list,
.activity-list,
.quiz-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-item,
.activity-card,
.quiz-card {
  min-height: 58px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lesson-item {
  padding: 0;
}

.lesson-button {
  display: grid;
  width: 100%;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.lesson-button:hover,
.lesson-button:focus-visible {
  background: #f2f8fb;
  outline: 2px solid var(--tyler-blue);
  outline-offset: -2px;
}

.lesson-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--tyler-blue);
  color: white;
  font-weight: 900;
}

.lesson-item strong,
.activity-card strong,
.quiz-card strong {
  display: block;
  margin-bottom: 4px;
}

.lesson-copy > span {
  display: block;
  color: var(--muted);
  line-height: 1.48;
}

.lesson-copy small {
  display: block;
  margin-top: 8px;
  color: var(--tyler-blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lesson-item p,
.activity-card p,
.quiz-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quiz-option {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.quiz-option:hover {
  border-color: var(--tyler-denim);
}

.quiz-option.is-correct {
  border-color: var(--tyler-sycamore);
  background: rgba(144, 155, 72, 0.16);
}

.quiz-option.is-wrong {
  border-color: var(--coral);
  background: rgba(216, 97, 69, 0.14);
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
}

.side-tools {
  display: grid;
  gap: 18px;
}

.tool-panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
}

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

.concept-card {
  aspect-ratio: 1;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}

.concept-card:hover {
  transform: translateY(-1px);
  border-color: var(--tyler-denim);
}

.concept-number {
  display: block;
  color: var(--tyler-sycamore);
  font-size: 0.66rem;
  font-weight: 900;
}

.concept-title {
  display: block;
  margin-top: 4px;
  font-size: clamp(0.48rem, 0.8vw, 0.62rem);
  font-weight: 900;
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.prompt-builder {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input {
  height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 70px;
  resize: vertical;
  padding: 10px;
}

pre {
  min-height: 120px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #063b63;
  color: #ffffff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  background: rgba(23, 36, 45, 0.38);
  z-index: 10;
}

.drawer.is-open {
  display: flex;
}

.drawer-panel {
  position: relative;
  width: min(560px, 100%);
  min-height: 100%;
  padding: 34px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: auto;
}

.drawer-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.drawer-panel h2 {
  margin: 18px 48px 12px 0;
  font-size: 2rem;
  line-height: 1.04;
}

.drawer-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.drawer-details {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-card strong {
  display: block;
  margin-bottom: 4px;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

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

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

@media (max-width: 760px) {
  .main-panel,
  .sidebar,
  .lesson-stage {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions,
  .stage-actions {
    width: 100%;
  }

  .text-button {
    flex: 1;
  }

  .nav-list,
  .side-tools {
    grid-template-columns: 1fr;
  }

  .module-link {
    grid-template-columns: 32px 1fr auto;
  }

  .concept-grid {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
    overflow-x: auto;
  }
}
