/* Research */
.research-panel { max-width: 900px }
.research-panel h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px }
.research-panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px }
.research-quick-picks { margin-bottom: 28px }
.rq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px }
.rq-btn {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.rq-btn:hover { border-color: var(--accent); background: rgba(91,163,245,.04) }
.rq-icon { font-size: 22px }
.rq-label { font-size: 14px; font-weight: 700; color: var(--text) }
.rq-desc { font-size: 13px; color: var(--muted); line-height: 1.4 }
.research-custom { margin-bottom: 20px }
.research-ask-row { display: flex; gap: 10px; max-width: 600px }
.research-ask-input {
  flex: 1; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 15px;
}
.research-ask-input:focus { outline: none; border-color: var(--accent) }
.research-items { display: grid; gap: 8px }
.research-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
}
.research-item-text { flex: 1; font-size: 14px; line-height: 1.5 }
.research-add-btn {
  padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; border: 1px solid var(--green); background: rgba(52,200,138,.1); color: var(--green);
  white-space: nowrap; flex-shrink: 0;
}
.research-add-btn:hover { background: rgba(52,200,138,.2) }
.research-add-btn:disabled { cursor: default }
/* Research sources */
.research-sources { margin-top: 12px }
.sources-toggle { font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 600; list-style: none }
.sources-toggle::-webkit-details-marker { display: none }
.sources-toggle::before { content: '▸ '; font-size: 13px; transition: transform .2s; display: inline-block }
details[open] > .sources-toggle::before { transform: rotate(90deg) }
.sources-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px }
.source-link {
  font-size: 13px; color: var(--accent); text-decoration: none; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source-link:hover { border-color: var(--accent); background: rgba(91,163,245,.04) }

.research-use-btn {
  margin-top: 8px; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--green); background: rgba(52,200,138,.1); color: var(--green);
}
.research-use-btn:hover { background: rgba(52,200,138,.2) }
.research-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 14px;
}
.research-card h3 {
  font-size: 14px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: 8px;
}
.research-card p { font-size: 14px; line-height: 1.6; color: var(--muted) }
.research-card ul { padding-left: 18px; color: var(--muted); font-size: 14px }
.research-card li { margin-bottom: 4px; line-height: 1.5 }
.hook-list { display: grid; gap: 8px }
.hook-item {
  padding: 10px 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; cursor: pointer;
}
.hook-item:hover { border-color: var(--accent) }

/* Competitor Ad Spy */
.research-spy { margin-bottom: 28px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px }
.research-spy h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px }
.spy-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px }

/* Ad Spy: Meta Ad Library deep-link card */
.spy-adlib-card { margin-top: 16px; padding: 16px 18px; border-radius: 12px; background: rgba(91,163,245,.07); border: 1px solid rgba(91,163,245,.35) }
.spy-adlib-head { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 6px }
.spy-adlib-head em { font-style: italic; color: var(--accent) }
.spy-adlib-desc { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 12px }
.spy-adlib-btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 2px 10px rgba(91,163,245,.35); transition: transform .1s, filter .15s }
.spy-adlib-btn:hover { transform: translateY(-1px); filter: brightness(1.06) }
.spy-adlib-how { margin-top: 12px }
.spy-adlib-how summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--accent); list-style: none }
.spy-adlib-how summary::-webkit-details-marker { display: none }
.spy-adlib-how summary::before { content: '\25B8'; display: inline-block; margin-right: 6px; transition: transform .15s }
.spy-adlib-how[open] summary::before { transform: rotate(90deg) }
.spy-adlib-how ol { margin: 10px 0 2px; padding-left: 20px; font-size: 13.5px; color: var(--text); line-height: 1.7 }
.spy-adlib-how li { margin-bottom: 4px }

