:root {
  --bg: #f1f4f8;
  --ink: #102a43;
  --ink-soft: #486581;
  --panel: #ffffff;
  --line: #d9e2ec;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Sora", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 0% -10%, #cffafe 0%, transparent 60%),
    radial-gradient(900px 500px at 100% -10%, #fde68a 0%, transparent 60%),
    var(--bg);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(16, 42, 67, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 42, 67, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 55%, transparent 95%);
}

.shell {
  width: min(1200px, 94vw);
  margin: 28px auto 60px;
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.kicker {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-size: 0.82rem;
  margin: 0 0 8px;
  font-family: var(--mono);
}

.subtitle {
  color: var(--ink-soft);
  max-width: 72ch;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, #ffffff 8%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(16, 42, 67, 0.06);
}

.panel h2 {
  margin-top: 0;
}

.hint {
  color: var(--ink-soft);
  margin-top: -4px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.hint.compact {
  margin-top: -6px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.dropzone {
  border: 1.5px dashed #94a3b8;
  border-radius: 14px;
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 14px;
  margin-bottom: 14px;
  background: #f8fafc;
}

.dropzone input {
  width: 100%;
  font-family: var(--sans);
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

input,
textarea {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border: none;
  border-radius: 12px;
  text-decoration: none;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn.inline-fit {
  width: auto;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #14b8a6 100%);
  color: white;
}

.btn.ghost {
  margin-top: 8px;
  background: #e0f2fe;
  color: #0c4a6e;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(15, 118, 110, 0.2);
}

.status {
  margin-top: 12px;
  font-size: 0.92rem;
  min-height: 22px;
  color: var(--ink-soft);
}

.status.error {
  color: #b91c1c;
}

.status.ok {
  color: #166534;
}

.summary {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--warn);
  margin-bottom: 10px;
}

.previewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.previewHeader h2 {
  margin: 0;
}

.previewActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.previewActions .btn {
  margin-top: 0;
}

.emailPreview {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
}

.emailPreview table {
  min-width: 760px;
}

.dgResolution {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  margin-top: 10px;
}

.dgResolution h3 {
  margin: 4px 0 10px;
  font-size: 0.95rem;
}

.dgResolution .tableWrap {
  margin-bottom: 12px;
}

.dgResolutionTable {
  min-width: 100%;
}

.dgResolutionTable th,
.dgResolutionTable td {
  font-size: 0.88rem;
}

.dgResolutionList {
  display: grid;
  gap: 8px;
}

.dgResolutionItem {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #f8fafc;
}

.dgResolutionItem.found {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.dgResolutionItem.notFound {
  border-color: #fdba74;
  background: #fff7ed;
}

.dgMeta {
  font-size: 0.9rem;
  line-height: 1.35;
}

.inlineControls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inlineControls input {
  margin-bottom: 0;
}

.inlineControls .btn {
  width: auto;
  margin-top: 0;
}

.manualAdd {
  margin-top: 14px;
}

.tableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  font-size: 0.9rem;
}

td.editable {
  background: #ffffff;
  cursor: text;
}

td.editable:focus {
  outline: 2px solid #14b8a6;
  outline-offset: -2px;
  background: #f0fdfa;
}

td.is-edited {
  box-shadow: inset 0 0 0 1px #0ea5e9;
}

td.is-unmapped {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 600;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hidden {
  display: none;
}

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 0.5s ease forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .shell {
    width: 94vw;
    margin-top: 18px;
  }

  .panel {
    padding: 16px;
  }

  .previewHeader {
    flex-direction: column;
    align-items: stretch;
  }

  .previewActions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
