/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #eef3fb;
  --surface: #ffffff;
  --border: #d9e2f2;
  --accent: #304ba2;
  --accent-dark: #243a81;
  --accent-light: #eef2ff;
  --surface-soft: #f8fbff;
  --user-bubble: #304ba2;
  --user-text: #ffffff;
  --bot-bubble: #ffffff;
  --bot-text: #1e1e2e;
  --muted: #6b7280;
  --tag-bg: #fef3c7;
  --tag-text: #92400e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --radius: 16px;
  --radius-sm: 8px;
  --font-sans: "Plus Jakarta Sans", "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Plus Jakarta Sans", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(180deg, #f3f6fc 0%, var(--bg) 100%);
  color: var(--bot-text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── App wrapper ─────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 16px 22px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  flex-shrink: 0;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, #3c5cc5, #284290);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.2px;
}
.header-tagline { font-size: 12px; color: var(--muted); margin-left: auto; font-weight: 600; }

/* ── Workspace layout ────────────────────────────────────────────────────── */
.workspace-shell {
  max-width: 1400px;
  width: calc(100% - 44px);
  margin: 0 auto 14px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 360px;
  gap: 12px;
}

.ops-sidebar,
.chat-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  min-height: 0;
}

.ops-sidebar {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-title {
  font-size: 18px;
  color: #202c46;
  font-weight: 700;
}

.ops-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ops-link {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: #4b5f87;
  border-radius: 10px;
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 600;
}

.ops-link.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: #c7d2fe;
}

.ops-queue-card {
  margin-top: 4px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px;
}

.ops-queue-card h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #25365f;
}

.ops-queue-card p {
  font-size: 12px;
  color: #4b5f87;
  line-height: 1.6;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 12px;
  overflow: hidden;
  min-height: 0;
}

.workspace-strip {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.strip-item {
  font-size: 12px;
  color: #4c628f;
}

.chat-stage {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 12px;
}

/* ── Messages ────────────────────────────────────────────────────────────── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  min-height: 0;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Message row */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: fadeUp .2s ease;
}
.msg-row.user { flex-direction: row-reverse; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.msg-row.bot  .msg-avatar { background: var(--accent-light); }
.msg-row.user .msg-avatar { background: var(--user-bubble); color: #fff; }

/* Bubble */
.msg-bubble {
  max-width: min(460px, 78%);
  padding: 11px 15px;
  border-radius: var(--radius);
  line-height: 1.55;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg-row.bot  .msg-bubble {
  background: var(--bot-bubble);
  color: var(--bot-text);
  border-bottom-left-radius: 4px;
}
.msg-row.user .msg-bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

/* Markdown-like rendering inside bubbles */
.msg-bubble h2 { font-size: 1rem; font-weight: 700; margin: 8px 0 4px; }
.msg-bubble strong { font-weight: 600; }
.msg-bubble em { font-style: italic; color: inherit; opacity: .8; }
.msg-bubble p  { margin: 4px 0; }
.msg-bubble ul { padding-left: 18px; margin: 4px 0; }
.msg-bubble li { margin: 2px 0; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg-bubble code { font-family: monospace; background: rgba(0,0,0,.07); padding: 1px 4px; border-radius: 3px; font-size: .88em; }

/* Suggested tag */
.tag-suggested {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 16px;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── Quick replies ────────────────────────────────────────────────────────── */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
  min-height: 0;
}
.quick-replies.hidden { display: none; }
.quick-reply-btn {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.quick-reply-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.quick-reply-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.quick-reply-confirm {
  background: var(--accent-dark);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.quick-reply-confirm:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Run Research button ─────────────────────────────────────────────────── */
.run-research-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3554b8, #2a4699);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 2px 8px rgba(48,75,162,.28);
}
.run-research-btn:hover:not(:disabled) {
  opacity: 0.88;
  transform: translateY(-1px);
}
.run-research-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* ── Create Ads button ───────────────────────────────────────────────────── */
/* ── Post-research action row ─────────────────────────────────────────────── */
.post-research-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.create-ads-btn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #3f63cf, #2d4ea9);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.create-ads-btn:hover:not(:disabled) {
  opacity: 0.88;
  transform: translateY(-1px);
}
.create-ads-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.save-campaign-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.save-campaign-btn:hover:not(:disabled) { background: var(--accent-light); }
.save-campaign-btn:disabled { opacity: 0.6; cursor: default; }

.save-notice {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  width: 100%;
}
.save-notice a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.save-notice a:hover { text-decoration: underline; }
.ad-variants-bubble ul,
.ad-variants-bubble ol {
  padding-left: 20px;
  margin: 6px 0 0;
}
.ad-variants-bubble li {
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.5;
}
.ad-contact-strip {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 8px;
  line-height: 1.6;
}
.ad-recommended-card {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.6;
}
.ad-image-wrap {
  margin-top: 10px;
}
.ad-image-platform-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.ad-image {
  display: block;
  width: 100%;
  max-width: 440px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 3px 12px rgba(0,0,0,0.10);
  transition: box-shadow .2s;
}
.ad-image:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}
.ad-image-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Input area ──────────────────────────────────────────────────────────── */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--border);
  background: transparent;
  flex-shrink: 0;
}
.input-box {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  background: var(--surface);
  transition: border-color .15s;
  line-height: 1.4;
}
.input-box:focus { border-color: var(--accent); }
.input-box::placeholder { color: var(--muted); }
.send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.send-btn:hover  { background: var(--accent-dark); }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

/* ── Research panel (side panel on wide screens) ────────────────────────── */
.research-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 100vw);
  height: 100dvh;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s ease;
}
.research-panel.hidden { transform: translateX(100%); }
.research-panel-inner { padding: 24px 20px; }
.panel-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--border); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.research-content h2 { font-size: 1.05rem; color: var(--accent); margin-bottom: 12px; }
.research-content p  { margin: 6px 0; font-size: .93rem; line-height: 1.55; }

