:root {
  --agentman-50: #faf9f5;
  --agentman-75: #f0eee6;
  --agentman-100: #f6eae6;
  --agentman-150: #e3dacc;
  --agentman-200: #e6a890;
  --agentman-400: #d97757;
  --agentman-500: #cc785c;
  --agentman-600: #a65945;
  --agentman-700: #8b4a38;
  --agentman-800: #703b2d;
  --charcoal-950: #141413;
  --charcoal-900: #292322;
  --charcoal-800: #3d3735;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --green-600: #10b981;
  --yellow-600: #f59e0b;
  --red-600: #ef4444;
  --blue-600: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--charcoal-950);
  background: var(--agentman-75);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1536px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  color: var(--agentman-50);
  background: var(--charcoal-950);
  border: 1px solid var(--charcoal-900);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.app-header h1,
.study-toolbar h2 {
  margin: 0;
}

.app-header h1 {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  gap: 8px;
}

.brand-lockup {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  color: var(--agentman-50);
  text-decoration: none;
}

.brand-logo-img {
  display: block;
  width: min(210px, 58vw);
  height: auto;
}

.brand-lockup:hover,
.brand-lockup:focus-visible {
  color: var(--agentman-200);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--agentman-400);
}

.header-actions,
.toolbar-actions,
.question-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 6px 6px 12px;
  color: var(--agentman-50);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(250, 249, 245, 0.2);
  border-radius: 8px;
}

.auth-status span {
  max-width: 180px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-status form {
  margin: 0;
}

.auth-status .button {
  min-height: 32px;
  padding: 7px 10px;
}

.app-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.exam-mode .app-layout {
  display: block;
}

.exam-mode .side-panel,
.exam-mode .insight-panel {
  display: none;
}

.side-panel,
.main-panel,
.insight-panel {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.side-panel,
.insight-panel {
  position: sticky;
  top: 24px;
}

.main-panel {
  min-height: 720px;
  padding: 24px;
}

.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--slate-200);
}

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

.panel-section h2 {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 700;
  color: var(--charcoal-950);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.button-primary {
  color: #ffffff;
  background: var(--agentman-500);
  border-color: var(--agentman-500);
  box-shadow: var(--shadow-sm);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--agentman-600);
  border-color: var(--agentman-600);
}

.button-secondary {
  color: var(--agentman-50);
  background: var(--charcoal-950);
  border-color: var(--charcoal-950);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: var(--charcoal-900);
}

.button-tertiary {
  color: var(--charcoal-950);
  background: #ffffff;
  border-color: var(--slate-300);
}

.button-tertiary:hover,
.button-tertiary:focus-visible,
.button-ghost:hover,
.button-ghost:focus-visible {
  background: var(--slate-50);
}

.button-ghost {
  color: var(--agentman-50);
  background: transparent;
  border-color: rgba(250, 249, 245, 0.32);
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--agentman-75);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
}

.segment {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--slate-600);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.segment.is-active {
  color: var(--charcoal-950);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.check-row {
  color: var(--slate-700);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--charcoal-950);
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--agentman-500);
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.16);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--agentman-500);
}

.help-text {
  margin: 0;
  color: var(--slate-600);
  font-size: 14px;
  line-height: 1.5;
}

.study-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.study-toolbar h2 {
  max-width: 760px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--charcoal-950);
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  color: var(--slate-700);
  background: var(--slate-100);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.badge-brand {
  color: var(--agentman-800);
  background: var(--agentman-100);
  border-color: var(--agentman-200);
}

.question-card {
  padding: 24px;
  background: var(--agentman-50);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
}

.question-text {
  margin: 0 0 24px;
  color: var(--charcoal-950);
  font-size: 18px;
  line-height: 1.6;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px;
  text-align: left;
  color: var(--charcoal-950);
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: var(--agentman-200);
  box-shadow: var(--shadow-sm);
}

.option-button.is-selected {
  border-color: var(--agentman-500);
  background: var(--agentman-100);
}

.option-button.is-correct {
  border-color: var(--green-600);
  background: #ecfdf5;
}

.option-button.is-wrong {
  border-color: var(--red-600);
  background: #fef2f2;
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--charcoal-950);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  font-weight: 800;
}

.option-button.is-selected .option-letter {
  color: #ffffff;
  background: var(--agentman-500);
  border-color: var(--agentman-500);
}

