:root {
  --bg: #eef2f4;
  --bg-accent: radial-gradient(circle at top left, rgba(249, 189, 118, 0.4), transparent 34%),
    radial-gradient(circle at top right, rgba(96, 176, 203, 0.24), transparent 32%),
    linear-gradient(180deg, #f7f5ef 0%, #edf2f4 48%, #e8eef0 100%);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(39, 54, 59, 0.1);
  --text: #223238;
  --muted: #5a7178;
  --accent: #1f8a70;
  --accent-strong: #166b59;
  --danger: #b84f4f;
  --warn: #b67e2c;
  --shadow: 0 24px 54px rgba(36, 53, 58, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--bg-accent);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(31, 138, 112, 0.2);
  outline-offset: 2px;
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.6rem, 4.8vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.eyebrow,
.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-strong);
  font-size: 0.73rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.lede {
  max-width: 62ch;
  font-size: 1.03rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 18px 0 0;
}

.glass {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel,
.panel,
.card,
.drop-zone,
.sticky-bar {
  border-radius: var(--radius-lg);
}

.hero-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.mini-stat span,
.muted {
  color: var(--muted);
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.section-copy,
.card-note {
  color: var(--muted);
  line-height: 1.6;
}

.section-copy {
  max-width: 70ch;
  margin: 10px 0 0;
}

.card-note {
  margin: 10px 0 0;
  font-size: 0.93rem;
}

.hero-actions,
.preset-row,
.action-row,
.export-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.preset-row,
.export-row {
  row-gap: 10px;
}

.action-row {
  margin-top: 10px;
  padding-top: 4px;
}

.sticky-bar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  gap: 10px;
  padding: 12px;
  margin-bottom: 24px;
}

.step-chip,
.preset-button,
.ghost-button,
.primary-button,
.export-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.step-chip,
.preset-button,
.ghost-button,
.export-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.step-chip:hover,
.preset-button:hover,
.ghost-button:hover,
.export-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.step-chip.is-active,
.preset-button.is-selected {
  background: rgba(31, 138, 112, 0.14);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(31, 138, 112, 0.18);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 18px 30px rgba(31, 138, 112, 0.25);
}

.status-pill {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(34, 50, 56, 0.07);
  color: var(--muted);
  font-size: 0.88rem;
}

.workspace {
  display: grid;
  gap: 22px;
}

.panel {
  padding: 24px;
}

.section-head,
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.section-head {
  row-gap: 14px;
  margin-bottom: 10px;
}

.card-head {
  margin-bottom: 6px;
}

.section-head h2,
.card-head h3 {
  margin: 0;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 22px;
}

.drop-zone {
  position: relative;
  padding: 30px;
  background: var(--surface-strong);
  display: grid;
  gap: 10px;
  justify-items: start;
  align-content: start;
  border: 1px dashed rgba(31, 138, 112, 0.32);
  overflow: hidden;
  min-height: 220px;
}

.drop-zone::after {
  content: "";
  position: absolute;
  inset: auto -30px -55px auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(31, 138, 112, 0.18), transparent 60%);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.drop-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 138, 112, 0.12);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drop-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.drop-subtitle {
  color: var(--muted);
  max-width: 52ch;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: auto;
}

.browse-button,
.file-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(39, 54, 59, 0.08);
}

.browse-button {
  font-weight: 700;
}

.file-pill {
  color: var(--muted);
}

.upload-side {
  display: grid;
  gap: 14px;
  align-content: start;
  padding-top: 4px;
}

.helper-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(39, 54, 59, 0.08);
}

.helper-card h3 {
  margin: 0;
}

.primary-button-wide {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.example-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-up {
  grid-template-columns: 1.25fr 1fr;
}

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

.selection-panels {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  padding: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-tile {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(39, 54, 59, 0.08);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-tile strong {
  display: block;
  margin-top: 10px;
  font-size: 1.5rem;
}

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

.field span {
  font-weight: 700;
  font-size: 0.92rem;
}

.field-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.field input,
.field select,
.inline-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(39, 54, 59, 0.12);
  border-radius: var(--radius-sm);
  background: white;
  padding: 12px 14px;
  color: var(--text);
}

.field select[multiple] {
  min-height: 128px;
}

.info-tip {
  position: relative;
  display: inline-block;
}

.info-tip summary {
  list-style: none;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(31, 138, 112, 0.12);
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.info-tip summary:focus-visible {
  outline: 3px solid rgba(31, 138, 112, 0.2);
  outline-offset: 2px;
}

.info-tip summary::-webkit-details-marker {
  display: none;
}

.info-tip[open] summary {
  background: rgba(31, 138, 112, 0.22);
}

.info-tip-card {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 12;
  width: min(280px, 70vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(34, 50, 56, 0.96);
  color: white;
  line-height: 1.45;
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: 0 18px 30px rgba(36, 53, 58, 0.18);
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 16px;
  border-radius: 999px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}

.warning-list,
.modal-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
}

.warning-list li {
  color: var(--warn);
}

.table-wrap {
  overflow: auto;
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(39, 54, 59, 0.08);
  background: rgba(255, 255, 255, 0.52);
}

.data-table {
  width: 100%;
  min-width: max(100%, 720px);
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(39, 54, 59, 0.08);
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.data-table th {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
}

.chip {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.chip.pass {
  background: rgba(31, 138, 112, 0.12);
  color: var(--accent-strong);
}

.chip.fail {
  background: rgba(184, 79, 79, 0.12);
  color: var(--danger);
}

.chip.warn {
  background: rgba(182, 126, 44, 0.12);
  color: var(--warn);
}

.chart-frame {
  position: relative;
  height: clamp(250px, 30vw, 340px);
  margin-top: 14px;
}

.chart-frame canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.modal {
  border: 0;
  background: transparent;
  padding: 0;
}

.modal::backdrop {
  background: rgba(23, 35, 40, 0.34);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(680px, calc(100vw - 32px));
  border-radius: var(--radius-lg);
  background: white;
  padding: 24px;
  box-shadow: var(--shadow);
}

.icon-button {
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  min-width: 260px;
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  background: rgba(34, 50, 56, 0.92);
  box-shadow: var(--shadow);
  animation: toast-in 240ms ease;
}

.toast.error {
  background: rgba(184, 79, 79, 0.96);
}

.reveal {
  animation: rise-in 420ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1120px) {
  .hero,
  .two-up,
  .selection-panels {
    grid-template-columns: 1fr;
  }

  .mapping-grid,
  .analysis-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .card-head {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 18px;
  }

  .panel,
  .card,
  .hero-panel {
    padding: 18px;
  }

  .sticky-bar {
    overflow-x: auto;
  }

  .hero-copy h1 {
    font-size: 2.4rem;
  }

  .data-table {
    min-width: 640px;
  }
}
