:root {
  --bg: #f4efe8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --ink: #1f1c18;
  --muted: #6a635a;
  --line: rgba(43, 36, 29, 0.1);
  --accent: #c75d2c;
  --accent-dark: #8e3f19;
  --accent-soft: rgba(199, 93, 44, 0.14);
  --olive: #27443b;
  --error: #b13b22;
  --shadow: 0 22px 60px rgba(49, 33, 20, 0.12);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(199, 93, 44, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(39, 68, 59, 0.12), transparent 28%),
    linear-gradient(180deg, #f8f2eb 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 28, 24, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 28, 24, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 90%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.hero,
.layout,
.results-layout,
.metric-grid {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: 1.5fr minmax(260px, 320px);
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.card,
.security-banner {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.hero-panel {
  padding: 28px;
  display: grid;
  gap: 18px;
  align-content: start;
  background:
    linear-gradient(160deg, rgba(39, 68, 59, 0.96), rgba(24, 46, 39, 0.96)),
    var(--surface-strong);
  color: #f4efe8;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent);
}

.section-kicker {
  color: var(--olive);
}

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

h1 {
  font-size: clamp(2.6rem, 5vw, 4.7rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

h3 {
  font-size: 1.35rem;
}

.hero-text,
.section-copy,
.field span,
.form-message,
.timeline-item p,
.business-summary p,
.benchmark-item span,
table,
.security-banner,
.empty-state,
.debug-row span {
  color: var(--muted);
}

.hero-text {
  max-width: 40rem;
  margin: 18px 0 24px;
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges span,
.hero-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
}

.hero-badges span {
  background: #fff6f1;
  color: var(--accent-dark);
  border: 1px solid rgba(199, 93, 44, 0.18);
}

.hero-stat {
  display: grid;
  gap: 4px;
}

.hero-stat strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.5rem;
}

.hero-note {
  justify-self: start;
  background: rgba(255, 255, 255, 0.12);
  color: #f9efe5;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.layout {
  grid-template-columns: 1.1fr 0.9fr;
  margin-bottom: 20px;
}

.card {
  padding: 26px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid rgba(43, 36, 29, 0.12);
  border-radius: 18px;
  padding: 15px 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: rgba(199, 93, 44, 0.52);
  box-shadow: 0 0 0 5px rgba(199, 93, 44, 0.12);
  transform: translateY(-1px);
}

.form-actions,
.result-actions,
.retry-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 8px;
}

button,
.ghost-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

button {
  color: #fff7f2;
  background: linear-gradient(135deg, var(--accent), #e07847);
  cursor: pointer;
}

button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

button:disabled,
.ghost-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ghost-button {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.secondary-button {
  background: linear-gradient(135deg, var(--olive), #396258);
}

.status-timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(43, 36, 29, 0.06);
}

.timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 50%;
  background: #b7b0a8;
}

.timeline-item.is-active .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(199, 93, 44, 0.14);
}

.timeline-item.is-complete .timeline-dot {
  background: var(--olive);
  box-shadow: 0 0 0 6px rgba(39, 68, 59, 0.12);
}

.timeline-item.is-error .timeline-dot {
  background: var(--error);
  box-shadow: 0 0 0 6px rgba(177, 59, 34, 0.12);
}

.security-banner {
  margin: 0 0 20px;
  padding: 16px 18px;
  font-weight: 700;
  background: rgba(255, 247, 226, 0.92);
}

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

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

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

.metric-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

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

.business-summary,
.benchmark-list,
.debug-grid {
  display: grid;
  gap: 14px;
}

.summary-row,
.benchmark-item,
.debug-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(43, 36, 29, 0.08);
}

.summary-row:last-child,
.benchmark-item:last-child,
.debug-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-row strong,
.benchmark-item strong,
.debug-row strong {
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(43, 36, 29, 0.08);
  font-size: 0.95rem;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

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

#map {
  min-height: 420px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(43, 36, 29, 0.08);
}

.empty-state {
  margin-top: 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

.map-card {
  min-width: 0;
}

.site-link {
  color: var(--accent-dark);
  font-weight: 700;
  word-break: break-word;
}

.retry-wrap {
  justify-content: center;
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .results-layout,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .results-header,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

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

  h1 {
    font-size: 2.4rem;
  }

  .form-actions,
  .result-actions,
  .retry-wrap {
    width: 100%;
  }

  button,
  .ghost-button {
    width: 100%;
    text-align: center;
  }

  #map {
    min-height: 320px;
  }
}
