/* ── Design Tokens ── */
:root {
  --navy: #0d1f3c;
  --navy-light: #162d54;
  --navy-mid: #1a3560;
  --gold: #c4a24d;
  --gold-light: #d4b560;
  --white: #ffffff;
  --bg: #f0f2f7;
  --surface: #ffffff;
  --border: #dde1ea;
  --text: #1a1f2e;
  --text-muted: #6b7280;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --sidebar-w: 220px;

  /* Stage colours */
  --stage-inbox: #6366f1;
  --stage-initial: #8b5cf6;
  --stage-diligence: #f59e0b;
  --stage-term: #f97316;
  --stage-loi: #10b981;
  --stage-closing: #059669;
  --stage-passed: #ef4444;
  --stage-portfolio: #0ea5e9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1120;
    --surface: #141c2e;
    --border: #253454;
    --text: #e8ecf4;
    --text-muted: #8899bb;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .75rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
label { font-size: .8rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: .3rem; }
textarea { resize: vertical; min-height: 80px; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--navy-mid);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.brand-badge {
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  font-size: .75rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  letter-spacing: .05em;
}

.brand-label {
  color: var(--white);
  font-weight: 600;
  font-size: .9rem;
}

.nav-links { list-style: none; padding: .75rem 0; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1rem;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  transition: all .15s;
}
.nav-link svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav-link.active { color: var(--gold); background: rgba(196,162,77,.1); border-right: 3px solid var(--gold); }

/* ── Nav group (Tools) ── */
.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem .4rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
.nav-group-label:hover { color: rgba(255,255,255,.55); }
.nav-group-label svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5;
  transition: transform .2s;
  flex-shrink: 0;
}
.nav-group-label.open svg { transform: rotate(90deg); }

.nav-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.nav-submenu.open { max-height: 400px; }
.nav-submenu .nav-link {
  padding-left: 2rem;
  font-size: .83rem;
}
.nav-submenu .nav-link svg { width: 14px; height: 14px; }

