@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;600;700&display=swap");

:root {
  --primary-950: #020912;
  --primary-900: #050e28;
  --primary-800: #0a1b3d;
  --primary-700: #14264a;
  --primary-600: #243657;
  --accent: #0a5fef;
  --accent-600: #1a6bff;
  --accent-pale: #e7effd;
  --accent-mist: #f2f6fd;
  --gold: #c8a35b;
  --ink: #0a1b3d;
  --ink-2: #46556f;
  --ink-3: #7c8aa3;
  --paper: #fbfcfe;
  --mist: #eef2f9;
  --line: #dce4f0;
  --line-2: #c9d5e6;
  --success: #1a7a4a;
  --warning: #c8852b;
  --danger: #c0392b;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --bg: var(--paper);
  --panel: #ffffff;
  --muted: var(--ink-2);
  --soft: var(--accent-mist);
  --green: var(--accent);
  --green-dark: var(--primary-800);
  --blue: var(--accent-600);
  --pink: #be185d;
  --amber: var(--warning);
  --red: var(--danger);
  --shadow-sm: 0 1px 3px rgba(10, 27, 61, 0.06), 0 1px 2px rgba(10, 27, 61, 0.04);
  --shadow: 0 8px 30px rgba(10, 27, 61, 0.08);
  --shadow-lg: 0 20px 60px rgba(10, 27, 61, 0.14);
  --r-sm: 6px;
  --r: 12px;
  --r-lg: 20px;
  --r-pill: 100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 460px at 88% -120px, rgba(10, 95, 239, 0.14), transparent 62%),
    linear-gradient(180deg, #f8fbff 0%, var(--paper) 220px, #f4f7fc 100%);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  min-height: 40px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:hover {
  border-color: var(--primary-800);
  background: var(--primary-800);
  color: #fff;
  transform: translateY(-1px);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
  box-shadow: 0 8px 24px rgba(10, 95, 239, 0.32);
}

button.danger-button {
  border-color: #fecaca;
  background: #fee2e2;
  color: var(--red);
  font-weight: 800;
}

button.danger-button:hover {
  border-color: var(--red);
  background: #fecaca;
  color: #7f1d1d;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 95, 239, 0.12);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #34424d;
  font-size: 13px;
  font-weight: 700;
}

.app {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.eyebrow,
.result-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 82px;
  height: 82px;
  color: #20b9bd;
}

.brand-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.brand-word {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.brand-global {
  color: var(--primary-800);
}

.brand-leads {
  color: #20b9bd;
}

.brand-tagline {
  margin: 0;
  color: var(--ink-2);
  font-size: clamp(15px, 1.8vw, 21px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #b9c5cc;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.language-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 0;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.language-switch button.active {
  background: var(--green);
  color: #fff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
}

.status.idle {
  background: #e7f3f1;
  color: var(--green-dark);
}

.status.running {
  background: #fff7ed;
  color: var(--amber);
}

.status.done {
  background: #dbeafe;
  color: #1d4ed8;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.starter-guide {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.starter-guide-head {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.starter-guide-head h2 {
  font-size: 18px;
}

.starter-guide-head p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.starter-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.starter-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 9px;
  align-content: start;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-mist);
  color: var(--ink);
  padding: 12px;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.starter-step:hover {
  border-color: rgba(10, 95, 239, 0.35);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.starter-step span {
  display: inline-flex;
  grid-row: span 2;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.starter-step strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
}

.starter-step em {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
}

#search-panel,
#api-panel,
#pipeline-panel,
#query-panel,
#poster-panel,
#lead-results {
  scroll-margin-top: 96px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 15px 16px;
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.control-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.control-panel::-webkit-scrollbar {
  width: 10px;
}

.control-panel::-webkit-scrollbar-track {
  background: #eef3f5;
  border-radius: 999px;
}

.control-panel::-webkit-scrollbar-thumb {
  background: #b9c5cc;
  border: 2px solid #eef3f5;
  border-radius: 999px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
  background: #91a0aa;
}

.main-stack {
  display: grid;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.keyword-manager {
  margin-bottom: 16px;
}

.keyword-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.keyword-title {
  margin: 0;
}

.keyword-title > span:first-child,
.city-title > span:first-child {
  display: block;
}

.keyword-title #keywordCount {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.keyword-pool-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.keyword-pool-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.keyword-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.keyword-hint {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.keyword-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.keyword-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #d9e1e6;
  border-radius: 7px;
  background: #fff;
  padding: 10px;
}

.keyword-row.disabled {
  opacity: 0.58;
}

.keyword-check {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.keyword-check input {
  width: 16px;
  height: 16px;
}

.keyword-copy {
  min-width: 0;
}

.keyword-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.keyword-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.keyword-line span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #edf2f4;
  color: #34424d;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 850;
}

.keyword-row p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.keyword-actions {
  display: flex;
  gap: 6px;
}

.keyword-actions button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.city-picker {
  margin-bottom: 14px;
}

.city-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.city-title {
  margin: 0;
}

.city-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.city-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.city-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.city-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.city-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid #d9e1e6;
  border-radius: 6px;
  background: #fff;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  margin: 0;
}

.city-option input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.city-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-city-label {
  margin-top: 12px;
}

.option-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 14px;
  padding: 12px 14px 4px;
  background: #fbfcfd;
}

