:root {
  color-scheme: light;
  --bg: #f5f2ee;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #5b6570;
  --accent: #2b6bb8;
  --accent-strong: #1f5291;
  --accent-soft: #e0edf9;
  --outline: #e4ded7;
  --shadow: 0 20px 40px rgba(16, 24, 32, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(circle at 5% 10%, #fffaf2 0%, #f5f2ee 45%, #eef2f6 100%);
  min-height: 100vh;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(43, 107, 184, 0.1);
  filter: blur(0);
  z-index: -1;
  pointer-events: none;
}

body::before {
  top: -140px;
  right: -120px;
}

body::after {
  bottom: -160px;
  left: -120px;
  background: rgba(28, 143, 112, 0.1);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0 0 0.6rem 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.site-header {
  padding: 2.5rem 5vw 1.5rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.header-inner h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.header-meta {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 2rem;
  padding: 0 5vw 3rem;
}

.form-column,
.preview-column {
  min-width: 0;
}

.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--outline);
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

input,
select,
textarea {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(43, 107, 184, 0.25);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.4rem 1rem;
  margin-top: 0.5rem;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  background: #fbfbfb;
  font-weight: 600;
  color: var(--muted);
}

.toggle input {
  display: none;
}

.toggle-control {
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: #d7dbe0;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-control::after {
  content: "";
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-control {
  background: var(--accent);
}

.toggle input:checked + .toggle-control::after {
  transform: translateX(22px);
}

.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.btn {
  border: none;
  background: #eef2f6;
  color: var(--ink);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(21, 39, 54, 0.12);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3a7bd5);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--outline);
}

.report-panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--outline);
  padding: 1.5rem;
  position: sticky;
  top: 1.5rem;
}

.report-header {
  border-bottom: 1px solid var(--outline);
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
}

.report-body h1 {
  font-size: 1.6rem;
  margin-bottom: 0.8rem;
}

.report-body h2 {
  font-size: 1.2rem;
  margin-top: 1.4rem;
}

.report-body p {
  color: var(--ink);
  line-height: 1.6;
  margin: 0.4rem 0 0.8rem;
}

.report-body ul {
  padding-left: 1.2rem;
  margin: 0.4rem 0 1rem;
}

.report-body li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.35rem;
}

.pill-p0 {
  background: #d64545;
  color: #fff;
}

.pill-p1 {
  background: #f0b429;
  color: #402b00;
}

.pill-p2 {
  background: #2f855a;
  color: #fff;
}

.checkbox-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #9aa3ad;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5vw 2.5rem;
  color: var(--muted);
}

.link {
  background: none;
  border: none;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.status {
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: #b42318;
}

.status.success {
  color: #2f855a;
}

.toast-container {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 10;
}

.toast {
  background: #1f2937;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in 0.25s ease forwards;
}

.toast.success {
  background: #1f7a4c;
}

.toast.error {
  background: #b42318;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gate {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 32, 0.5);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 20;
}

.gate[hidden] {
  display: none;
}

.gate-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--outline);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
}

.gate-header {
  margin-bottom: 1.5rem;
}

.gate-header h1 {
  font-size: 1.6rem;
}

.gate-subtitle {
  margin-top: 0.6rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent-strong);
  font-weight: 700;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .report-panel {
    position: static;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .form-column,
  .site-footer,
  .toast-container,
  #email-gate {
    display: none !important;
  }

  .layout {
    padding: 0;
  }

  .report-panel {
    box-shadow: none;
    border: none;
  }
}
