:root {
  --bg: #0a0e1a;
  --bg-2: #0f1422;
  --card: #131826;
  --card-2: #1a2030;
  --border: #2a3346;
  --border-2: #3a455d;
  --text: #e8ecf3;
  --text-dim: #8a94a8;
  --text-dimmer: #5a6578;
  --strong: #22c55e;
  --strong-bg: rgba(34, 197, 94, 0.08);
  --possible: #f59e0b;
  --possible-bg: rgba(245, 158, 11, 0.08);
  --near: #6b7280;
  --danger: #ef4444;
  --accent: #38bdf8;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(56, 189, 248, 0.06), transparent 60%),
    radial-gradient(1000px 500px at 0% 100%, rgba(34, 197, 94, 0.04), transparent 60%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--strong);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15), 0 0 18px rgba(34, 197, 94, 0.4);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34,197,94,0.15), 0 0 18px rgba(34,197,94,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(34,197,94,0.05), 0 0 24px rgba(34,197,94,0.6); }
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tagline { margin: 0; color: var(--text-dim); font-size: 12px; letter-spacing: 0.02em; }

.meta { display: flex; align-items: center; gap: 22px; }
.meta-block { display: flex; flex-direction: column; align-items: flex-end; }
.meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dimmer); }
.meta-value { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text); font-weight: 600; }

.refresh-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.refresh-btn:hover { background: var(--card-2); border-color: var(--border-2); }
.refresh-btn:disabled { opacity: 0.7; cursor: default; }
.refresh-icon { display: inline-block; }
.refresh-btn.spinning .refresh-icon { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 120%);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.good { border-color: var(--strong); }
.toast.good::before { content: '✓ '; color: var(--strong); font-weight: 700; }
.toast.neutral { border-color: var(--border-2); }
.toast.bad { border-color: var(--danger); color: var(--danger); }

/* ===== Stats strip ===== */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.stat {
  background: var(--bg-2);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.stat-strong .stat-num { color: var(--strong); }
.stat-possible .stat-num { color: var(--possible); }
.stat-near .stat-num { color: var(--near); }
.stat-pass .stat-num { color: var(--text-dim); }

/* ===== Layout ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  padding: 24px 32px 60px;
  max-width: 1600px;
  margin: 0 auto;
}
.col-main { min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 10px;
}
.section-head .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dimmer);
}
.section-head.collapsible { cursor: pointer; user-select: none; }
.section-head.collapsible:hover h2 { color: var(--text); }
.chev { transition: transform 0.2s ease; display: inline-block; margin-left: 6px; }
.chev.collapsed { transform: rotate(-90deg); }

.dot-strong, .dot-possible, .dot-near {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.dot-strong { background: var(--strong); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.dot-possible { background: var(--possible); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.dot-near { background: var(--near); }

/* ===== Strong deal cards ===== */
.deal-list { display: flex; flex-direction: column; gap: 16px; }
.strong-list { gap: 18px; }

.deal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.deal-card:hover { border-color: var(--border-2); }

.deal-strong {
  border-left: 3px solid var(--strong);
  background: linear-gradient(180deg, var(--strong-bg) 0%, var(--card) 60px);
}

.deal-head {
  padding: 18px 22px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.deal-title {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0; flex: 1;
}
.deal-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--strong);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.deal-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.deal-location {
  font-size: 13px;
  color: var(--text-dim);
}
.deal-badges {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  flex-shrink: 0;
}
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge-category { background: rgba(56, 189, 248, 0.1); color: var(--accent); border-color: rgba(56, 189, 248, 0.3); }
.badge-source { background: var(--card-2); color: var(--text-dim); }

.deal-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.metric {
  background: var(--card);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dimmer); }
.metric-value { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 600; color: var(--text); }

.deal-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 16px; }

.rationale {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: 6px;
  border-left: 2px solid var(--border-2);
}
.rationale-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dimmer);
  margin-bottom: 4px;
}

/* Score bar */
.score-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.score-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--strong);
  line-height: 1;
  min-width: 64px;
}
.score-total small { font-size: 14px; color: var(--text-dim); font-weight: 500; }
.score-bars {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
}
.score-bar {
  display: grid;
  grid-template-columns: 100px 1fr 24px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}
.score-bar-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; }
.score-bar-track {
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--strong), #4ade80);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-bar-num { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); text-align: right; font-weight: 600; }