/* ── #7 Session resume banner ─────────────────────────────────────────────── */
.resume-banner {
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--bot-text);
  margin: 8px 0;
}
.resume-actions { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.resume-btn {
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.resume-yes { background: var(--accent); color: #fff; }
.resume-no  { background: var(--border); color: var(--bot-text); }

/* ── Bot message wrapper (holds progress bar + bubble) ───────────────────── */
.msg-bot-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(480px, 84%);
}
.msg-row.bot .msg-bubble { max-width: 100%; }

/* ── #1 Progress bar ─────────────────────────────────────────────────────── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
}
.progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.progress-track {
  display: flex;
  gap: 4px;
  align-items: center;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s;
}
.progress-dot.filled { background: var(--accent); }

/* ── #8 Inline validation hint ───────────────────────────────────────────── */
.validation-hint {
  font-size: 12px;
  padding: 0 4px 4px;
  min-height: 18px;
  transition: color .15s;
}
.validation-hint.valid   { color: #16a34a; }
.validation-hint.invalid { color: #dc2626; }

/* ── #6 Ad preview card ──────────────────────────────────────────────────── */
.ad-preview-card {
  margin-top: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafafa;
  font-family: Arial, sans-serif;
  max-width: 360px;
}
.ad-preview-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ad-preview-badge {
  background: #e8f0fe;
  color: #1a73e8;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.ad-preview-url {
  font-size: 12px;
  color: #188038;
  margin-bottom: 3px;
}
.ad-preview-headline {
  font-size: 16px;
  color: #1a0dab;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
}
.ad-preview-desc {
  font-size: 13px;
  color: #4d5156;
  line-height: 1.5;
}

/* ── Campaigns nav link ──────────────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.campaigns-nav-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: #f1f5ff;
  border-radius: 8px;
  padding: 5px 12px;
  border: 1px solid #d7e2fb;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.campaigns-nav-link:hover { background: #e2eaff; }
.new-campaign-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: #f1f5ff;
  border: 1px solid #d7e2fb;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.new-campaign-btn:hover { background: #e2eaff; }

.action-shelf {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shelf-btn {
  border: 1px solid #c7d2fe;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 18px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
}

.shelf-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.performance-rail {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  min-height: 0;
  overflow-y: auto;
}

.rail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.rail-card h3 {
  font-size: 14px;
  color: #2b3b63;
  margin-bottom: 6px;
}

.rail-card p {
  font-size: 12px;
  color: #4b618f;
  line-height: 1.55;
}

.rail-card.warning {
  background: #fff6eb;
  border-color: #ffe2bd;
}

.rail-card.warning h3,
.rail-card.warning p {
  color: #a66716;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

.kpi-grid span {
  font-size: 12px;
  color: #4b618f;
}

.kpi-grid strong {
  color: #1e2b49;
}

.kpi-grid .good {
  color: #149160;
}

.status-dot {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
}

.status-dot.on {
  color: #0f766e;
  background: #ccfbf1;
}

.status-dot.muted {
  color: #6b7280;
  background: #eef2f7;
}

/* ── Ad copy mode selector (AI / Competitor / Manual) ───────────────────── */
.ad-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
}
.ad-mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  background: #f9fafb;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.ad-mode-tab:hover { background: #f0f4ff; border-color: #c7d2fe; }
.ad-mode-tab.active { background: var(--accent-light); border-color: var(--accent); }
.mode-emoji { font-size: 20px; line-height: 1; }
.mode-emoji {
  font-size: 10px;
  line-height: 1;
  background: #e5ecff;
  color: var(--accent-dark);
  border: 1px solid #cfdbff;
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.mode-label { font-size: 12px; font-weight: 700; color: #374151; line-height: 1.2; }
.ad-mode-tab.active .mode-label { color: var(--accent); }
.mode-sublabel { font-size: 10px; color: var(--muted); }

.ad-mode-panel { display: none; }
.ad-mode-panel.active { display: block; }

.mode-intro {
  font-size: 12px;
  color: #4b5563;
  margin: 10px 0 12px;
  line-height: 1.5;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.section-hint {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}
.mode-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
}
.mode-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.mode-empty p { font-size: 13px; margin: 4px 0; }
.mode-empty-hint { font-size: 11px !important; }

/* ── Manual ad form ──────────────────────────────────────────────────────── */
.manual-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.manual-field { display: flex; flex-direction: column; gap: 4px; }
.manual-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.manual-counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 20px;
}
.manual-counter.over { color: #e11d48; background: #fff1f2; }
.manual-hint { font-size: 11px; color: var(--muted); line-height: 1.4; }
.manual-input {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  transition: border-color .15s;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.manual-input:focus { outline: none; border-color: var(--accent); }

/* Live preview card */
.manual-preview-wrap { margin-top: 4px; }
.manual-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.manual-preview-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.preview-ad-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.preview-ad-badge {
  font-size: 10px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 3px;
  padding: 1px 5px;
}
.preview-url { font-size: 11px; color: #166534; }
.preview-headline-text {
  font-size: 14px;
  font-weight: 700;
  color: #1a0dab;
  margin-bottom: 4px;
  line-height: 1.3;
  word-break: break-word;
}
.preview-desc-text {
  font-size: 12px;
  color: #4d5156;
  line-height: 1.5;
  margin-bottom: 10px;
  word-break: break-word;
}
.preview-cta-btn {
  display: inline-block;
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.manual-actions { display: flex; gap: 8px; }

/* "Use this & customise" button inside inspired copy cards */
.insp-use-btn {
  margin-top: 8px;
  width: 100%;
  padding: 7px 12px;
  background: #f0fdf4;
  color: #15803d;
  border: 1.5px solid #bbf7d0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  text-align: center;
}
.insp-use-btn:hover { background: #15803d; color: #fff; border-color: #15803d; }

/* ── Platform output tabs ────────────────────────────────────────────────── */
/* ── Creative angle picker ───────────────────────────────────────────────── */
.angle-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}
.angle-tab {
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--bot-text);
  transition: all 0.15s;
}
.angle-tab:hover { border-color: var(--accent); color: var(--accent); }
.angle-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.angle-panel { display: none; }
.angle-panel.active {
  display: block;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.angle-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  font-style: italic;
}
.angle-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 8px 0 4px;
}
.angle-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
.angle-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
  line-height: 1.5;
}
.angle-list li span:first-child { flex: 1; word-break: break-word; white-space: normal; }
.angle-char {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.angle-char.over { color: #e11d48; font-weight: 700; }
.angle-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
}

/* ── Platform tabs ───────────────────────────────────────────────────────── */
.platform-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.platform-tab {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--bot-text);
  transition: all 0.15s;
}
.platform-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.platform-output { display: none; }
.platform-output.active { display: block; }

.pf-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  flex-wrap: wrap;
}
.pf-row:last-child { border-bottom: none; }
.pf-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 100px;
  flex-shrink: 0;
}
.pf-val { flex: 1; color: #1e1e2e; word-break: break-word; }
.pf-val.over-limit { color: #e11d48; }
.pf-chars { font-size: 10px; color: var(--muted); white-space: nowrap; }
.pf-chars.over { color: #e11d48; font-weight: 700; }

/* ── Performance benchmarks ──────────────────────────────────────────────── */
.benchmarks-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.bm-chip {
  background: #f3f4f6;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.bm-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.bm-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Competitor spy list ─────────────────────────────────────────────────── */
/* ── Competitor intelligence cards ───────────────────────────────────────── */
.spy-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}
.spy-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.spy-name {
  font-weight: 700;
  font-size: 14px;
  color: #1e1e2e;
}
.spy-signals {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.spy-chip {
  background: #f3f4f6;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  color: #374151;
  border: 1px solid #e5e7eb;
}
.spy-threat {
  font-size: 13px;
  color: #374151;
  margin: 4px 0;
  line-height: 1.5;
}
.spy-counter {
  font-size: 13px;
  color: #1e40af;
  background: #eff6ff;
  border-radius: 6px;
  padding: 7px 10px;
  margin: 6px 0;
  line-height: 1.5;
}
.spy-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.spy-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  background: var(--surface);
  font-weight: 500;
  transition: all 0.15s;
}
.spy-link-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.spy-status-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
  margin-top: 2px;
}
.spy-analyse-btn {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
  cursor: pointer;
}
.spy-analyse-btn:hover { background: #1e40af; color: #fff; border-color: #1e40af; }
.spy-analyse-btn:disabled { opacity: 0.6; cursor: wait; }
.spy-analyse-btn.is-unavailable,
.spy-analyse-btn.is-unavailable:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
}
.spy-analyse-btn.is-unavailable:hover {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}
.spy-copy-name-btn {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
  cursor: pointer;
}
.spy-copy-name-btn:hover { background: #15803d; color: #fff; border-color: #15803d; }

/* ── Competitor insights panel ───────────────────────────────────────────── */
.spy-insights-panel { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.spy-loading { font-size: 13px; color: var(--muted); font-style: italic; }
.spy-ads-found { margin-bottom: 10px; }
.spy-ad-item {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.spy-ins-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 10px 0 5px;
}
.spy-pattern-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.spy-chip.theme  { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.spy-chip.offer  { background: #fefce8; border-color: #fde68a; color: #92400e; }
.spy-inspired-card {
  background: #fafafa;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.spy-inspired-angle { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent); margin-bottom: 5px; }
.spy-inspired-headline { font-weight: 700; font-size: 14px; color: #1e1e2e; margin-bottom: 3px; }
.spy-inspired-body {
  font-size: 13px; color: #1f2937; margin-bottom: 5px; line-height: 1.5;
  background: #f9fafb; border-left: 3px solid #e0e7ff; padding: 6px 10px;
  border-radius: 0 6px 6px 0;
}
.spy-inspired-desc { font-size: 12px; color: #6b7280; margin-bottom: 5px; line-height: 1.4; font-style: italic; }
.spy-inspired-cta { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.spy-inspired-rationale { font-size: 11px; color: #9ca3af; font-style: italic; border-top: 1px solid #f3f4f6; padding-top: 4px; margin-top: 4px; }


/* ── Ad action toolbar ───────────────────────────────────────────────────── */
.ad-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.ad-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--bot-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ad-tool-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.ad-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ad-tool-btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.ad-tool-btn.accent:hover { background: var(--accent-dark); }
.ad-tool-btn.muted { background: transparent; border-color: transparent; color: var(--muted); }
.ad-tool-btn.muted:hover { background: #f3f4f6; }

/* ── Meta test push panel ────────────────────────────────────────────────── */
.meta-push-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
}

.meta-push-head {
  margin-bottom: 8px;
  color: #1e3a8a;
  font-size: 13px;
}

.meta-push-grid {
  display: grid;
  gap: 6px;
}

.meta-push-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  color: #1f2937;
}

.meta-push-row span:first-child {
  color: #374151;
  font-weight: 600;
}

.meta-push-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
}

.meta-push-link:hover {
  text-decoration: underline;
}

.meta-push-error {
  margin: 0;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
}

/* ── Translate panel ─────────────────────────────────────────────────────── */
.translate-panel {
  margin-top: 10px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.translate-panel-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.lang-select {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
}

/* ── Landing page check result ───────────────────────────────────────────── */
.lp-check-result {
  margin-top: 10px;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.lp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.lp-score {
  font-size: 22px;
  font-weight: 800;
}
.lp-url {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  flex: 1;
}
.lp-summary {
  color: #374151;
  margin-bottom: 10px;
  line-height: 1.5;
}
.lp-section { margin-bottom: 10px; }
.lp-section strong { display: block; margin-bottom: 4px; }
.lp-section ul { padding-left: 18px; line-height: 1.7; }
.lp-passes strong { color: #059669; }
.lp-issues strong { color: #d97706; }
.lp-wins  strong  { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .header { margin: 8px; }
  .workspace-shell { width: calc(100% - 16px); margin: 0 auto 8px; }
  .header-tagline { display: none; }
  .campaigns-nav-link { font-size: 11px; padding: 4px 8px; }
  .new-campaign-btn { font-size: 11px; padding: 4px 8px; }
  .workspace-strip { display: none; }
  .msg-bubble { max-width: 88%; }
  .resume-banner { flex-direction: column; align-items: flex-start; }
  .resume-actions { margin-left: 0; }
  .benchmarks-strip { grid-template-columns: repeat(2, 1fr); }
  .ad-toolbar { gap: 6px; }
  .ad-tool-btn { padding: 5px 9px; font-size: 11px; }
}

@media (max-width: 1260px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .ops-sidebar { display: none; }
}

@media (max-width: 980px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }
  .performance-rail {
    max-height: 320px;
  }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin: 0 22px 14px;
  flex-shrink: 0;
}

.site-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.site-footer-brand {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}

.site-footer-links {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.site-footer-links a {
  color: #4b5f87;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.site-footer-links a:hover {
  color: var(--accent);
}
