@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --black:          #0a0a0a;
  --surface-1:      #111111;
  --surface-2:      #1a1a1a;
  --surface-3:      #222222;
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.15);
  --text-primary:   #f0f0f0;
  --text-secondary: #888888;
  --text-muted:     #555555;
  --rainbow:        linear-gradient(90deg, #ff3b3b, #ff8c00, #ffd700, #00c853, #00b4d8, #7c4dff);
  --radius-card:    8px;
  --radius-pill:    4px;
  --transition:     150ms ease;
}

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

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

a    { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.page      { display: flex; flex-direction: column; min-height: 100vh; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; width: 100%; }
.main      { flex: 1; padding: 32px 0; }

/* ============================================================
   PIPELINE NAV
   ============================================================ */
.pipeline-nav {
  background: var(--black);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
}

.pipeline-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pipeline-brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.pipeline-brand-accent {
  height: 3px;
  width: 40px;
  background: var(--rainbow);
  border-radius: 2px;
}

.pipeline-stages {
  display: flex;
  align-items: center;
  gap: 0;
}

.pipeline-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  transition: color var(--transition);
}

.pipeline-stage:hover      { color: var(--text-secondary); }
.pipeline-stage.active     { color: var(--text-primary); }
.pipeline-stage.active .stage-label { color: var(--text-primary); }

.stage-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.pipeline-stage.active .stage-num {
  color: var(--text-primary);
  border: 2px solid transparent;
  background-image:
    linear-gradient(var(--surface-3), var(--surface-3)),
    linear-gradient(90deg, #ff3b3b, #ff8c00, #ffd700, #00c853, #00b4d8, #7c4dff);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.stage-label {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: inherit;
}

.stage-arrow {
  color: var(--border-strong);
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
  flex-shrink: 0;
}

.info-btn {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.info-btn:hover  { color: var(--text-secondary); border-color: var(--border-strong); }
.info-btn.active { color: var(--text-primary);   border-color: var(--border-strong); }

.info-panels {
  border-top: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease;
}

.info-panels.open { max-height: 100px; }

.info-panel {
  display: none;
  padding: 12px 24px 14px;
}

.info-panel.visible { display: block; }

.info-panel p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 740px;
}

/* ============================================================
   CARDS
   ============================================================ */

/* Default card */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}

/* Strong signal card — full perimeter rainbow border (score > 75) */
.card-strong {
  position: relative;
  background: var(--surface-2);
  border-radius: var(--radius-card);
  z-index: 0;
}

.card-strong::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-card) + 1px);
  background: var(--rainbow);
  z-index: -1;
}

.card-strong-inner {
  position: relative;
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: 20px;
}

/* Interesting signal card — top-only 2px rainbow accent (score 50–75) */
.card-interesting {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  position: relative;
}

.card-interesting::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 2px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--rainbow);
}

/* ============================================================
   SCORE BADGE
   ============================================================ */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* ============================================================
   SIGNAL DOTS
   ============================================================ */
.dot        { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-strong { background: #00c853; }
.dot-mid    { background: #ffd700; }
.dot-weak   { background: var(--text-muted); }

/* ============================================================
   TAGS & PILLS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  white-space: nowrap;
}

.evidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}

.evidence-pill:hover { color: var(--text-secondary); border-color: var(--border-strong); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.display {
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.mono { font-family: 'DM Mono', monospace; font-size: 12px; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-primary   { background: var(--text-primary); color: var(--black); border: 1px solid transparent; }
.btn-primary:hover { background: #d8d8d8; }

.btn-secondary { background: var(--surface-3); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-secondary); border-color: var(--border-strong); }

.btn-danger { background: rgba(255,59,59,0.1); color: #ff6b6b; border: 1px solid rgba(255,59,59,0.2); }
.btn-danger:hover { background: rgba(255,59,59,0.18); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-xs { padding: 3px 8px;  font-size: 10px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input, .select, .textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  transition: border-color var(--transition);
  width: 100%;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-strong);
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.textarea {
  resize: vertical;
  min-height: 80px;
  border-radius: var(--radius-card);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-error {
  font-size: 11px;
  color: #ff6b6b;
}

/* ============================================================
   ENGINE SWITCHER
   ============================================================ */
.engine-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.engine-switcher-label {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 4px;
}

.engine-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.engine-option:hover  { color: var(--text-secondary); border-color: var(--border-strong); }

.engine-option.selected {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.engine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  transition: background var(--transition);
}

.engine-option.selected .engine-dot { background: #00c853; border-color: #00c853; }

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.stat {
  flex: 1;
  background: var(--surface-2);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   SIGNAL CARD — GRAMMAR GRID
   ============================================================ */
.grammar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.grammar-cell {
  background: var(--surface-3);
  border-radius: 6px;
  padding: 12px;
}

.grammar-cell-label {
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.grammar-cell-value {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Full-width grammar cell (for longer fields) */
.grammar-cell-full { grid-column: 1 / -1; }

/* ============================================================
   SCORE BREAKDOWN
   ============================================================ */
.score-breakdown { display: flex; flex-direction: column; }

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.score-row-label { color: var(--text-secondary); }

.score-row-pts {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.score-row-pts.positive { color: #00c853; }
.score-row-pts.negative { color: #ff6b6b; }
.score-row-pts.zero     { color: var(--text-muted); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-queued   { color: #ffd700; border-color: rgba(255,215,0,0.25);  background: rgba(255,215,0,0.06); }
.status-scanning { color: #00b4d8; border-color: rgba(0,180,216,0.25); background: rgba(0,180,216,0.06); }
.status-done     { color: #00c853; border-color: rgba(0,200,83,0.25);  background: rgba(0,200,83,0.06); }
.status-paused   { color: var(--text-muted); }

/* ============================================================
   FEEDBACK WIDGET
   ============================================================ */
.feedback-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.feedback-btn {
  padding: 4px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.feedback-btn:hover    { color: var(--text-secondary); border-color: var(--border-strong); }
.feedback-btn.selected { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-2); }

/* ============================================================
   COMPANY CARD (Sprint 2)
   ============================================================ */
.company-card { display: flex; flex-direction: column; gap: 12px; }

.company-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.company-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.company-card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  gap: 10px;
}

.empty-state-title { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.empty-state-desc  { font-size: 13px; color: var(--text-muted); max-width: 380px; line-height: 1.6; }

/* ============================================================
   ALERT / NOTICE
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-2);
}

.alert-error { color: #ff6b6b; border-color: rgba(255,107,107,0.25); background: rgba(255,107,107,0.06); }
.alert-success { color: #00c853; border-color: rgba(0,200,83,0.25); background: rgba(0,200,83,0.06); }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.flex-wrap      { flex-wrap: wrap; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end    { justify-content: flex-end; }

.gap-4   { gap: 4px; }
.gap-6   { gap: 6px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-24  { gap: 24px; }

.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.mt-32   { margin-top: 32px; }

.mb-8    { margin-bottom: 8px; }
.mb-12   { margin-bottom: 12px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }

.w-full  { width: 100%; }
.flex-1  { flex: 1; }
.shrink-0 { flex-shrink: 0; }

.text-right  { text-align: right; }
.text-center { text-align: center; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