.option-box legend {
  padding: 0 6px;
  color: #34424d;
  font-size: 13px;
  font-weight: 800;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-weight: 650;
}

.checkline input {
  width: 16px;
  height: 16px;
}

.api-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px 14px;
}

.api-box summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.api-fields {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.api-key-field {
  display: grid;
  gap: 7px;
}

.api-status {
  margin: -4px 0 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f5;
  padding: 8px 10px;
  color: #4b5d66;
  font-size: 12px;
  font-weight: 800;
}

.api-status[data-state="connecting"] {
  border-color: #bdd3ff;
  background: #eef5ff;
  color: #2b5aa8;
}

.api-status[data-state="connected"] {
  border-color: #b9dfc8;
  background: #eefaf2;
  color: var(--green-dark);
}

.api-status[data-state="error"] {
  border-color: #f1c2ba;
  background: #fff2ef;
  color: #a63d2d;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebef;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 220ms ease;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.step {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.step strong,
.step span {
  display: block;
}

.step strong {
  font-size: 14px;
}

.step span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.step.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #e7f3f1;
}

.query-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 185px;
  overflow: auto;
}

.query-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
  color: #34424d;
  font-size: 13px;
  line-height: 1.4;
}

.query-item strong,
.query-item span {
  display: block;
}

.query-item strong {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
}

.query-item span {
  overflow-wrap: anywhere;
}

.panel-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.poster-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.poster-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.profile-result {
  margin-bottom: 14px;
}

.profile-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.profile-title {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 900;
}

.profile-field {
  display: grid;
  gap: 3px;
}

.profile-field strong {
  color: #34424d;
  font-size: 12px;
}

.profile-field span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.contact-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.two-col.compact {
  gap: 8px;
}

.product-preview,
.poster-preview {
  display: grid;
  place-items: center;
  border: 1px dashed #b9c5cc;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  overflow: hidden;
}

.product-preview {
  min-height: 180px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.product-preview.dragging {
  border-color: var(--green);
  background: #e7f3f1;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.product-preview-inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.poster-preview {
  aspect-ratio: 4 / 5;
  min-height: 430px;
}

.poster-progress {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.poster-progress[hidden] {
  display: none;
}

.poster-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #34424d;
  font-size: 12px;
  font-weight: 800;
}

.poster-progress-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.poster-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebef;
}

.poster-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #2563eb);
  transition: width 220ms ease;
}

.product-preview-inner img,
.poster-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.poster-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.poster-actions button {
  flex: 1;
}

.poster-iterations {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.iteration-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.iteration-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 5px;
}

.iteration-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.iteration-card summary {
  margin-top: 8px;
  cursor: pointer;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.iteration-card pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 6px;
  background: #17212a;
  color: #e7eef2;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.result-head {
  align-items: end;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto auto auto auto;
  gap: 10px;
}