/* SBA math */
.sba-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 1px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.sba-cell {
  background: var(--card-2);
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.sba-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dimmer); }
.sba-value { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text); }
.dscr-cell { padding: 10px 18px; min-width: 110px; }
.dscr-good { background: rgba(34, 197, 94, 0.12); }
.dscr-good .sba-value { color: var(--strong); }
.dscr-mid { background: rgba(245, 158, 11, 0.12); }
.dscr-mid .sba-value { color: var(--possible); }
.dscr-bad { background: rgba(239, 68, 68, 0.12); }
.dscr-bad .sba-value { color: var(--danger); }

/* Immediate action */
.action-box {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(56, 189, 248, 0.06));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.action-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}
.action-text { font-size: 13px; color: var(--text); line-height: 1.55; }
.action-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--strong);
  font-weight: 700;
  margin-bottom: 3px;
}

/* ===== Possible cards ===== */
.deal-possible {
  border-left: 3px solid var(--possible);
  background: linear-gradient(180deg, var(--possible-bg) 0%, var(--card) 60px);
}
.deal-possible .deal-rank { color: var(--possible); }
.deal-possible .deal-name { font-size: 17px; }
.deal-possible .deal-head { padding: 14px 20px 12px; }
.deal-possible .deal-body { padding: 12px 20px 16px; gap: 10px; }

.field-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.55;
}
.field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--possible);
  font-weight: 700;
  flex-shrink: 0;
  min-width: 70px;
  padding-top: 1px;
}
.field-value { color: var(--text); }

/* ===== Near miss list ===== */
.near-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}
.near-list.collapsed { max-height: 0; opacity: 0; border: none; }
.near-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.4fr auto 2fr;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}
.near-row:last-child { border-bottom: none; }
.near-name { color: var(--text); font-weight: 500; }
.near-price { font-family: 'JetBrains Mono', monospace; color: var(--text-dim); font-size: 12px; }
.near-reason { color: var(--text-dim); font-size: 12px; line-height: 1.5; }

/* ===== Sources section ===== */
.sources-section { margin-top: 28px; }
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.source-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.source-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.source-detail { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

/* ===== Side panels ===== */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--card-2);
}
.panel-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
}
.panel-body {
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.panel-body p { margin: 0 0 12px; }
.panel-body p:last-child { margin-bottom: 0; }
.panel-body strong { color: var(--text); font-weight: 600; }

/* Criteria panel */
.criteria-panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.criteria-panel .panel-head h3 { display: flex; align-items: center; gap: 6px; }
.panel-edit {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--bg-2);
  transition: all 0.15s ease;
}
.panel-edit:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.criteria-body {
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}
.criteria-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}
.criteria-body blockquote {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.06);
  border-radius: 0 6px 6px 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}
.criteria-body blockquote p { margin: 0; }
.criteria-body h2 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.criteria-body h2:first-child { margin-top: 0; }
.criteria-body ul, .criteria-body ol {
  margin: 0 0 4px;
  padding-left: 18px;
}
.criteria-body li {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 3px;
}
.criteria-body li::marker { color: var(--text-dimmer); }
.criteria-body strong { color: var(--text); font-weight: 600; }
.criteria-body p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; color: var(--text); }

