/* ============================================================
   MATERIAL DESIGN 3 — DESIGN TOKENS
   ============================================================ */

:root {
  /* Primary */
  --md-sys-color-primary: #1a73e8;
  --md-sys-color-primary-hover: #1557b0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #062e6f;

  /* Surface */
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-dim: #f8f9fa;
  --md-sys-color-surface-container: #f1f3f4;
  --md-sys-color-surface-container-low: #f8f9fa;
  --md-sys-color-surface-container-high: #e8eaed;
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-on-surface-variant: #444746;

  /* Semantic */
  --md-sys-color-error: #b3261e;
  --md-sys-color-error-container: #f9dedc;
  --md-sys-color-success: #1e8e3e;
  --md-sys-color-success-container: #ceead6;
  --md-sys-color-warning: #e37400;
  --md-sys-color-warning-container: #fef7e0;
  --md-sys-color-outline: #747775;
  --md-sys-color-outline-variant: #c4c7c5;

  /* Shape */
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-sm: 8px;
  --md-sys-shape-corner-md: 12px;
  --md-sys-shape-corner-lg: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* Elevation */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
  --md-sys-elevation-2: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.3);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.wizard-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
}

.wizard-step {
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   HEADER
   ============================================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  flex-shrink: 0;
  z-index: 10;
  background: var(--md-sys-color-surface);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__icon {
  font-size: 32px;
  color: var(--md-sys-color-primary);
}

.app-header__title {
  font-size: 20px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.app-header__subtitle {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   MD3 BUTTON SYSTEM
   ============================================================ */

.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.md-btn .material-symbols-outlined { font-size: 20px; }

.md-btn:disabled {
  opacity: 0.38;
  pointer-events: none;
}

/* Filled */
.md-btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.md-btn--filled:hover {
  background: var(--md-sys-color-primary-hover);
  box-shadow: var(--md-sys-elevation-1);
}

/* Tonal */
.md-btn--tonal {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}
.md-btn--tonal:hover {
  background: var(--md-sys-color-surface-container-high);
}

/* Outlined */
.md-btn--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-primary);
}
.md-btn--outlined:hover {
  background: rgba(26, 115, 232, 0.04);
}

/* Text */
.md-btn--text {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding: 0 12px;
}
.md-btn--text:hover {
  background: rgba(26, 115, 232, 0.04);
}

/* Icon */
.md-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  color: var(--md-sys-color-outline);
  border-radius: 50%;
}
.md-btn--icon:hover {
  background: var(--md-sys-color-surface-container-low);
}

/* ============================================================
   MD3 CARDS
   ============================================================ */

.md-card {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-lg);
  padding: 24px;
}

.md-card--elevated {
  box-shadow: var(--md-sys-elevation-1);
  border: none;
}

.md-info-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 16px 20px;
}

/* ============================================================
   STEPPER NAVIGATION
   ============================================================ */

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  flex-shrink: 0;
  background: var(--md-sys-color-surface);
}

.stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stepper__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--md-sys-color-outline);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}

.stepper__circle .material-symbols-outlined { font-size: 20px; }

.stepper__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-outline);
  transition: color 0.3s, font-weight 0.3s;
  text-align: center;
}

.stepper__connector {
  width: 40px;
  min-width: 24px;
  height: 2px;
  background: var(--md-sys-color-outline-variant);
  margin: 0 8px;
  align-self: flex-start;
  margin-top: 18px;
  transition: background-color 0.3s;
}

