:root {
  --bg: #f5efe2;
  --bg-accent: #e0d4bc;
  --panel: rgba(255, 250, 242, 0.86);
  --line: rgba(74, 58, 34, 0.15);
  --text: #2d2419;
  --muted: #6d5d47;
  --brand: #1d6f5f;
  --brand-dark: #145548;
  --danger: #9a2f2f;
  --success: #235d39;
  --shadow: 0 20px 60px rgba(45, 36, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 111, 95, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(181, 127, 58, 0.22), transparent 28%),
    linear-gradient(135deg, var(--bg), #f2e7d2 40%, var(--bg-accent));
  font-family: Georgia, "Times New Roman", serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar,
.section-header,
.mapping-row,
.template-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stack {
  display: grid;
  gap: 20px;
}

.hero-card,
.panel,
.subpanel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.subpanel {
  padding: 18px;
}

.hero-card {
  min-height: calc(100vh - 80px);
  display: grid;
  align-items: center;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy h1,
.panel h1,
.panel h2 {
  margin: 0 0 12px;
  line-height: 1.05;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 5vw, 5rem);
}

.panel h1 {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
}

.panel h2 {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}

.subtle {
  color: var(--muted);
}

.brand,
.secondary-link {
  color: var(--text);
  text-decoration: none;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
}

.primary-button,
.ghost-button,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font: inherit;
}

.primary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.ghost-button,
.secondary-link {
  border: 1px solid var(--line);
  background: transparent;
}

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

.field span {
  font-size: 0.94rem;
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(45, 36, 25, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.flash {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
}

.flash-success {
  background: rgba(35, 93, 57, 0.12);
  color: var(--success);
}

.flash-error {
  background: rgba(154, 47, 47, 0.12);
  color: var(--danger);
}

.cards-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.template-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.template-card input {
  width: auto;
  margin-bottom: 12px;
}

.template-card-body pre,
.preview-box pre {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(45, 36, 25, 0.06);
  white-space: pre-wrap;
}

.mapping-row {
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.preview-box {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(29, 111, 95, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .topbar,
  .section-header,
  .mapping-row,
  .template-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

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