/* ── Main ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Page Header ── */
.page-header {
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.1rem; font-weight: 700; }
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Page Body ── */
.page-body { padding: 1.25rem 1.5rem; flex: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .875rem;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-light); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--navy); color: var(--text); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* ── Stats Row ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-num { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.stat-num.danger { color: #dc2626; }
.stat-num.warning { color: #d97706; }
.stat-num.success { color: #059669; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: .6rem .75rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(13,31,60,.03); }
.col-num { width: 48px; font-weight: 700; color: var(--text-muted); }

/* ── Stage Badge ── */
.stage-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
}
.stage-inbox    { background: #ede9fe; color: #4f46e5; }
.stage-initial  { background: #ede9fe; color: #7c3aed; }
.stage-diligence { background: #fef3c7; color: #92400e; }
.stage-term     { background: #ffedd5; color: #9a3412; }
.stage-loi      { background: #d1fae5; color: #065f46; }
.stage-closing  { background: #a7f3d0; color: #064e3b; }
.stage-passed   { background: #fee2e2; color: #991b1b; }
.stage-portfolio { background: #e0f2fe; color: #0c4a6e; }

/* ── Pipeline (Kanban) ── */
.kanban-board {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  align-items: flex-start;
  min-height: calc(100vh - 140px);
}
.kanban-col {
  min-width: 200px;
  width: 200px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
}
.kanban-col-header {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.kanban-col-body { overflow-y: auto; padding: .5rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem .75rem;
  cursor: pointer;
  transition: box-shadow .15s;
}
.deal-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.deal-card-num { font-size: .65rem; font-weight: 700; color: var(--text-muted); }
.deal-card-name { font-size: .8rem; font-weight: 700; margin: .15rem 0; line-height: 1.3; }
.deal-card-sector { font-size: .7rem; color: var(--text-muted); }
.deal-card-meta { display: flex; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }
.deal-card-due { font-size: .68rem; padding: .15rem .35rem; border-radius: 4px; }
.due-overdue { background: #fee2e2; color: #dc2626; }
.due-today    { background: #fef3c7; color: #92400e; }
.due-soon     { background: #f0fdf4; color: #166534; }
.deal-card-owner { font-size: .68rem; color: var(--text-muted); background: var(--bg); padding: .15rem .35rem; border-radius: 4px; }

/* ── Fund tabs (FACT I / FACT II) ── */
.fund-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.fund-tab:hover { color: var(--text); }
.fund-tab-active { color: var(--navy); border-bottom-color: var(--gold); }

/* ── Filters ── */
.filters-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filters-row input, .filters-row select { width: auto; min-width: 150px; }

/* ── Deal Detail ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-section { margin-bottom: 1.5rem; }
.detail-section h4 { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: .08em; margin-bottom: .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.field-group { display: flex; flex-direction: column; gap: .5rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ── Notes ── */
.notes-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; max-height: 250px; overflow-y: auto; }
.note-item { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .6rem; }
.note-text { font-size: .875rem; margin-bottom: .25rem; }
.note-meta { font-size: .7rem; color: var(--text-muted); }

/* ── Contacts ── */
.contacts-list { display: flex; flex-direction: column; gap: .5rem; }
.contact-item { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .6rem; display: flex; justify-content: space-between; align-items: flex-start; }
.contact-name { font-weight: 600; font-size: .875rem; }
.contact-meta { font-size: .75rem; color: var(--text-muted); }

/* ── Email Log ── */
.log-item { padding: .65rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font-size: .825rem; }
.log-header { display: flex; justify-content: space-between; margin-bottom: .25rem; }
.log-to { font-weight: 600; }
.log-time { font-size: .7rem; color: var(--text-muted); }
.log-subject { color: var(--text-muted); font-size: .78rem; }
.log-status { display: inline-block; font-size: .65rem; font-weight: 700; padding: .15rem .4rem; border-radius: 20px; }
.log-ok { background: #d1fae5; color: #065f46; }
.log-fail { background: #fee2e2; color: #991b1b; }

/* ── News / Intelligence ── */
.news-link:hover { color: var(--gold) !important; }

/* ── Investors ── */
.investor-type-badge { display:inline-block; font-size:.68rem; font-weight:700; padding:.15rem .5rem; border-radius:20px; }
.inv-private           { background:#ede9fe; color:#5b21b6; }
.inv-institutional     { background:#dbeafe; color:#1e40af; }
.inv-family-office     { background:#d1fae5; color:#065f46; }
.inv-venture-capital   { background:#fef3c7; color:#92400e; }
.inv-fund              { background:#fce7f3; color:#9d174d; }
.row-inactive td       { opacity:.5; }
.lead-dismissed        { opacity:.55; }

/* ── Template Editor ── */
.template-preview { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; font-size: .875rem; white-space: pre-wrap; word-break: break-word; min-height: 80px; }
.var-hints { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.var-hint { background: var(--navy); color: var(--gold); font-size: .7rem; padding: .2rem .45rem; border-radius: 4px; cursor: pointer; font-family: monospace; }
.var-hint:hover { background: var(--navy-light); }

/* ── Team cards ── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.team-card-name { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.team-card-role { font-size: .78rem; color: var(--gold); font-weight: 600; margin-bottom: .3rem; }
.team-card-email { font-size: .78rem; color: var(--text-muted); word-break: break-all; }

/* ── Dashboard ── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.stage-bar { display: flex; flex-direction: column; gap: .4rem; }
.stage-bar-row { display: flex; align-items: center; gap: .6rem; font-size: .8rem; }
.stage-bar-label { width: 130px; font-size: .78rem; color: var(--text-muted); flex-shrink: 0; }
.stage-bar-track { flex: 1; background: var(--bg); border-radius: 20px; height: 8px; }
.stage-bar-fill { background: var(--navy); border-radius: 20px; height: 8px; min-width: 4px; transition: width .3s; }
.stage-bar-count { width: 28px; text-align: right; font-weight: 700; color: var(--text); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { font-size: 1.4rem; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: .75rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }
.modal.modal-wide { max-width: 860px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: .5rem; z-index: 2000; }
.toast { padding: .65rem 1rem; border-radius: 8px; font-size: .875rem; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: slide-in .2s ease; max-width: 340px; }
.toast-success { background: #065f46; color: #fff; }
.toast-error { background: #991b1b; color: #fff; }
.toast-info { background: var(--navy); color: #fff; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Loading ── */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 1rem; color: var(--text-muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--navy); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ── Misc ── */
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: .75rem; stroke: var(--border); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .825rem; }
.gap-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.valuation-tag { font-size: .78rem; font-weight: 600; color: var(--gold); }
.material-tag { font-size: .7rem; background: #e0f2fe; color: #0c4a6e; padding: .15rem .4rem; border-radius: 4px; }
.overdue-indicator { color: #dc2626; font-weight: 700; }

/* ── Mobile Top Bar ── */
.mobile-topbar {
  display: none;
  background: var(--navy);
  padding: .6rem 1rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--navy-mid);
  position: sticky;
  top: 0;
  z-index: 300;
}
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: .4rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,.8);
  border-radius: 2px;
  transition: all .2s;
}
.hamburger:hover span { background: #fff; }

/* ── Sidebar Scrim (mobile overlay) ── */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 399;
}
.sidebar-scrim.open { display: block; }

/* ── Docs layout classes ── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 120px);
}
.docs-nav {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  height: calc(100vh - 120px);
  overflow-y: auto;
}

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  /* Show mobile top bar */
  .mobile-topbar { display: flex; }

  /* Sidebar becomes a slide-in overlay */
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w) - 8px);
    top: 0;
    bottom: 0;
    z-index: 400;
    transition: left .25s ease;
    min-height: 100dvh;
    overflow-y: auto;
  }
  .sidebar.mobile-open {
    left: 0;
    box-shadow: 6px 0 28px rgba(0,0,0,.4);
  }

  /* Tighter page spacing */
  .page-body { padding: .875rem; }
  .page-header { padding: .875rem 1rem; gap: .5rem; }
  .page-title { font-size: 1rem; }

  /* Stats: 2-column grid */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-bottom: .875rem; }
  .stat-num { font-size: 1.5rem; }

  /* Dashboard stacks to single column */
  .dash-grid { grid-template-columns: 1fr; }

  /* Stage bar labels — narrower */
  .stage-bar-label { width: 90px; font-size: .72rem; }

  /* Deal detail — single column */
  .detail-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  /* Kanban — slightly narrower cards */
  .kanban-col { min-width: 168px; width: 168px; }

  /* Filters — stack */
  .filters-row { flex-direction: column; }
  .filters-row input, .filters-row select { width: 100%; min-width: unset; }

  /* Team grid — single column */
  .team-grid { grid-template-columns: 1fr; }

  /* Modal — bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92dvh; width: 100%; max-width: 100%; }
  .modal.modal-wide { max-width: 100%; }

  /* Toast — full width */
  .toast-container { left: .75rem; right: .75rem; bottom: .75rem; }
  .toast { max-width: 100%; }

  /* Docs — stack nav above content */
  .docs-layout { grid-template-columns: 1fr; min-height: unset; }
  .docs-nav { position: static; height: auto; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-direction: row; flex-wrap: wrap; padding: .5rem; gap: .25rem; }
  .doc-nav-link { border-left: none !important; border-bottom: 2px solid transparent; padding: .35rem .6rem !important; font-size: .75rem !important; white-space: nowrap; }
  .doc-nav-link.active { border-bottom-color: var(--gold) !important; border-left-color: transparent !important; }

  /* Scorecard — stack buttons below label on mobile */
  .sc-row { flex-direction: column; gap: .4rem; }
  .sc-btn-group { flex-direction: row !important; }
}

/* ── Thesis Scorecard ── */

.sc-chip {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; padding: .2rem .6rem;
  border-radius: 20px; color: #fff; min-width: 40px;
  letter-spacing: .04em;
}
.sc-chip-high  { background: #15803d; }
.sc-chip-mid   { background: #b45309; }
.sc-chip-low   { background: #6b7280; }

/* Scorecard criteria rows (deal detail) */
.sc-criteria { display: flex; flex-direction: column; }

.sc-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.sc-row:last-child { border-bottom: none; }

.sc-row-left { flex: 1; min-width: 0; }

.sc-label {
  font-size: .8rem; font-weight: 600; color: var(--text);
  margin-bottom: .1rem;
}
.sc-desc {
  font-size: .7rem; color: var(--text-muted);
  line-height: 1.45; margin-bottom: .3rem;
}
.sc-notes-input {
  width: 100%; font-size: .72rem;
  padding: .22rem .4rem;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
}
.sc-notes-input:focus { outline: 1px solid var(--gold); outline-offset: -1px; }

.sc-btn-group {
  display: flex; flex-direction: column; gap: .25rem; flex-shrink: 0;
}

.sc-btn {
  font-size: .71rem; font-weight: 600;
  padding: .22rem .55rem; border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all .1s; white-space: nowrap;
}
.sc-btn:hover { border-color: var(--gold); color: var(--text); }
.sc-btn.active-pass   { background: #dcfce7; color: #15803d; border-color: #86efac; }
.sc-btn.active-flag   { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.sc-btn.active-unknown { background: var(--bg); color: var(--text-muted); border-color: var(--border); font-weight: 700; }

@media (prefers-color-scheme: dark) {
  .sc-btn.active-pass  { background: #14532d; color: #86efac; border-color: #16a34a; }
  .sc-btn.active-flag  { background: #78350f; color: #fcd34d; border-color: #d97706; }
}
:root[data-theme="dark"] .sc-btn.active-pass  { background: #14532d; color: #86efac; border-color: #16a34a; }
:root[data-theme="dark"] .sc-btn.active-flag  { background: #78350f; color: #fcd34d; border-color: #d97706; }

/* Cross-deal scorecard table */
.sc-table th, .sc-table td { vertical-align: middle; }
.sc-th {
  text-align: center; font-size: .68rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: .04em;
  padding: .5rem .35rem; width: 44px;
}
.sc-td { text-align: center; padding: .4rem .35rem; }

.sc-dot-pass, .sc-dot-flag, .sc-dot-unknown {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.sc-dot-pass    { background: #16a34a; }
.sc-dot-flag    { background: #d97706; }
.sc-dot-unknown { background: var(--border); }

/* ── Sign-fit badges (All Deals table + deal detail) ── */
.sign-fit-badge {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 4px; white-space: nowrap;
  letter-spacing: .03em;
}
.sign-fit-yes     { background: #dcfce7; color: #15803d; }
.sign-fit-at-risk { background: #fef3c7; color: #b45309; }
.sign-fit-no      { background: #fee2e2; color: #dc2626; }
@media (prefers-color-scheme: dark) {
  .sign-fit-yes     { background: #14532d; color: #86efac; }
  .sign-fit-at-risk { background: #78350f; color: #fcd34d; }
  .sign-fit-no      { background: #7f1d1d; color: #fca5a5; }
}
:root[data-theme="dark"] .sign-fit-yes     { background: #14532d; color: #86efac; }
:root[data-theme="dark"] .sign-fit-at-risk { background: #78350f; color: #fcd34d; }
:root[data-theme="dark"] .sign-fit-no      { background: #7f1d1d; color: #fca5a5; }

/* ── Decision Log ── */
.decision-entry {
  padding: .5rem .6rem;
  background: var(--bg); border-radius: 6px;
  border-left: 3px solid var(--border);
}

.decision-badge {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 4px; letter-spacing: .04em;
  text-transform: uppercase;
}
.decision-ranked       { background: #dcfce7; color: #15803d; border-left-color: #16a34a; }
.decision-passed       { background: #fee2e2; color: #dc2626; }
.decision-on-hold      { background: #fef3c7; color: #b45309; }
.decision-revived      { background: #ede9fe; color: #7c3aed; }
.decision-under-review { background: #e0f2fe; color: #0369a1; }

.decision-entry.decision-ranked       { border-left-color: #16a34a; }
.decision-entry.decision-passed       { border-left-color: #dc2626; }
.decision-entry.decision-on-hold      { border-left-color: #d97706; }
.decision-entry.decision-revived      { border-left-color: #7c3aed; }
.decision-entry.decision-under-review { border-left-color: #0369a1; }

@media (prefers-color-scheme: dark) {
  .decision-ranked       { background: #14532d; color: #86efac; }
  .decision-passed       { background: #7f1d1d; color: #fca5a5; }
  .decision-on-hold      { background: #78350f; color: #fcd34d; }
  .decision-revived      { background: #4c1d95; color: #c4b5fd; }
  .decision-under-review { background: #0c4a6e; color: #7dd3fc; }
}
:root[data-theme="dark"] .decision-ranked       { background: #14532d; color: #86efac; }
:root[data-theme="dark"] .decision-passed       { background: #7f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .decision-on-hold      { background: #78350f; color: #fcd34d; }
:root[data-theme="dark"] .decision-revived      { background: #4c1d95; color: #c4b5fd; }
:root[data-theme="dark"] .decision-under-review { background: #0c4a6e; color: #7dd3fc; }
