.stacked-page {
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
}

.mapping-footer {
  order: 2;
}

.mapping-layout {
  order: 1;
}

.step.done {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  background: var(--ghost-bg) !important;
}

.step.done:hover:not(:disabled) {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  background: var(--ghost-bg) !important;
}

.step:disabled {
  opacity: 0.55;
}

.resolve-hint {
  color: var(--green);
  font-weight: 850;
}

@media (min-width: 761px) {
  html,
  body,
  #root {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .topbar {
    flex: 0 0 auto;
    padding: 12px 0;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .main {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 14px;
    overflow: hidden;
  }

  .choose-grid,
  .stacked-page {
    height: 100%;
    min-height: 0;
  }

  .choose-grid {
    grid-template-columns: minmax(300px, 0.72fr) minmax(560px, 1.28fr);
  }

  .intro-panel {
    position: static;
    padding: 22px;
  }

  .panel,
  .run-header {
    padding: 16px;
  }

  h1 {
    font-size: clamp(32px, 4.3vw, 58px);
  }

  h2 {
    font-size: 20px;
  }

  p {
    line-height: 1.45;
  }

  .stat-strip {
    margin-top: 14px;
  }

  .action-button {
    margin-top: 16px;
  }

  .panel-heading {
    margin-bottom: 12px;
  }

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

  .bom-card {
    padding: 12px;
  }

  .preview-table {
    margin-top: 12px;
    max-height: calc(100dvh - 286px);
    overflow: auto;
  }

  .preview-table th,
  .preview-table td {
    padding: 9px 12px;
  }

  .run-header {
    flex: 0 0 auto;
  }

  .run-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .run-header h1 {
    max-width: none;
  }

  .results-page {
    overflow-y: auto;
    padding-right: 6px;
  }

  .results-page .details-grid {
    padding-bottom: 14px;
  }

  .run-header h1 {
    font-size: clamp(30px, 3.5vw, 48px);
  }

  .mapping-footer {
    flex: 0 0 auto;
    padding: 12px 16px;
  }

  .mapping-layout {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(560px, 1fr) minmax(340px, 0.48fr);
  }

  .mapping-layout > .panel,
  .detail-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .review-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
  }

  .mapping-layout > .panel {
    display: flex;
    flex-direction: column;
  }

  .toolbar {
    flex: 0 0 auto;
  }

  .mapping-table {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  .detail-panel {
    position: static;
    flex: 1 1 auto;
    height: auto;
    overflow-y: auto;
  }

  .review-confirm {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--green);
    border-radius: 8px;
    color: var(--accent-ink);
    background: var(--green);
    font-size: 16px;
    font-weight: 850;
    line-height: 1;
  }

  .review-confirm:hover:not(:disabled) {
    filter: brightness(1.06);
  }

  .review-confirm:disabled {
    color: var(--muted);
    border-color: var(--line);
    background: var(--ghost-bg);
    opacity: 0.72;
  }

  .mapping-row {
    padding: 9px 12px;
  }

  .candidate-list {
    gap: 8px;
    margin-top: 12px;
  }

  .candidate-card {
    padding: 10px;
  }
}

@media (max-width: 760px) {
  .stacked-page {
    display: grid !important;
  }

  .mapping-footer,
  .mapping-layout {
    order: initial;
  }
}
