/* ── CONFIG ── Set your API key here */
:root {
  --api-key: "PASTE_YOUR_ANTHROPIC_API_KEY_HERE";
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --border: rgba(0, 0, 0, 0.09);
  --border-md: rgba(0, 0, 0, 0.14);
  --text: #1A1918;
  --muted: #6B6A67;
  --hint: #A09E9B;
  --hot: #C0430E;
  --hot-bg: #FDF0EB;
  --hot-border: #F0B49A;
  --warm: #9A6200;
  --warm-bg: #FDF6E7;
  --warm-border: #F0D090;
  --cold: #5A5956;
  --cold-bg: #F2F1EE;
  --cold-border: #CCCBC8;
  --accent: #1A1918;
  --blue: #2563EB;
  --green: #16A34A;
  --radius: 10px;
  --radius-lg: 14px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--muted);
  font-weight: 300;
}

.region-tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  padding: 3px 9px;
  color: var(--muted);
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  display: none;
}

.btn:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  font-weight: 500;
}

.btn-primary:hover {
  opacity: 0.85;
  color: #fff;
}

/* ── LAYOUT ── */
.app-body {
  display: flex;
  height: calc(100vh - 52px);
}

/* ── RESEARCH VIEW ── */
#research-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0;
}

.research-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--hint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.research-title {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.research-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  text-align: center;
}

.search-box {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s;
}

.search-box:focus-within {
  border-color: var(--text);
}

.search-box input {
  flex: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
}

.search-box input::placeholder {
  color: var(--hint);
}

.search-box button {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  background: var(--text);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.search-box button:hover {
  opacity: 0.85;
}

.search-box button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* API key input */
.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
  max-width: 440px;
}

.api-key-row label {
  font-size: 12px;
  color: var(--hint);
  white-space: nowrap;
}

.api-key-row input {
  flex: 1;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  outline: none;
}

.api-key-row input:focus {
  border-color: var(--border-md);
}

/* Progress */
.progress-wrap {
  margin-top: 36px;
  width: 100%;
  max-width: 440px;
  display: none;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--hint);
  transition: color 0.2s;
}

.progress-step.active {
  color: var(--text);
}

.progress-step.done {
  color: var(--green);
}

.step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.progress-step.active .step-icon {
  border-color: var(--text);
  background: var(--text);
}

.progress-step.done .step-icon {
  border-color: var(--green);
  background: var(--green);
}

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  display: none;
}

.progress-step.active .step-dot {
  display: block;
}

.step-check {
  display: none;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.progress-step.done .step-check {
  display: block;
}

.progress-step.done .step-dot {
  display: none;
}

.progress-count {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--hint);
  margin-left: auto;
}

/* ── LIST PANEL ── */
#list-panel {
  display: none;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width 0.2s ease;
}

#list-panel.with-detail {
  width: 400px;
  flex-shrink: 0;
}

.list-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  font-family: 'DM Sans', sans-serif;
}

.filter-chip:hover {
  border-color: var(--border-md);
  color: var(--text);
}

.filter-chip.on {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.filter-chip.on-hot {
  background: var(--hot-bg);
  color: var(--hot);
  border-color: var(--hot-border);
}

.filter-chip.on-warm {
  background: var(--warm-bg);
  color: var(--warm);
  border-color: var(--warm-border);
}

.filter-chip.on-cold {
  background: var(--cold-bg);
  color: var(--cold);
  border-color: var(--cold-border);
}

.list-tally {
  font-size: 11px;
  color: var(--hint);
  margin-left: auto;
  font-family: 'DM Mono', monospace;
}

.org-list {
  overflow-y: auto;
  flex: 1;
}

.org-row {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.1s;
}

.org-row:hover {
  background: var(--bg);
}

.org-row.selected {
  background: #EEF2FF;
}

.tier-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pip-Hot {
  background: var(--hot);
}

.pip-Warm {
  background: var(--warm);
}

.pip-Cold {
  background: var(--cold);
}

.org-info {
  flex: 1;
  min-width: 0;
}

.org-name-row {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-type-row {
  font-size: 11px;
  color: var(--hint);
  margin-top: 1px;
}

.org-snippet {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-score-col {
  text-align: right;
  flex-shrink: 0;
}

.score-big {
  font-size: 20px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.02em;
  font-family: 'DM Mono', monospace;
}

.score-denom {
  font-size: 10px;
  color: var(--hint);
}

.enrich-pip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
}

.enrich-pending {
  background: var(--cold-bg);
  color: var(--cold);
}

.enrich-complete {
  background: #DCFCE7;
  color: #166534;
}

/* ── DETAIL PANEL ── */
#detail-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  background: var(--surface);
  overflow-y: auto;
  min-width: 0;
}

#detail-panel.visible {
  display: flex;
}