/* Ad Spy results: tabbed report (easier to navigate than one long list) */
.spy-report { margin-top: 14px }
.spy-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px }
.spy-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 13.5px; font-weight: 700; cursor: pointer }
.spy-tab:hover { border-color: var(--accent); color: var(--accent) }
.spy-tab.active { border-color: var(--accent); background: rgba(91,163,245,.12); color: var(--accent) }
.spy-tab-count { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(127,127,127,.18); color: var(--muted) }
.spy-tab.active .spy-tab-count { background: rgba(91,163,245,.22); color: var(--accent) }
.spy-panel { display: none }
.spy-panel.active { display: block; animation: spyPanelIn .2s ease }
@keyframes spyPanelIn { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }
.spy-panel-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; line-height: 1.5 }
.spy-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px }

/* Ad Spy loading: a detective sweeping a spyglass over clues while research runs */
.spy-detective { position: relative; width: 280px; height: 140px; margin: 12px auto 6px }
.spy-detective .spy-det-emoji { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font-size: 48px; animation: spyBob 1.8s ease-in-out infinite }
@keyframes spyBob { 0%,100% { transform: translateX(-50%) translateY(0) } 50% { transform: translateX(-50%) translateY(-7px) } }
.spy-detective .spy-glass { position: absolute; top: 0; left: 0; font-size: 42px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); animation: spyScan 4s ease-in-out infinite; transform-origin: center }
@keyframes spyScan {
  0%   { transform: translate(24px, 34px) rotate(-10deg) scale(1) }
  18%  { transform: translate(64px, 14px) rotate(0deg) scale(1.18) }
  38%  { transform: translate(132px, 44px) rotate(8deg) scale(1.18) }
  58%  { transform: translate(190px, 16px) rotate(-5deg) scale(1.18) }
  78%  { transform: translate(110px, 56px) rotate(5deg) scale(1.05) }
  100% { transform: translate(24px, 34px) rotate(-10deg) scale(1) }
}
.spy-detective .spy-clues { position: absolute; inset: 0 }
.spy-detective .spy-clues span { position: absolute; font-size: 22px; opacity: .3; animation: spyClue 4s ease-in-out infinite }
.spy-detective .spy-clues span:nth-child(1) { left: 66px; top: 20px; animation-delay: .7s }
.spy-detective .spy-clues span:nth-child(2) { left: 128px; top: 52px; animation-delay: 1.5s }
.spy-detective .spy-clues span:nth-child(3) { left: 188px; top: 22px; animation-delay: 2.3s }
.spy-detective .spy-clues span:nth-child(4) { left: 104px; top: 82px; animation-delay: 3s }
@keyframes spyClue { 0%,100% { opacity: .28; transform: scale(1) } 50% { opacity: 1; transform: scale(1.3) } }
.spy-det-text { font-size: 15px; color: var(--muted); text-align: center; min-height: 20px }
@media (prefers-reduced-motion: reduce) {
  .spy-detective .spy-glass, .spy-detective .spy-det-emoji, .spy-detective .spy-clues span { animation: none }
}

/* Ad Spy action buttons: Quick Scan + Deep Dive (background) */
.spy-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px }
.spy-deepdive-btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--accent); background: rgba(91,163,245,.1); color: var(--accent); font-size: 14px; font-weight: 800; cursor: pointer; transition: background .15s }
.spy-deepdive-btn:hover { background: rgba(91,163,245,.2) }
.spy-deepdive-btn:disabled { opacity: .6; cursor: default }