.selected-count,
.email-campaign-status {
  grid-column: 1 / -1;
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.email-campaign-status {
  margin-top: -12px;
}

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

.empty {
  border: 1px dashed #b9c5cc;
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.empty.small {
  padding: 14px;
  font-size: 12px;
}

.lead-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 260px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.lead-select {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 2px 0 0;
}

.lead-select input {
  width: 18px;
  height: 18px;
}

.lead-main {
  min-width: 0;
}

.lead-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lead-title h3 {
  margin: 0;
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.pill.high {
  background: #dcfce7;
  color: #166534;
}

.pill.review {
  background: #fff7ed;
  color: var(--amber);
}

.pill.score {
  background: #edf2f4;
  color: #34424d;
}

.pill.email.sent {
  background: #dcfce7;
  color: #166534;
}

.pill.email.failed {
  background: #fee2e2;
  color: var(--red);
}

.pill.email.sending {
  background: #dbeafe;
  color: #1d4ed8;
}

.pill.email.scheduled {
  background: #fef3c7;
  color: #92400e;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.lead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lead-links a {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.lead-contact-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.lead-contact-editor input {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.lead-contact-editor button {
  grid-column: 1 / -1;
}

.ins {
  background: #fce7f3;
  color: var(--pink);
}

.fb {
  background: #dbeafe;
  color: #1d4ed8;
}

.web,
.maps {
  background: #edf2f4;
  color: #34424d;
}

.lead-side {
  display: grid;
  gap: 8px;
  align-content: start;
}

.mini-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.mini-stat strong {
  color: var(--ink);
}

.lead-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 4px;
}

.lead-actions button {
  width: 100%;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(430px, calc(100vw - 40px));
  border-radius: 8px;
  background: #17212a;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.copy-buffer {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

  .starter-guide {
    grid-template-columns: 1fr;
  }

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

  .control-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app {
    width: min(100vw - 20px, 1440px);
    padding-top: 14px;
  }

  .topbar,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .starter-steps,
  .pipeline,
  .query-list,
  .poster-grid,
  .lead-card,
  .filters,
  .lead-contact-editor,
  .keyword-entry,
  .keyword-head,
  .keyword-row,
  .city-head,
  .city-options,
  .two-col {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .top-actions button,
  .top-actions .status,
  .top-actions .language-switch {
    width: 100%;
    min-width: 0;
  }

  .top-actions .status {
    justify-content: center;
  }

  .brand-lockup {
    gap: 14px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
  }

  .brand-word {
    font-size: 32px;
  }

  .brand-tagline {
    font-size: 14px;
  }

  .city-actions {
    justify-content: flex-start;
  }

  .keyword-actions {
    justify-content: stretch;
  }

  .keyword-pool-actions {
    justify-content: flex-start;
  }

  .keyword-actions button {
    flex: 1;
  }

  .selected-count {
    text-align: left;
  }

  .email-campaign-status {
    text-align: left;
  }
}

/* Nova Edge template skin */
.app {
  width: min(1480px, calc(100vw - 40px));
  padding: 22px 0 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -20px 20px;
  padding: 14px 20px;
  border: 1px solid rgba(220, 228, 240, 0.8);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: rgba(251, 252, 254, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 9px;
  background: var(--accent);
  clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(31px, 3.8vw, 48px);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--primary-800);
}

h2,
.section-head h2 {
  color: var(--primary-800);
  font-size: 18px;
  font-weight: 800;
}

.language-switch {
  border-color: var(--line-2);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}

.language-switch button {
  border-radius: 0;
  color: var(--ink-2);
}

.language-switch button:hover {
  transform: none;
}

.language-switch button.active {
  background: var(--primary-800);
  color: #fff;
}

.status {
  border: 1px solid transparent;
  font-weight: 800;
}

.status.idle {
  background: var(--accent-pale);
  color: var(--accent);
  border-color: rgba(10, 95, 239, 0.12);
}

.status.running {
  background: rgba(200, 133, 43, 0.12);
  color: var(--warning);
  border-color: rgba(200, 133, 43, 0.22);
}

.status.done {
  background: #e6f6ec;
  color: var(--success);
  border-color: rgba(26, 122, 74, 0.18);
}

.summary-grid {
  gap: 16px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border-color: var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 102px;
  padding: 22px 22px 20px;
}

.metric::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 18px;
  width: 38px;
  height: 5px;
  background: var(--accent);
  clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
}

.metric span {
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 8px;
  font-family: var(--serif);
  color: var(--accent);
  font-size: 34px;
  font-weight: 700;
}

.workspace {
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 18px;
}

.panel {
  padding: 22px;
}

.control-panel {
  top: 92px;
  border-top: 4px solid var(--primary-800);
}

.section-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.keyword-list,
.city-options,
.option-box,
.api-box,
.profile-card,
.poster-progress,
.iteration-card {
  border-color: var(--line);
  border-radius: var(--r);
  background: var(--accent-mist);
}

.keyword-row,
.city-option,
.query-item,
.step,
.lead-card {
  border-color: var(--line);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.keyword-row:hover,
.city-option:hover,
.query-item:hover,
.lead-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}

.keyword-line span,
.pill,
.lead-links a {
  border-radius: var(--r-pill);
}

.keyword-line span,
.pill.score,
.web,
.maps {
  background: var(--mist);
  color: var(--ink-2);
}

.city-option {
  min-height: 38px;
  color: var(--primary-800);
}

.city-option:has(input:checked) {
  border-color: rgba(10, 95, 239, 0.32);
  background: var(--accent-pale);
  color: var(--accent);
}

.option-box legend,
.api-box summary,
.profile-field strong {
  color: var(--primary-800);
}

.api-status {
  border-radius: var(--r);
  background: var(--mist);
  color: var(--ink-2);
}

.api-status[data-state="connecting"],
.api-status[data-state="connected"] {
  border-color: rgba(10, 95, 239, 0.22);
  background: var(--accent-pale);
  color: var(--accent);
}

.api-status[data-state="error"] {
  border-color: rgba(192, 57, 43, 0.22);
  background: #fff2ef;
  color: var(--danger);
}

.progress-track,
.poster-progress-track {
  background: var(--mist);
}

.progress-bar,
.poster-progress-bar {
  background: linear-gradient(90deg, var(--accent), #6fa0ff);
}

.pipeline {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.step {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.step:last-child {
  border-right: 0;
}

.step.active {
  background: var(--accent-mist);
}

.step.active strong {
  color: var(--accent);
}

.query-list {
  gap: 10px;
}

.query-item strong,
.profile-title,
.iteration-card summary {
  color: var(--accent);
}

.product-preview,
.poster-preview,
.empty {
  border-color: var(--line-2);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 246, 253, 0.72)),
    var(--accent-mist);
}

.product-preview.dragging {
  border-color: var(--accent);
  background: var(--accent-pale);
  box-shadow: 0 0 0 3px rgba(10, 95, 239, 0.12);
}

.result-head p,
.panel-subtitle,
.selected-count,
.email-campaign-status,
.lead-meta,
.mini-stat,
.iteration-card p,
.profile-field span,
.keyword-row p,
.keyword-hint,
.step span,
.query-item,
label {
  color: var(--ink-2);
}

.filters {
  align-items: center;
}

.lead-card {
  grid-template-columns: auto minmax(0, 1fr) 270px;
  padding: 18px;
}

.lead-title h3 {
  color: var(--primary-800);
  font-size: 17px;
  font-weight: 800;
}

.lead-select input,
.keyword-check input,
.city-option input,
.checkline input {
  accent-color: var(--accent);
}

.pill.high,
.pill.email.sent {
  background: #e6f6ec;
  color: var(--success);
}

.pill.review,
.pill.email.scheduled {
  background: rgba(200, 163, 91, 0.15);
  color: #9b7530;
}

.pill.email.failed {
  background: #fee7e3;
  color: var(--danger);
}

.pill.email.sending {
  background: var(--accent-pale);
  color: var(--accent);
}

.ins {
  background: #fce7f3;
  color: var(--pink);
}

.fb {
  background: var(--accent-pale);
  color: var(--accent);
}

.lead-links a:hover {
  color: #fff;
  background: var(--primary-800);
}

.mini-stat strong {
  color: var(--primary-800);
}

.toast {
  border-radius: var(--r);
  background: var(--primary-900);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 1080px) {
  .control-panel {
    top: auto;
  }
}

@media (max-width: 760px) {
  .app {
    width: min(100vw - 20px, 1480px);
  }

  .topbar {
    margin: 0 0 16px;
    border-radius: var(--r-lg);
  }

  .pipeline .step {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pipeline .step:last-child {
    border-bottom: 0;
  }
}