/* Stepper States */
.stepper__step--active .stepper__circle {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.stepper__step--active .stepper__label {
  color: var(--md-sys-color-primary);
  font-weight: 700;
}

.stepper__step--completed .stepper__circle {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.stepper__step--completed .stepper__label {
  color: var(--md-sys-color-on-surface-variant);
}

.stepper__connector--completed {
  background: var(--md-sys-color-primary);
}

/* ============================================================
   STEP 1: UPLOAD DOCUMENT
   ============================================================ */

.step-title {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.step-subtitle {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

.upload-zone {
  border: 2px dashed var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover {
  border-color: var(--md-sys-color-primary);
  background: rgba(26, 115, 232, 0.02);
}

.upload-zone.drag-active {
  border-color: var(--md-sys-color-primary);
  background: rgba(26, 115, 232, 0.06);
}

.upload-zone__icon {
  font-size: 48px;
  color: var(--md-sys-color-primary);
  margin-bottom: 16px;
}

.upload-zone__text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.upload-zone__hint {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}

.upload-zone__browse-btn { margin-top: 8px; }

.file-type-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}

.file-type-badge .material-symbols-outlined {
  font-size: 16px;
  color: var(--md-sys-color-success);
}

.upload-file-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--md-sys-color-primary-container);
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 12px 16px;
  margin-bottom: 24px;
}

.upload-file-display__icon {
  font-size: 24px;
  color: var(--md-sys-color-on-primary-container);
}

.upload-file-display__name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-display__size {
  font-size: 12px;
  opacity: 0.7;
}

.upload-file-display__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--md-sys-color-on-primary-container);
  opacity: 0.5;
  transition: opacity 0.2s;
  display: flex;
  padding: 4px;
  border-radius: 50%;
}

.upload-file-display__remove:hover { opacity: 1; }

.upload-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--md-sys-color-on-surface-variant);
}

.upload-loading .material-symbols-outlined {
  animation: spin 1.2s linear infinite;
  color: var(--md-sys-color-primary);
}

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 16px;
  margin-top: 16px;
}

.error-banner .material-symbols-outlined { flex-shrink: 0; }

.hidden-file-input { display: none; }

/* ============================================================
   STEP 2: SELECT HEADERS
   ============================================================ */

.headers-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.headers-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 6px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 13px;
  font-weight: 500;
}

.headers-toolbar__actions {
  display: flex;
  gap: 4px;
}

.header-list {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  max-height: 500px;
  overflow-y: auto;
}

.header-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--md-sys-color-surface-container);
}

.header-item:last-child { border-bottom: none; }

.header-item:hover { background: var(--md-sys-color-surface-container-low); }

.header-item--selected { background: rgba(26, 115, 232, 0.06); }

.header-item--h2 { padding-left: 48px; }

.header-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--md-sys-color-primary);
  flex-shrink: 0;
}

.header-item__icon {
  font-size: 20px;
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
}

.header-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-item--h1 .header-item__label { font-weight: 500; }

.header-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-xs);
  flex-shrink: 0;
}