.option-button.is-correct .option-letter {
  color: #ffffff;
  background: var(--green-600);
  border-color: var(--green-600);
}

.option-button.is-wrong .option-letter {
  color: #ffffff;
  background: var(--red-600);
  border-color: var(--red-600);
}

.option-text {
  align-self: center;
  min-width: 0;
  font-size: 15px;
  line-height: 1.55;
}

.feedback-panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
  background: #ffffff;
}

.feedback-panel.correct {
  border-color: rgba(16, 185, 129, 0.45);
  background: #ecfdf5;
}

.feedback-panel.wrong {
  border-color: rgba(239, 68, 68, 0.45);
  background: #fef2f2;
}

.feedback-panel h3 {
  margin: 0 0 8px;
  color: var(--charcoal-950);
  font-size: 18px;
  line-height: 1.4;
}

.feedback-panel p {
  margin: 8px 0 0;
  color: var(--charcoal-950);
  font-size: 15px;
  line-height: 1.6;
}

.question-actions {
  justify-content: space-between;
  margin-top: 20px;
}

.loading-state,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  color: var(--slate-600);
  font-weight: 700;
}

.score-block {
  padding: 16px;
  background: var(--agentman-75);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
}

.score-block span {
  display: block;
  font-size: 36px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--charcoal-950);
}

.score-block p {
  margin: 6px 0 0;
  color: var(--slate-700);
  font-size: 14px;
  line-height: 1.5;
}

.metric-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 0;
}

.metric-list div {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.metric-list dt {
  color: var(--slate-600);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.metric-list dd {
  margin: 4px 0 0;
  color: var(--charcoal-950);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
}

.domain-progress,
.focus-list,
.review-view {
  display: grid;
  gap: 12px;
}

.progress-item {
  display: grid;
  gap: 8px;
}

.progress-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--charcoal-950);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  background: var(--slate-100);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--agentman-500);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.focus-item,
.review-item {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.focus-item h3,
.review-item h3 {
  margin: 0 0 6px;
  color: var(--charcoal-950);
  font-size: 14px;
  line-height: 1.4;
}

.focus-item p,
.review-item p {
  margin: 0;
  color: var(--slate-600);
  font-size: 13px;
  line-height: 1.5;
}

.review-signal {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px;
  background: var(--agentman-50);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
}

.review-signal strong {
  color: var(--agentman-800);
  font-size: 13px;
  line-height: 1.3;
}

.review-signal span {
  color: var(--slate-700);
  font-size: 12px;
  line-height: 1.4;
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.review-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
}

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

.review-item {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.focus-item:hover,
.focus-item:focus-visible,
.review-item:hover,
.review-item:focus-visible {
  border-color: var(--agentman-200);
  box-shadow: var(--shadow-sm);
}

.review-status {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 800;
}

.review-status.correct {
  color: #065f46;
  background: #ecfdf5;
}

.review-status.wrong {
  color: #991b1b;
  background: #fef2f2;
}

.exam-banner {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--agentman-100);
  border: 1px solid var(--agentman-200);
  border-radius: 8px;
  color: var(--agentman-800);
  font-weight: 700;
  line-height: 1.5;
}

.reference-panel {
  margin-top: 16px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.reference-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
}

.reference-list,
.course-references {
  display: grid;
  gap: 10px;
}

.reference-card,
.course-reference {
  display: grid;
  gap: 6px;
  padding: 12px;
  color: var(--charcoal-950);
  text-decoration: none;
  background: var(--agentman-50);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reference-card:hover,
.reference-card:focus-visible,
.course-reference:hover,
.course-reference:focus-visible {
  border-color: var(--agentman-200);
  box-shadow: var(--shadow-sm);
}

.reference-card strong,
.course-reference strong {
  font-size: 14px;
  line-height: 1.4;
}

.reference-card span,
.course-reference span,
.reference-card small {
  color: var(--slate-600);
  font-size: 13px;
  line-height: 1.5;
}

.lesson-score-panel {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--charcoal-950);
  border-radius: 8px;
  color: var(--agentman-50);
}

.lesson-score-panel strong {
  font-size: 15px;
  line-height: 1.35;
}

.lesson-score-panel span {
  color: var(--agentman-150);
  font-size: 13px;
  line-height: 1.45;
}

.lesson-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.lesson-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--agentman-800);
  background: var(--agentman-100);
  border: 1px solid var(--agentman-200);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 800;
}