.detail-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.detail-tier-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tier-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.badge-Hot {
  background: var(--hot-bg);
  color: var(--hot);
  border: 1px solid var(--hot-border);
}

.badge-Warm {
  background: var(--warm-bg);
  color: var(--warm);
  border: 1px solid var(--warm-border);
}

.badge-Cold {
  background: var(--cold-bg);
  color: var(--cold);
  border: 1px solid var(--cold-border);
}

.detail-name {
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2px;
}

.detail-meta {
  font-size: 12px;
  color: var(--hint);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.score-cell {
  background: var(--surface);
  padding: 14px 16px;
}

.sc-label {
  font-size: 10px;
  color: var(--hint);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sc-num {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  line-height: 1;
}

.sc-bar {
  height: 2px;
  margin-top: 8px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.sc-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.4s ease;
}

.detail-section {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.ds-label {
  font-size: 10px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.rat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rat-row {
  display: flex;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.rat-sign {
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  flex-shrink: 0;
  width: 12px;
}

.rat-pos {
  color: #16A34A;
}

.rat-neg {
  color: #DC2626;
}

.rat-neu {
  color: var(--hint);
}

.outreach-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  border: 1px solid var(--border);
}

.enrich-section {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.enrich-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.enrich-sub {
  font-size: 11px;
  color: var(--hint);
  margin-top: 2px;
}

.enrich-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 5px 12px;
  border: 1px solid var(--border-md);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.enrich-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.notes-section {
  padding: 16px 22px;
}

.notes-section textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.6;
}

.notes-section textarea:focus {
  border-color: var(--border-md);
}

.notes-section textarea::placeholder {
  color: var(--hint);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-label {
  font-size: 11px;
  color: var(--hint);
  width: 80px;
  flex-shrink: 0;
}

.contact-val {
  font-size: 12px;
  color: var(--text);
}

.contact-val a {
  color: var(--blue);
  text-decoration: none;
}

.rat-note-text {
  display: inline;
}

.rat-source-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.rat-source-link {
  font-size: 10px;
  color: var(--blue);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.1s;
}

.rat-source-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.rat-copy-btn {
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--hint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.1s;
}

.rat-copy-btn:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── EMPTY / ERROR STATES ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  color: var(--hint);
  text-align: center;
  gap: 8px;
}

.empty-state p {
  font-size: 13px;
}

/* ── RESUME BANNER ── */
.resume-banner {
  background: var(--warm-bg);
  border: 1px solid var(--warm-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 440px;
  margin-top: 16px;
  gap: 12px;
}

.resume-text {
  font-size: 12px;
  color: var(--warm);
}

.resume-text strong {
  font-weight: 500;
}

.resume-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.resume-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--warm-border);
  background: transparent;
  color: var(--warm);
  cursor: pointer;
}

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

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-md);
  border-radius: 2px;
}

/* Custom progress additions */
.step-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-step.active .step-dot {
  display: none;
}

.progress-step.active .step-spinner {
  display: block;
}

.progress-step.done .step-spinner {
  display: none;
}

.step-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

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

.step-activity {
  font-size: 11px;
  color: var(--hint);
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

.progress-step.active .step-activity {
  display: block;
}