.header-badge--h1 {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.header-badge--h2 {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

.header-badge--page {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-warning);
}

.header-item__chars {
  font-size: 12px;
  color: var(--md-sys-color-outline);
  flex-shrink: 0;
}

.headers-char-counter {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 16px 0;
}

.headers-char-counter--over {
  color: var(--md-sys-color-error);
  font-weight: 500;
}

.step-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* ============================================================
   SELECTION MODE TOGGLE
   ============================================================ */

.selection-mode-toggle {
  display: inline-flex;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 4px;
  margin-bottom: 16px;
}

.selection-mode-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.selection-mode-toggle__btn .material-symbols-outlined { font-size: 18px; }

.selection-mode-toggle__btn:hover:not(.selection-mode-toggle__btn--disabled):not(.selection-mode-toggle__btn--active) {
  background: var(--md-sys-color-surface-container-high);
}

.selection-mode-toggle__btn--active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.selection-mode-toggle__btn--disabled {
  opacity: 0.38;
  pointer-events: none;
  cursor: default;
}

/* ============================================================
   PAGE RANGE SELECTOR
   ============================================================ */

.page-range-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-range-selector__label {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

.page-range-selector__input {
  width: 80px;
  padding: 8px 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: border-color 0.2s;
}

.page-range-selector__input:focus {
  border-color: var(--md-sys-color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* ============================================================
   TEXT SELECTION MODE
   ============================================================ */

.text-selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.text-display-area {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  background: var(--md-sys-color-surface);
  font-size: 13px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.text-display-para {
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-display-para:last-child { margin-bottom: 0; }

.text-highlight {
  background: rgba(26, 115, 232, 0.18);
  border-radius: 2px;
  padding: 1px 0;
}

.text-selections-summary {
  margin-top: 12px;
}

.text-selections-empty {
  font-size: 13px;
  color: var(--md-sys-color-outline);
  font-style: italic;
}

.text-selections-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.text-selection-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-selection-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-sm);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.text-selection-chip__preview {
  flex: 1;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-selection-chip__chars {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  flex-shrink: 0;
}

.text-selection-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s;
}

.text-selection-chip__remove .material-symbols-outlined { font-size: 16px; }
.text-selection-chip__remove:hover { background: var(--md-sys-color-surface-container-high); }

/* ============================================================
   STEP 3: EDIT MISSION PROMPT
   ============================================================ */

.prompt-toggle {
  display: inline-flex;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 4px;
  margin-bottom: 16px;
}

.prompt-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.prompt-toggle__btn .material-symbols-outlined { font-size: 18px; }

.prompt-toggle__btn--active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.prompt-editor {
  width: 100%;
  min-height: 350px;
  padding: 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.prompt-editor:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.prompt-preview {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 12px;
}

.edit-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.edit-warning .material-symbols-outlined { flex-shrink: 0; font-size: 20px; }

/* ============================================================
   STEP 4: GENERATE TESTS
   ============================================================ */

.generate-container {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding-top: 32px;
}

.generate-spinner {
  font-size: 48px;
  color: var(--md-sys-color-primary);
  animation: spin 1.2s linear infinite;
  margin-bottom: 16px;
}

.generate-title {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.generate-subtitle {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}

.rotating-info {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container);
  border-left: 3px solid var(--md-sys-color-primary);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 0 auto 28px auto;
  max-width: 520px;
  text-align: left;
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 40px;
}

.rotating-info--visible {
  opacity: 1;
}

.progress-section {
  text-align: left;
  margin-bottom: 32px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}

.progress-bar {
  height: 6px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  transition: width 0.5s ease;
  width: 0;
}

.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-md);
  transition: background 0.2s;
}

.pipeline-step--pending {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
}

.pipeline-step--running {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.pipeline-step--running .pipeline-step__icon {
  color: var(--md-sys-color-primary);
  animation: spin 1.2s linear infinite;
}

.pipeline-step--completed {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-surface);
}

.pipeline-step--completed .pipeline-step__icon {
  color: var(--md-sys-color-success);
}

.pipeline-step__icon { font-size: 24px; flex-shrink: 0; }

.pipeline-step__info { flex: 1; }

.pipeline-step__name { font-weight: 500; font-size: 14px; }

.pipeline-step__desc { font-size: 12px; opacity: 0.8; }

.pipeline-step__status {
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.generate-hint {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 24px;
}

.generate-error {
  text-align: left;
  border: 1px solid var(--md-sys-color-error);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 24px;
  margin-top: 24px;
}

.generate-error__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-error);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 12px;
}

.generate-error__message {
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}

.generate-error__actions {
  display: flex;
  gap: 12px;
}

/* ============================================================
   STEP 5: VIEW RESULTS
   ============================================================ */

.results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.results-toolbar__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 500;
}

.results-toolbar__title .material-symbols-outlined {
  font-size: 28px;
  color: var(--md-sys-color-primary);
}

.results-toolbar__title small {
  font-size: 14px;
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
  display: block;
}

.results-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.results-header {
  margin-bottom: 24px;
}

.results-header__suite {
  font-size: 16px;
  font-weight: 500;
}

.results-header__date {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

/* Scenario Cards */
.scenario-card {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.scenario-card__header {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--md-sys-color-surface-dim);
  flex-wrap: wrap;
}

.scenario-card__table-wrap {
  overflow-x: auto;
}

.scenario-card__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.scenario-card__table th {
  background: var(--md-sys-color-surface-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.scenario-card__table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--md-sys-color-surface-container);
}

.scenario-card__table tbody tr:hover {
  background: var(--md-sys-color-surface-container-low);
}

.scenario-group-header-row { background: var(--md-sys-color-primary); }

.scenario-group-header-cell {
  color: var(--md-sys-color-on-primary);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px !important;
}

.scenario-guide-cell {
  color: var(--md-sys-color-error);
  white-space: pre-line;
}

.notes-cell {
  background: var(--md-sys-color-surface-container-low);
  min-width: 80px;
}

.notes-cell[contenteditable="true"]:focus {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -2px;
}

.pass-fail-cell {
  text-align: center;
  font-size: 16px;
  min-width: 48px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--priority-high {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
}

.badge--priority-medium {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-warning);
}

.badge--priority-low {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-success);
}

.badge--tag {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

/* Raw JSON Toggle */
.raw-json-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--md-sys-color-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  margin-top: 16px;
}

.raw-json-toggle__arrow {
  transition: transform 0.2s;
  font-size: 12px;
}

.raw-json-toggle--open .raw-json-toggle__arrow {
  transform: rotate(180deg);
}

.json-result-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.json-result-collapsible--open {
  max-height: 2000px;
}

.json-result {
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-sm);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 8px;
}

/* Results info card */
.results-info {
  margin-top: 24px;
}

/* ============================================================
   DIALOGS
   ============================================================ */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.confirm-dialog {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-lg);
  padding: 24px;
  box-shadow: var(--md-sys-elevation-3);
  min-width: 320px;
  max-width: 440px;
  width: 90%;
}