.exam-view {
  display: grid;
  gap: 16px;
}

.exam-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  color: var(--charcoal-950);
  background: var(--agentman-50);
  border: 1px solid var(--agentman-150);
  border-radius: 8px;
}

.exam-topbar strong {
  display: block;
  font-size: 18px;
  line-height: 1.4;
}

.exam-timer {
  min-width: 92px;
  padding: 8px 12px;
  text-align: center;
  color: var(--agentman-50);
  background: var(--charcoal-950);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.exam-timer.is-low {
  background: var(--agentman-600);
}

.exam-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.exam-question-panel,
.exam-nav-panel,
.exam-result-panel {
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.exam-question-panel h2,
.exam-nav-panel h2 {
  margin: 0 0 16px;
  color: var(--charcoal-950);
  font-size: 22px;
  line-height: 1.35;
}

.exam-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 18px;
}

.exam-actions .button:last-child {
  justify-self: end;
}

.exam-legend {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--slate-700);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
}

.exam-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-box {
  width: 14px;
  height: 14px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  background: #ffffff;
}

.legend-box.answered {
  background: var(--agentman-100);
  border-color: var(--agentman-500);
}

.legend-box.flagged {
  background: #fff7ed;
  border-color: var(--yellow-600);
}

.legend-box.current {
  background: var(--charcoal-950);
  border-color: var(--charcoal-950);
}

.exam-question-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.exam-map-button {
  min-height: 40px;
  color: var(--charcoal-950);
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.exam-map-button.answered {
  background: var(--agentman-100);
  border-color: var(--agentman-500);
}

.exam-map-button.flagged {
  border-color: var(--yellow-600);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.exam-map-button.current {
  color: var(--agentman-50);
  background: var(--charcoal-950);
  border-color: var(--charcoal-950);
}

.exam-result-panel {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--charcoal-950);
  background: var(--agentman-100);
  border-color: var(--agentman-200);
}

.exam-result-panel span {
  color: var(--slate-700);
}

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

.exam-review-row {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  text-align: left;
  color: var(--charcoal-950);
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.exam-review-row span {
  color: var(--slate-600);
  font-size: 13px;
  line-height: 1.4;
}

.is-hidden {
  display: none !important;
}

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

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

  .insight-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .insight-panel .panel-section {
    border-bottom: 0;
    border-right: 1px solid var(--slate-200);
  }

  .insight-panel .panel-section:last-child {
    border-right: 0;
  }

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

  .exam-nav-panel {
    position: static;
  }

  .exam-question-map {
    grid-template-columns: repeat(10, minmax(36px, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
  }

  .app-header,
  .study-toolbar,
  .review-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .toolbar-actions,
  .question-actions {
    width: 100%;
  }

  .auth-status {
    width: 100%;
    justify-content: space-between;
  }

  .header-actions .button,
  .toolbar-actions .button,
  .question-actions .button {
    flex: 1;
  }

  .header-actions .auth-status .button {
    flex: 0 0 auto;
  }

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

  .side-panel,
  .insight-panel {
    position: static;
  }

  .insight-panel {
    display: block;
  }

  .insight-panel .panel-section {
    border-right: 0;
    border-bottom: 1px solid var(--slate-200);
  }

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

  .exam-topbar {
    grid-template-columns: 1fr;
  }

  .exam-timer {
    width: 100%;
  }

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

  .exam-actions .button,
  .exam-actions .button:last-child {
    width: 100%;
    justify-self: stretch;
  }

  .exam-question-map {
    grid-template-columns: repeat(5, minmax(40px, 1fr));
  }
}

@media (max-width: 560px) {
  .app-header h1 {
    font-size: 28px;
  }

  .main-panel,
  .question-card {
    padding: 16px;
  }

  .question-text {
    font-size: 16px;
  }

  .option-button {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 12px;
  }

  .option-letter {
    width: 28px;
    height: 28px;
  }

  .app-shell {
    padding: 10px;
  }

  .app-header {
    padding: 16px;
  }

  .app-layout {
    gap: 12px;
    margin-top: 12px;
  }

  .side-panel,
  .main-panel,
  .insight-panel,
  .exam-question-panel,
  .exam-nav-panel,
  .exam-result-panel {
    border-radius: 8px;
  }

  .exam-question-map {
    grid-template-columns: repeat(4, minmax(40px, 1fr));
  }
}