/* Checkable next steps */
.action-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  align-items: flex-start;
}
.action-item:last-child { border-bottom: none; padding-bottom: 0; }
.action-item:first-child { padding-top: 0; }
.action-check {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.action-item:hover .action-check { border-color: var(--strong); }
.action-item.checked .action-check { background: var(--strong); border-color: var(--strong); }
.action-item.checked .action-check::after { content: '✓'; color: white; font-size: 12px; font-weight: 700; }
.action-item.checked .action-text { color: var(--text-dim); text-decoration: line-through; text-decoration-color: var(--text-dimmer); }
.action-text { font-size: 13px; line-height: 1.5; }

/* ===== Kanban / Pipeline ===== */
.kanban {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 10px;
  margin-bottom: 8px;
  max-height: 700px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}
.kanban.collapsed { max-height: 0; opacity: 0; }
.kanban-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; flex-direction: column;
  min-height: 120px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.kanban-col.drag-over { background: var(--card-2); border-color: var(--strong); }
.kanban-col-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--text-dim);
}
.kanban-col-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dimmer);
  background: var(--card);
  padding: 1px 7px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.kanban-col-body {
  padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  flex: 1;
  min-height: 60px;
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: grab;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.kanban-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.kanban-card.dragging { opacity: 0.4; transform: scale(0.98); }
.kanban-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.kanban-card-meta {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.kanban-card-ask {
  font-family: 'JetBrains Mono', monospace;
  color: var(--strong);
  font-weight: 600;
}
.kanban-card-loc { color: var(--text-dim); }
.kanban-card-note {
  font-size: 11px;
  color: var(--text-dimmer);
  margin-top: 6px;
  line-height: 1.4;
  font-style: italic;
}
.kanban-col[data-stage="Passed"] .kanban-col-name { color: var(--near); }
.kanban-col[data-stage="Passed"] .kanban-card { opacity: 0.62; }
.kanban-col[data-stage="Passed"] .kanban-card:hover { opacity: 1; }
.kanban-col[data-stage="Passed"] .kanban-card-ask { color: var(--text-dim); }

/* ===== SBA Calculator ===== */
.calc-body {
  max-height: 800px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}
.calc-body.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.calc-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.calc-field { display: flex; flex-direction: column; gap: 4px; }
.calc-field span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.calc-field input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}
.calc-field input:focus { border-color: var(--accent); }
.calc-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.calc-results {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.calc-line {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 3px 0;
}
.calc-line .mono { color: var(--text); }
.calc-emph {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.calc-emph span:first-child { color: var(--text); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.dscr-good .mono { color: var(--strong); }
.dscr-mid  .mono { color: var(--possible); }
.dscr-bad  .mono { color: var(--danger); }

/* ===== Scan History ===== */
.history-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}
.history-list.collapsed { max-height: 0; opacity: 0; border: none; }
.history-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.history-row:last-child { border-bottom: none; }
.history-date {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-weight: 600;
}
.history-bar {
  display: flex;
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}
.history-seg { height: 100%; }
.seg-strong { background: var(--strong); }
.seg-possible { background: var(--possible); }
.seg-near { background: var(--near); }
.history-counts {
  display: flex; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  min-width: 80px;
  justify-content: flex-end;
}
.hc-strong { color: var(--strong); font-weight: 600; min-width: 18px; text-align: right; }
.hc-possible { color: var(--possible); min-width: 18px; text-align: right; }
.hc-near { color: var(--near); min-width: 18px; text-align: right; }
.history-note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
}

/* ===== Brokers ===== */
.brokers-body {
  max-height: 600px;
  overflow-y: auto;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
  padding: 0;
}
.brokers-body.collapsed { max-height: 0; opacity: 0; }
.broker-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.broker-row:last-child { border-bottom: none; }
.broker-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.broker-firm {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.broker-pill {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.rel-warm { background: rgba(34,197,94,0.12); color: var(--strong); border: 1px solid rgba(34,197,94,0.3); }
.rel-verified { background: rgba(56,189,248,0.12); color: var(--accent); border: 1px solid rgba(56,189,248,0.3); }
.rel-cold { background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--border-2); }
.broker-contact { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.broker-email { font-size: 11px; color: var(--accent); display: block; margin-bottom: 1px; }
.broker-phone {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
}
.broker-notes {
  font-size: 11px;
  color: var(--text-dimmer);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== Empty states ===== */
.empty {
  padding: 18px 20px;
  background: var(--card);
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.empty code { color: var(--text); }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dimmer);
}
.footer code { color: var(--text-dim); }

/* ===== Loading / Error ===== */
.loading, .error {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-dim);
  z-index: 100;
}
.error { color: var(--danger); border-color: var(--danger); max-width: 600px; }
.loading.hidden { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .col-side { position: static; max-height: none; }
  .stats-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .calc-row { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 720px) {
  .kanban { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 100px 1fr auto; }
  .topbar { padding: 14px 18px; flex-wrap: wrap; gap: 12px; }
  .meta { gap: 14px; }
  .grid { padding: 16px 18px 40px; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .deal-metrics { grid-template-columns: repeat(2, 1fr); }
  .sba-row { grid-template-columns: 1fr 1fr; }
  .dscr-cell { grid-column: span 2; }
  .score-bar { grid-template-columns: 80px 1fr 24px; }
  .deal-head { flex-direction: column; }
  .deal-badges { flex-direction: row; align-items: flex-start; }
  .near-row { grid-template-columns: 1fr; gap: 4px; }
}
