:root {
  --bg: #07130d;
  --bg-deep: #040907;
  --panel: rgba(10, 29, 18, 0.82);
  --panel-strong: rgba(5, 20, 12, 0.92);
  --line: rgba(245, 196, 73, 0.22);
  --line-strong: rgba(245, 196, 73, 0.45);
  --text: #f8f3e8;
  --text-soft: #ced8cb;
  --accent: #f5c449;
  --accent-2: #37b36b;
  --danger: #ff8ea1;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 18px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Avenir Next", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(55, 179, 107, 0.22), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(245, 196, 73, 0.16), transparent 24%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  line-height: 1.45;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
}

.ambient-a {
  top: 40px;
  right: -80px;
  width: 300px;
  height: 300px;
  background: rgba(245, 196, 73, 0.2);
}

.ambient-b {
  left: -120px;
  bottom: 120px;
  width: 360px;
  height: 360px;
  background: rgba(55, 179, 107, 0.16);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

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

.hero {
  background: linear-gradient(135deg, rgba(8, 34, 20, 0.96), rgba(8, 17, 12, 0.88));
  padding: 28px;
}

.eyebrow,
.section-label,
.summary-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  max-width: 780px;
}

.hero-copy,
.builder-copy,
.summary-card p,
.status-message,
.field span {
  color: var(--text-soft);
}

.hero-copy {
  max-width: 760px;
  margin: 14px 0 0;
  font-size: 1rem;
}

.hero-actions,
.form-actions,
.builder-actions,
.stacked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 22px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.summary-card {
  background: linear-gradient(180deg, rgba(8, 28, 18, 0.8), rgba(6, 17, 12, 0.86));
  padding: 18px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.98fr) minmax(360px, 1.15fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  background: var(--panel);
}

.form-panel,
.output-panel,
.builder-panel {
  padding: 20px;
}

.output-panel {
  max-height: calc(100vh - 64px);
  overflow: auto;
}

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

.sticky-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--panel-strong) 0%, rgba(5, 20, 12, 0.85) 100%);
  padding-bottom: 14px;
  margin: -20px -20px 0;
  padding: 20px;
  border-bottom: 1px solid rgba(245, 196, 73, 0.12);
}

.field-grid,
.lead-field-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lead-field-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

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

.field-wide {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(245, 196, 73, 0.22);
  background: rgba(3, 13, 8, 0.78);
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(245, 196, 73, 0.7);
  box-shadow: 0 0 0 3px rgba(245, 196, 73, 0.16);
}

.checkbox-field {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #d49f19);
  color: #161106;
}

.btn-secondary {
  background: rgba(55, 179, 107, 0.15);
  border-color: rgba(55, 179, 107, 0.42);
  color: var(--text);
}

.btn-ghost {
  background: rgba(245, 196, 73, 0.08);
  border-color: rgba(245, 196, 73, 0.28);
  color: #ffe7ae;
}

.status-message {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.prompt-card {
  margin-top: 14px;
  border: 1px solid rgba(245, 196, 73, 0.18);
  border-radius: 14px;
  background: rgba(4, 15, 9, 0.8);
  padding: 14px;
}

.prompt-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e3eef9;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

.rows-badge {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(245, 196, 73, 0.12);
  color: #ffe08f;
  font-weight: 700;
  font-size: 0.82rem;
}

.table-wrap {
  margin-top: 14px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(245, 196, 73, 0.18);
}

.lead-table {
  border-collapse: collapse;
  min-width: 100%;
  width: max-content;
  background: rgba(4, 14, 9, 0.72);
}

.lead-table th,
.lead-table td {
  padding: 8px 10px;
  border-right: 1px solid rgba(245, 196, 73, 0.1);
  border-bottom: 1px solid rgba(245, 196, 73, 0.14);
  text-align: left;
  vertical-align: top;
  max-width: 320px;
  font-size: 0.82rem;
}

.lead-table th {
  position: sticky;
  top: 0;
  background: rgba(6, 18, 12, 0.96);
  z-index: 1;
}

.lead-table td {
  white-space: pre-wrap;
  word-break: break-word;
}

.table-empty {
  text-align: center;
  color: var(--text-soft);
}

.table-delete-btn {
  border: 1px solid rgba(255, 142, 161, 0.42);
  background: rgba(255, 142, 161, 0.12);
  color: #ffdbe3;
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  font-weight: 700;
}

.reveal {
  animation: lift-fade 0.44s ease both;
}

@keyframes lift-fade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .output-panel {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 16px, 1280px);
    padding-top: 16px;
  }

  .hero,
  .form-panel,
  .output-panel,
  .builder-panel,
  .sticky-head {
    padding: 16px;
  }

  .sticky-head {
    margin: -16px -16px 0;
  }

  .field-grid,
  .lead-field-grid {
    grid-template-columns: 1fr;
  }
}