/* "Analyzed X ago for <market>" bar above saved spy results + Refresh */
.spy-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0 6px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px }
.spy-meta .spy-meta-text { font-size: 13.5px; color: var(--muted) }
.spy-meta .spy-meta-text strong { color: var(--text); font-weight: 700 }
.spy-meta .spy-meta-stale { color: #d9a441; font-weight: 700 }
.spy-refresh-btn { border: 1px solid var(--accent); background: none; color: var(--accent); font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap }
.spy-refresh-btn:hover { background: rgba(91,163,245,.12) }
.spy-field { display: flex; flex-direction: column; gap: 4px }
.spy-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em }
.spy-input { padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 14px }
.spy-input:focus { outline: none; border-color: var(--accent) }
@media (max-width: 700px) { .spy-inputs { grid-template-columns: 1fr } }
.spy-result-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; line-height: 1.6 }
.spy-result-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--accent) }
.spy-section { margin-top: 12px }
.spy-section strong { color: var(--text) }
.spy-locked { text-align: center; padding: 30px 20px }
.spy-locked-icon { font-size: 48px; margin-bottom: 12px }
.spy-locked-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--accent) }
.spy-locked-desc { font-size: 15px; color: var(--muted); line-height: 1.6; max-width: 400px; margin: 0 auto 18px }
.spy-locked-btn { display: inline-block; padding: 12px 28px; background: var(--accent); color: #fff; border-radius: 10px; font-size: 15px; font-weight: 700; text-decoration: none }
.spy-locked-btn:hover { opacity: .9 }

/* Spy structured results */
.spy-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-top: 12px }
.spy-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 10px }
.spy-card-sub { font-size: 13px; color: var(--muted); margin-bottom: 10px }
.spy-section-grid { display: grid; gap: 8px }

/* Competitor ad mini-cards */
.spy-ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px }
.spy-ad-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel) }
.spy-ad-company { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em }
.spy-ad-hook { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 8px; font-style: italic }
.spy-ad-meta { display: flex; gap: 6px; flex-wrap: wrap }
.spy-badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: rgba(91,163,245,.1); color: var(--accent); font-weight: 600 }
.spy-badge--offer { background: rgba(52,200,138,.1); color: var(--green) }
.spy-badge--format { background: rgba(224,168,50,.1); color: var(--amber) }

/* Patterns section */
.spy-pattern-group { margin-bottom: 14px }
.spy-pattern-group:last-child { margin-bottom: 0 }
.spy-pattern-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em }
.spy-pills { display: flex; flex-wrap: wrap; gap: 6px }
.spy-pill { font-size: 13px; padding: 5px 12px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); color: var(--text) }
.spy-pill--offer { border-color: rgba(52,200,138,.3); color: var(--green) }
.spy-pill--cta { border-color: rgba(91,163,245,.3); color: var(--accent) }

/* Hooks (stealable) */
.spy-hooks { display: grid; gap: 6px }
.spy-hook { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px }
.spy-hook-text { flex: 1; font-size: 14px; line-height: 1.4; color: var(--text) }

/* Gaps */
.spy-gap { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel) }
.spy-gap-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4 }
.spy-gap-text { font-size: 14px; line-height: 1.5; color: var(--text) }

/* Recommendations */
.spy-rec { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel) }
.spy-rec-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0 }
.spy-rec-text { font-size: 14px; line-height: 1.5; color: var(--text) }

/* ===== Research redesign: actionable + plain-English + saved ===== */

/* "What this means for you" plain-English takeaway */
.research-takeaway { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 4px 0 14px; background: rgba(52,200,138,.08); border: 1px solid rgba(52,200,138,.22); border-radius: 11px }
.rt-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--green); white-space: nowrap; padding-top: 2px }
.rt-text { font-size: 14.5px; line-height: 1.5; color: var(--text) }
@media (max-width: 520px) { .research-takeaway { flex-direction: column; gap: 4px } }

.research-prose { font-size: 14.5px; line-height: 1.65 }
.research-prose p { margin-bottom: 10px }