.confirm-dialog__title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 12px;
}

.confirm-dialog__message {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-dialog__input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-sm);
  outline: none;
  margin-bottom: 24px;
  transition: border-color 0.2s;
}

.confirm-dialog__input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ============================================================
   RESPONSIVE — TABLET (900px)
   ============================================================ */

@media (max-width: 900px) {
  .wizard-content { padding: 24px 16px; }
  .wizard-step { max-width: 100%; }
}

/* ============================================================
   RESPONSIVE — MOBILE (640px)
   ============================================================ */

@media (max-width: 640px) {
  .stepper__label { display: none; }
  .stepper__connector { min-width: 12px; margin: 0 6px; margin-top: 18px; }
  .app-header__subtitle { display: none; }
  .wizard-content { padding: 16px 12px; }
  .upload-zone { padding: 32px 16px; }
  .scenario-card__table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .results-toolbar { flex-direction: column; }
  .results-toolbar__actions { width: 100%; }
  .step-footer { flex-direction: column; gap: 12px; }
  .step-footer .md-btn { width: 100%; justify-content: center; }
  /* Mode toggle responsive */
  .selection-mode-toggle { flex-wrap: wrap; border-radius: var(--md-sys-shape-corner-md); }
  .selection-mode-toggle__btn { flex: 1; justify-content: center; font-size: 12px; padding: 8px 8px; }
  /* Page range responsive */
  .page-range-selector { flex-direction: column; align-items: stretch; }
  .page-range-selector__input { width: 100%; }
  /* Text display responsive */
  .text-display-area { max-height: 350px; padding: 12px; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (480px)
   ============================================================ */

@media (max-width: 480px) {
  .stepper__circle { width: 28px; height: 28px; font-size: 12px; }
  .stepper__circle .material-symbols-outlined { font-size: 16px; }
  .stepper__connector { margin-top: 14px; }
  .step-title { font-size: 20px; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #ffffff;
  margin: 0;
  padding: 24px;
}

.login-card {
  background: transparent;
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.login-card__header {
  margin-bottom: 40px;
}

.login-card__logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 32px;
}

.login-card__title {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 24px;
  line-height: 1.3;
}

.login-card__subtitle {
  font-size: 15px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

.login-card__sso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 48px;
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.login-card__sso-btn:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-card__sso-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.login-footer {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

/* ============================================================
   HEADER — USER DISPLAY & LOGOUT
   ============================================================ */

.app-header__user {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-right: 4px;
}
