:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #18211f;
  --muted: #66736f;
  --line: #ded9ca;
  --accent: #1c7c6a;
  --accent-dark: #11594c;
  --gold: #b97919;
  --danger: #b43b3b;
  --soft-green: #e3f2eb;
  --soft-gold: #f6ecd7;
  --soft-red: #f8e5e1;
  --shadow: 0 18px 45px rgba(39, 45, 43, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
a.ghost-link {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 14px 28px;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy span,
.note,
.empty-state span,
.control-item span,
.audit-box span,
.connector-list span,
.seed-list span,
.plan-row em,
.quality-item span {
  color: var(--muted);
}

.top-nav {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 7px;
}

.top-nav a:hover {
  color: var(--ink);
  background: #ece8dc;
}

main {
  display: grid;
  gap: 28px;
  padding: 28px;
}

.workspace,
.results-section,
.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 20px;
  align-items: stretch;
}

.results-section {
  grid-template-columns: minmax(280px, 0.35fr) minmax(0, 1fr);
}

.panel {
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-heading,
.section-heading,
.results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
}

.status-pill,
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid #c9ddce;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--soft-green);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.locked {
  color: #7b4a0c;
  border-color: #e7c98e;
  background: var(--soft-gold);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 260px;
  margin-top: 22px;
  padding: 26px;
  text-align: center;
  border: 2px dashed #b9c7c1;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(28, 124, 106, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(185, 121, 25, 0.08) 1px, transparent 1px),
    var(--surface-strong);
  background-size: 28px 28px;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background-color: var(--soft-green);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-icon {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #f1eadb;
}

.dropzone-icon::before,
.dropzone-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
}

.dropzone-icon::before {
  top: 18px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.dropzone-icon::after {
  bottom: 14px;
  width: 38px;
  height: 20px;
  border-radius: 30px 30px 8px 8px;
}

.dropzone-title {
  font-size: 22px;
  font-weight: 800;
}

.dropzone-copy {
  max-width: 360px;
  margin-top: 8px;
  color: var(--muted);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  min-height: 110px;
  margin: 16px 0;
}

.file-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eee7d9;
}

.file-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-tile button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(24, 33, 31, 0.78);
}

.file-meta {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  color: #fff;
  background: rgba(24, 33, 31, 0.78);
  font-size: 11px;
  font-weight: 700;
}

.consent-row,
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.consent-row {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbf7ee;
  line-height: 1.4;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  border: 1px solid var(--accent-dark);
  background: var(--accent);
}

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

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

.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.secondary-button:hover {
  border-color: #bbb29d;
}

.ghost-button {
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-weight: 800;
}

.ghost-button:hover,
.ghost-link:hover {
  color: var(--ink);
  background: #ece8dc;
}

.small-button {
  min-height: 36px;
  padding-inline: 12px;
}

.full-width {
  width: 100%;
}

.note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.meter {
  overflow: hidden;
  height: 12px;
  margin: 18px 0;
  border-radius: 999px;
  background: #e4dfd2;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transition: width 260ms ease;
}

.pipeline {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0 0 18px;
  list-style: none;
}

.pipeline li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.pipeline li > span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #bbb29d;
}

.pipeline em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.pipeline li.active > span {
  border-color: var(--gold);
  background: var(--gold);
}

.pipeline li.done > span {
  border-color: var(--accent);
  background: var(--accent);
}

.quality-list {
  display: grid;
  gap: 10px;
}

.quality-item {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbf9f3;
}