/* Item action buttons */
.research-add-btn { padding: 7px 16px; border-radius: 9px; border: 1px solid var(--green); background: rgba(52,200,138,.12); color: var(--green); font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s }
.research-add-btn:hover { background: rgba(52,200,138,.22) }
.research-add-done { background: var(--green) !important; color: #fff !important; border-color: var(--green) !important }
.research-hook-btn { border-color: var(--accent); background: rgba(91,163,245,.12); color: var(--accent) }
.research-hook-btn:hover { background: rgba(91,163,245,.22) }
.research-useall-btn { margin-top: 10px; width: 100%; padding: 9px; border-radius: 9px; border: 1px dashed var(--green); background: transparent; color: var(--green); font-size: 13.5px; font-weight: 700; cursor: pointer }
.research-useall-btn:hover { background: rgba(52,200,138,.1) }
.research-useall-btn:disabled { opacity: .6; cursor: default }

/* Primary action under a text answer */
.research-actions { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.research-act-btn { padding: 10px 18px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer }
.research-act-btn:hover { filter: brightness(1.07) }
.research-act-note { font-size: 12.5px; color: var(--muted) }

/* "Your research so far" strip */
.research-saved { margin: 20px 0 18px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px }
.research-saved-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px }
.research-saved-head h3 { font-size: 15px; font-weight: 800; margin: 0 }
.research-saved-chips { display: flex; flex-wrap: wrap; gap: 8px }
.research-saved-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s }
.research-saved-chip:hover { border-color: var(--accent) }
.research-saved-chip .rsc-when { font-size: 11px; color: var(--muted); font-weight: 500 }
.research-saved-q .rsc-title { font-weight: 500; font-style: italic; color: var(--muted) }

/* Freshness states on saved-research chips: fresh = quiet, aging = amber hint, stale = greyed + refresh */
.rsc-when.rsc-aging { color: #d9a441 }
.rsc-when.rsc-stale { color: var(--muted); text-decoration: line-through; opacity: .8 }
.rsc-stale-chip { opacity: .65; border-style: dashed }
.rsc-stale-chip:hover { opacity: 1 }
.rsc-aging-chip { border-color: rgba(217,164,65,.4) }
.rsc-refresh { font-size: 11px; font-weight: 700; color: var(--accent); cursor: pointer; padding: 2px 6px; border-radius: 6px; white-space: nowrap }
.rsc-refresh:hover { background: rgba(91,163,245,.14) }
.rsc-del { font-size: 12px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 6px; opacity: .55; transition: opacity .15s, color .15s, background .15s }
.research-saved-chip:hover .rsc-del { opacity: .85 }
.rsc-del:hover { color: var(--red); background: rgba(239,68,68,.14); opacity: 1 }

/* Industry status (pulled from Setup). Set = quiet locked chip; missing = loud call-to-action. */
.r-industry-set { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 6px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; font-size: 13px }
.r-industry-set .ris-label { color: var(--muted) }
.r-industry-set .ris-value { font-weight: 800; color: var(--text) }
.r-industry-set .ris-change { margin-left: 4px; border: none; background: none; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 4px; border-radius: 6px }
.r-industry-set .ris-change:hover { background: rgba(91,163,245,.14) }

.r-industry-missing { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 16px 18px; background: rgba(91,163,245,.08); border: 1px solid rgba(91,163,245,.45); border-radius: 12px }
.r-industry-missing .rim-text { display: flex; flex-direction: column; gap: 3px; flex: 1 }
.r-industry-missing .rim-text strong { font-size: 15px; color: var(--text) }
.r-industry-missing .rim-text span { font-size: 13px; color: var(--muted); line-height: 1.45 }
.r-industry-missing .rim-btn { white-space: nowrap; padding: 11px 20px; border: none; border-radius: 9px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 2px 10px rgba(91,163,245,.35); transition: transform .1s, box-shadow .15s }
.r-industry-missing .rim-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(91,163,245,.5) }

/* Seed-hook banner at the top of the Create flow */
.create-seed-banner { margin-bottom: 16px }
.seed-banner-inner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: rgba(91,163,245,.08); border: 1px solid rgba(91,163,245,.3); border-radius: 12px }
.seed-banner-icon { font-size: 20px; line-height: 1.2 }
.seed-banner-body { flex: 1; font-size: 14px; line-height: 1.5 }
.seed-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px }
.seed-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(91,163,245,.14); color: var(--text); font-size: 12.5px }
.seed-chip button { border: none; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 }
.seed-chip button:hover { color: var(--red) }
.seed-banner-clear { border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap }
.seed-banner-clear:hover { color: var(--text) }

/* "Go to Create" nudge revealed after a client uses research items */
.research-next { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line) }
.research-next-hint { font-size: 13px; color: var(--green); font-weight: 600 }
