:root {
  --bg-start: #f5efe6;
  --bg-end: #dce8f4;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #5f6675;
  --accent: #0b6b59;
  --accent-2: #145ea8;
  --border: #d5dbe5;
  --shadow: 0 14px 34px rgba(14, 25, 42, 0.13);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Franklin Gothic Medium", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(130deg, var(--bg-start), var(--bg-end));
}

.page {
  width: min(960px, 92vw);
  margin: 32px auto 48px;
  display: grid;
  gap: 18px;
}

.hero {
  padding: 24px 26px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, rgba(20, 94, 168, 0.2), transparent 40%),
    radial-gradient(circle at bottom left, rgba(11, 107, 89, 0.2), transparent 35%), var(--card);
  box-shadow: var(--shadow);
  animation: fade-slide 420ms ease-out;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--accent-2);
  margin: 0 0 8px;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
}

.subtitle {
  color: var(--muted);
  margin: 10px 0 0;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: fade-slide 420ms ease-out;
}

.panel.hidden {
  display: none;
}

h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.file-label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

.drop-zone {
  border: 2px dashed #8ea4c5;
  border-radius: 14px;
  min-height: 170px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(242, 248, 255, 0.95)),
    repeating-linear-gradient(
      -45deg,
      rgba(20, 94, 168, 0.03),
      rgba(20, 94, 168, 0.03) 12px,
      rgba(11, 107, 89, 0.03) 12px,
      rgba(11, 107, 89, 0.03) 24px
    );
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.drop-zone:hover,
.drop-zone:focus {
  border-color: #2f7cc2;
  outline: none;
}

.drop-zone.drag-active {
  border-color: #1f8c67;
  background: linear-gradient(180deg, rgba(236, 251, 246, 0.98), rgba(226, 245, 238, 0.98));
  transform: translateY(-1px);
}

.drop-zone.drag-invalid {
  border-color: #c94d4d;
  background: linear-gradient(180deg, rgba(255, 241, 241, 0.98), rgba(255, 233, 233, 0.98));
}

.drop-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.06rem;
  color: #153f66;
}

.drop-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.mapping-grid {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.mapping-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) 1fr;
  align-items: start;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px;
}

.mapping-row.known-row {
  border-left: 4px solid #2f7cc2;
}

.mapping-row.unknown-row {
  border-left: 4px solid #d68a1f;
  background: #fffaf2;
}

.mapping-row.key-row {
  border-left: 4px solid #1f8c67;
  background: #f2fbf8;
}

.source-cell {
  display: grid;
  gap: 6px;
}

.source-label {
  margin: 0;
  font-weight: 700;
}

.badge-row,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend {
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge.known {
  background: #e8f1fd;
  color: #1f5485;
}

.badge.unknown {
  background: #fff0d9;
  color: #8a5607;
}

.badge.key {
  background: #dff6ee;
  color: #0f5b42;
}

.target-cell {
  display: grid;
  gap: 6px;
}

.field-name-label {
  font-size: 0.84rem;
  font-weight: 700;
}

.field-name-input {
  width: 100%;
  border: 1px solid #b7c3d7;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.field-name-input.invalid {
  border-color: #d24848;
  background: #fff1f1;
}

.name-hint,
.key-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #dce7f8;
  color: #1a2744;
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

button:hover {
  filter: brightness(1.03);
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
}

button.ghost {
  background: #eef2f8;
  color: #2a3344;
}

.status {
  margin-top: 12px;
  min-height: 1.2em;
  font-weight: 600;
}

.preview {
  margin-top: 10px;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  background: #0f1724;
  color: #d8e3f7;
  border-radius: 10px;
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .page {
    width: 94vw;
    margin-top: 20px;
  }

  .mapping-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