.quality-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quality-topline b {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.quality-chip.warn {
  color: #7b4a0c;
  background: var(--soft-gold);
}

.quality-chip.bad {
  color: var(--danger);
  background: var(--soft-red);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 18px;
  text-align: center;
  border: 1px dashed #cfc6b5;
  border-radius: var(--radius);
  background: #fbf8f0;
}

.empty-state.wide {
  min-height: 280px;
}

.plan-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.plan-row span {
  display: grid;
  gap: 4px;
}

.plan-row em {
  font-style: normal;
  font-size: 13px;
}

.plan-row b {
  white-space: nowrap;
  font-size: 18px;
}

.plan-row.selected {
  border-color: var(--accent);
  background: var(--soft-green);
}

.audit-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 13px;
  border-radius: 7px;
  background: #f3eee2;
  line-height: 1.45;
}

.results-toolbar {
  align-items: flex-end;
  margin-bottom: 18px;
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
}

.toolbar-controls label:not(.switch-row),
.field {
  display: grid;
  gap: 6px;
}

.toolbar-controls label span,
.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input[type="email"],
input[type="url"] {
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.result-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.result-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #ddd4c3;
}

.result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92);
  transform: scale(1.04);
}

.result-card.locked .result-image img {
  filter: blur(9px) saturate(0.75);
}

.result-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(24, 33, 31, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.result-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.result-body h3 {
  display: -webkit-box;
  min-height: 44px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 16px;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.result-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #f1ece1;
  font-size: 12px;
  font-weight: 800;
}

.source-url {
  display: block;
  min-height: 42px;
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.source-url.locked {
  color: transparent;
  text-shadow: 0 0 8px rgba(24, 33, 31, 0.55);
  user-select: none;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions a,
.card-actions button {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.card-actions a {
  display: grid;
  place-items: center;
}

.section-heading {
  margin-bottom: 16px;
}

.metric-grid,
.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric,
.control-item {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric b {
  font-size: 28px;
}

.metric span,
.control-item span {
  line-height: 1.45;
}

.seed-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 18px 0;
}

.seed-list,
.connector-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.seed-list li,
.connector-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.seed-list span,
.connector-list span {
  text-align: right;
}

.controls-section {
  padding-bottom: 28px;
}

.checkout-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.checkout-dialog::backdrop {
  background: rgba(24, 33, 31, 0.56);
}

.checkout-card {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-strong);
  font-weight: 800;
}

.checkout-summary {
  display: grid;
  gap: 8px;
  padding: 13px;
  border-radius: 7px;
  background: #f2eadb;
}

.ad-band {
  min-height: 96px;
}

.ad-slot,
.ad-placeholder {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 14px;
  border: 1px dashed #cfc6b5;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.public-info {
  min-width: 0;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.faq-grid details {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.faq-grid summary {
  cursor: pointer;
  font-weight: 900;
}

.faq-grid p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-login {
  max-width: 760px;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 22px;
}

.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.site-footer div {
  display: grid;
  gap: 6px;
  max-width: 680px;
}

.site-footer strong {
  color: var(--ink);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.legal-page {
  width: min(880px, calc(100% - 28px));
  margin: 0 auto;
}

.legal-page .panel {
  display: grid;
  gap: 16px;
}

.legal-page h1 {
  margin-bottom: 4px;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-page ul {
  margin: 0;
  padding-left: 22px;
}

.checkout-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.checkout-price s {
  color: var(--muted);
  font-weight: 700;
}

.checkout-price b {
  font-size: 24px;
}

.discount-line {
  color: var(--accent-dark);
  font-weight: 800;
}

.code-note {
  min-height: 22px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.code-note.valid {
  color: var(--accent-dark);
}

@media (max-width: 1120px) {
  .workspace,
  .results-section,
  .ops-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-header {
    position: static;
    flex-wrap: wrap;
    padding: 14px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 100%;
  }

  .top-nav {
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    width: 100%;
  }

  main {
    padding: 14px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .dropzone {
    min-height: 220px;
  }

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

  .result-grid,
  .metric-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .results-toolbar,
  .section-heading {
    display: grid;
  }

  .toolbar-controls {
    justify-content: start;
  }

  .seed-form {
    grid-template-columns: 1fr;
  }

  .faq-grid,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}
