/* ══════════ LP Vault ══════════ */
:root {
  --bg: #0b0c10;
  --bg-2: #12141a;
  --bg-3: #1a1d26;
  --line: #262a36;
  --text: #e8eaf0;
  --text-dim: #8a90a3;
  --accent: #7c6cff;
  --accent-2: #4ecdc4;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-bolt { filter: drop-shadow(0 0 6px rgba(124,108,255,.8)); }
.mode-switch { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.mode-btn {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 7px 16px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.mode-btn.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.count-pill {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; text-align: center; padding: 2px 7px; border-radius: 99px;
}
.count-pill.green { background: var(--green); color: #06281c; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.kbd-hint { color: var(--text-dim); font-size: 12px; font-family: var(--mono); }
.ghost-btn {
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  transition: all .15s;
}
.ghost-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-dim); }
.ghost-btn:disabled { opacity: .35; cursor: default; }
.ghost-btn.small { padding: 2px 8px; font-size: 12px; }

.view { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Review mode ── */
.review-stage {
  flex: 1; display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px; padding: 14px; overflow: hidden;
}
.review-frame-wrap {
  display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; position: relative;
}
.frame-chrome {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f57; } .dot.yellow { background: #febc2e; } .dot.green { background: #28c840; }
.frame-url {
  flex: 1; text-align: center; color: var(--text-dim);
  font-family: var(--mono); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#review-iframe, #detail-iframe { flex: 1; width: 100%; border: 0; background: #fff; }

.review-side { display: flex; flex-direction: column; gap: 12px; overflow: hidden; min-height: 0; }
.review-side .meta-card { flex: 1; overflow-y: auto; min-height: 80px; }
.review-progress { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1; height: 6px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
#review-progress-label { font-size: 12px; color: var(--text-dim); font-family: var(--mono); white-space: nowrap; }

.meta-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.meta-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.meta-brand { color: var(--accent-2); font-weight: 600; font-size: 13px; }
.meta-row { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.meta-row b { color: var(--text); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  background: var(--bg-3); color: var(--text-dim); border: 1px solid var(--line);
}
.chip.psych { color: #c4b5fd; border-color: #4c3d99; background: rgba(124,108,255,.12); }
.chip.style { color: #7dd3c8; border-color: #2a5f5a; background: rgba(78,205,196,.10); }
.chip.industry { color: #fda4af; border-color: #7f3b47; background: rgba(253,164,175,.10); }

.review-inputs { display: flex; flex-direction: column; gap: 10px; }
.review-inputs label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
textarea, input[type="search"], select, input[type="text"] {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; resize: vertical;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }

.vote-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.vote-btn {
  border: 0; border-radius: var(--radius); cursor: pointer;
  font: inherit; font-weight: 800; font-size: 18px; letter-spacing: .04em;
  padding: 18px 0 14px; position: relative;
  transition: transform .1s, filter .15s;
}
.vote-btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
.vote-btn:active { transform: translateY(0); }
.vote-key {
  position: absolute; top: 5px; right: 8px;
  font-size: 10px; font-family: var(--mono); font-weight: 400; opacity: .55;
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px;
}
.vote-btn.yes { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 20px rgba(16,185,129,.35); }
.vote-btn.maybe { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 20px rgba(245,158,11,.25); }
.vote-btn.no { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,.25); }
.review-nav { display: flex; justify-content: space-between; gap: 8px; }
.review-nav .ghost-btn { flex: 1; }

/* ── Library ── */
.library-controls {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  flex-shrink: 0;
}
.status-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.status-tabs button {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.status-tabs button.active { background: var(--bg-3); color: var(--text); }
#search-box { flex: 1; min-width: 160px; }
.library-controls select { max-width: 170px; }

.library-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-auto-rows: max-content;
  gap: 16px; padding: 16px;
  align-content: start;
}
.lp-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.lp-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.thumb-wrap, .match-thumb {
  /* shimmer placeholder until the preview iframe paints */
  background: linear-gradient(100deg, var(--bg-3) 30%, #232733 50%, var(--bg-3) 70%) var(--bg-3);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.thumb-wrap.ready, .match-thumb.ready { animation: none; background: #fff; }
@keyframes shimmer { to { background-position: -120% 0; } }
.thumb-wrap iframe, .match-thumb iframe { opacity: 0; transition: opacity .35s ease; }
.thumb-wrap.ready iframe, .match-thumb.ready iframe { opacity: 1; }

.thumb-wrap {
  position: relative; width: 100%; height: 200px;
  overflow: hidden; flex-shrink: 0;
}
.thumb-wrap iframe {
  width: 1280px; height: 840px;
  transform-origin: top left; border: 0; pointer-events: none;
  position: absolute; top: 0; left: 0;
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.status-dot {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .05em;
}
.status-dot.approved { background: var(--green); color: #06281c; }
.status-dot.maybe { background: var(--amber); color: #422006; }
.status-dot.declined { background: var(--red); color: #450a0a; }
.status-dot.pending { background: var(--bg-3); color: var(--text-dim); border: 1px solid var(--line); }
.lp-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.lp-card-title { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.lp-card-sub { font-size: 11.5px; color: var(--text-dim); }
.lp-card-sub b { color: var(--accent-2); font-weight: 600; }

/* ── Detail overlay ── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4,5,8,.82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.detail-panel {
  width: 100%; height: 100%; max-width: 1600px;
  display: grid; grid-template-columns: 1fr 360px; gap: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; position: relative;
}
.overlay-close {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
.detail-frame-wrap { display: flex; background: #fff; }
.detail-side {
  padding: 20px; overflow-y: auto; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.detail-side h2 { font-size: 17px; line-height: 1.3; }
.detail-side .field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 700; margin-bottom: 5px; }
.detail-status-row { display: flex; gap: 6px; }
.detail-status-row button {
  flex: 1; border: 1px solid var(--line); background: var(--bg-3); color: var(--text-dim);
  font: inherit; font-size: 12px; font-weight: 700; padding: 8px 0; border-radius: 8px; cursor: pointer;
}
.detail-status-row button.on.approved { background: var(--green); color: #06281c; border-color: var(--green); }
.detail-status-row button.on.maybe { background: var(--amber); color: #422006; border-color: var(--amber); }
.detail-status-row button.on.declined { background: var(--red); color: #450a0a; border-color: var(--red); }
.detail-status-row button.on.pending { background: var(--bg); color: var(--text); border-color: var(--text-dim); }
.save-btn {
  border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 700;
  padding: 10px; border-radius: 8px; cursor: pointer;
}
.save-btn:hover { filter: brightness(1.12); }

/* ── Generate mode ── */
.count-pill.amber { background: var(--amber); color: #422006; }
.generate-wrap {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: minmax(340px, 480px) 1fr;
  gap: 20px; padding: 24px; align-content: start;
}
.gen-form-card, .gen-queue {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  align-self: start;
}
.gen-form-card h2, .gen-queue h2 { font-size: 16px; }
.gen-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-top: -6px; }
.gen-sub code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; }
.gen-type-row { display: flex; gap: 6px; }
.gen-type-row button {
  flex: 1; border: 1px solid var(--line); background: var(--bg-3); color: var(--text-dim);
  font: inherit; font-size: 13px; font-weight: 600; padding: 10px; border-radius: 8px; cursor: pointer;
}
.gen-type-row button.active { border-color: var(--accent); color: var(--text); background: rgba(124,108,255,.12); }
.gen-form-card label { font-size: 12px; color: var(--text-dim); font-weight: 600; display: flex; flex-direction: column; gap: 5px; }
.gen-form-card .opt { font-weight: 400; opacity: .7; }
.gen-form-card input[type="number"] { width: 120px; }
.save-btn.big { font-size: 15px; padding: 13px; }
.gen-req {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px; background: var(--bg-3);
  margin-bottom: 10px;
}
.gen-req-top { display: flex; align-items: center; gap: 10px; }
.gen-req-value { font-weight: 700; font-size: 14px; flex: 1; word-break: break-all; }
.gen-req-badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 99px;
}
.gen-req-badge.queued { background: var(--amber); color: #422006; }
.gen-req-badge.in-progress { background: var(--accent); color: #fff; animation: throb-badge 1.2s ease-in-out infinite; }
@keyframes throb-badge { 50% { opacity: .6; } }
.gen-req-badge.done { background: var(--green); color: #06281c; }
.gen-req-badge.cancelled { background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--line); }
.gen-req-sub { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.gen-req-actions { display: flex; gap: 8px; }
.gen-req-actions .ghost-btn { font-size: 12px; padding: 4px 10px; }
@media (max-width: 900px) { .generate-wrap { grid-template-columns: 1fr; } }

/* ── Client Profiles ── */
.count-pill.violet { background: #a78bfa; color: #2e1065; }
.profiles-wrap { flex: 1; display: grid; grid-template-columns: 280px 1fr; overflow: hidden; }
.profiles-side {
  border-right: 1px solid var(--line); background: var(--bg-2);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
}
.profile-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  background: var(--bg-3); transition: border-color .15s;
}
.profile-item:hover { border-color: var(--text-dim); }
.profile-item.active { border-color: var(--accent); background: rgba(124,108,255,.1); }
.profile-item .pi-name { font-weight: 700; font-size: 13.5px; }
.profile-item .pi-kw { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-main { overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; }

.pf-header { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pf-header h1 { font-size: 24px; letter-spacing: -0.02em; }
.pf-header .pf-actions { margin-left: auto; display: flex; gap: 8px; }
.pf-vertical-badge {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(135deg, var(--accent), #a78bfa); color: #fff;
  padding: 5px 12px; border-radius: 99px;
}

.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pf-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.pf-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.pf-card.wide { grid-column: 1 / -1; }
.pf-positioning { font-size: 14.5px; line-height: 1.65; }

.trait-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.trait-row .t-label { color: var(--text-dim); font-weight: 600; }
.trait-bar { height: 7px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.trait-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.trait-value { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.trait-tag { font-weight: 700; color: var(--accent-2); text-transform: capitalize; }

.principle { display: flex; flex-direction: column; gap: 4px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.principle:last-child { border: 0; }
.principle-top { display: flex; align-items: center; gap: 10px; }
.principle-top .chip.psych { font-size: 12px; }
.principle-weight { flex: 1; height: 5px; background: var(--bg-3); border-radius: 99px; overflow: hidden; max-width: 120px; }
.principle-weight i { display: block; height: 100%; background: #a78bfa; }
.principle-why { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }

.pf-matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.match-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.match-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.match-thumb { position: relative; height: 170px; overflow: hidden; flex-shrink: 0; }
.match-thumb iframe { width: 1280px; height: 800px; transform-origin: top left; border: 0; pointer-events: none; position: absolute; }
.match-score {
  position: absolute; z-index: 3; top: 10px; right: 10px; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff;
  background: conic-gradient(var(--score-color, var(--accent)) calc(var(--score) * 1%), rgba(10,11,16,.85) 0);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.match-score span { background: #0b0c10; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.match-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.match-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.match-reasons { display: flex; flex-direction: column; gap: 3px; }
.match-reason { font-size: 11.5px; color: var(--text-dim); }
.match-reason b { color: var(--accent-2); font-weight: 700; }
.match-components { display: flex; gap: 3px; height: 5px; border-radius: 99px; overflow: hidden; }
.match-components i { display: block; height: 100%; }
.mc-relevance { background: #7c6cff; } .mc-psychology { background: #a78bfa; }
.mc-industry { background: #4ecdc4; } .mc-team { background: #34d399; } .mc-goal { background: #fbbf24; }

.pf-generate-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(124,108,255,.08); border: 1px solid #4c3d99; border-radius: var(--radius); padding: 14px 18px;
}
.pf-generate-row input { width: 76px; }
.pf-generate-row .hint { font-size: 12px; color: var(--text-dim); }

/* profile editor overlay */
.editor-panel {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px; position: relative; display: flex; flex-direction: column; gap: 14px;
}
.editor-panel h2 { font-size: 18px; }
.editor-panel label { font-size: 12px; color: var(--text-dim); font-weight: 600; display: flex; flex-direction: column; gap: 5px; }
.editor-panel details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.editor-panel summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.pf-overrides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

@media (max-width: 900px) {
  .profiles-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .profiles-side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .pf-grid { grid-template-columns: 1fr; }
}

/* ── Empty states, toast ── */
.empty-state {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; background: var(--bg-2);
  text-align: center; padding: 20px;
}
.empty-emoji { font-size: 44px; }
.empty-state p { color: var(--text-dim); font-size: 14px; }
#library-empty { position: static; background: transparent; flex: 1; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  z-index: 99; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ── Responsive ── */
@media (max-width: 900px) {
  .review-stage { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .review-side { max-height: 45vh; }
  .detail-panel { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .detail-side { border-left: 0; border-top: 1px solid var(--line); max-height: 45vh; }
  .kbd-hint { display: none; }
}
