/* Slingshot — light "research desk".
   Refined, editorial-modern: warm paper, hairline rules, Fraunces + Hanken Grotesk,
   one evergreen accent, green/clay for movement. Discovery-first. */

:root {
  --paper:      #faf9f5;
  --paper-2:    #f3f1ea;
  --surface:    #ffffff;
  --ink:        #1b1a17;
  --ink-soft:   #57544c;
  --ink-faint:  #918d82;
  --line:       #e7e3d9;
  --line-2:     #d9d4c6;
  --accent:     #1f6f54;   /* evergreen */
  --accent-soft:#e8f1ec;
  --up:         #1f9d5b;
  --up-soft:    #e7f4ec;
  --down:       #c2553d;
  --down-soft:  #f7ebe6;
  --gold:       #a9791f;
  --gold-soft:  #f4ecda;
  --spike:      #b6822a;
  --spike-soft: #f4eddb;
  --shadow-sm:  0 1px 2px rgba(28,26,20,.05), 0 1px 3px rgba(28,26,20,.04);
  --shadow-md:  0 6px 24px rgba(28,26,20,.10), 0 2px 6px rgba(28,26,20,.05);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --r: 11px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
a { color: var(--accent); text-decoration: none; }

/* ── header ─────────────────────────────────────────────── */
header { border-bottom: 1px solid var(--line); background: rgba(250,249,245,.9); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30; }
.head-row { max-width: 1640px; margin: 0 auto; padding: 18px 28px; display: flex; align-items: baseline; gap: 16px; }
.brand h1 { font-family: var(--serif); font-weight: 500; font-size: 24px; letter-spacing: -.013em; margin: 0;
  font-optical-sizing: auto; display: flex; align-items: center; gap: 11px; }
.brand h1 .mark { height: 30px; width: auto; display: block; }
.brand .sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; letter-spacing: .01em; }
.head-spacer { flex: 1; }
.asof { font-size: 12px; color: var(--ink-soft); text-align: right; line-height: 1.4; align-self: center; }
.asof b { color: var(--ink); font-weight: 600; }
.asof .dim { color: var(--ink-faint); }
.btn { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 13px;
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow-sm); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.solid:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

main { max-width: 1640px; margin: 0 auto; padding: 24px 28px 90px; }

/* ── method deck ─────────────────────────────────────────── */
.deck { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.methods { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 3px; }
.methods button { font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  background: transparent; border: none; border-radius: 9px; padding: 9px 16px; cursor: pointer;
  transition: .15s; display: inline-flex; align-items: center; gap: 8px; }
.methods button .ic { font-size: 14px; }
.methods button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.methods button:not(.on):hover { color: var(--ink); }
.method-note { font-size: 12.5px; color: var(--ink-faint); max-width: 460px; line-height: 1.4; }

/* ── geo strip ──────────────────────────────────────────── */
.geo-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 14px; margin-bottom: 22px; }
.geo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 17px;
  position: relative; box-shadow: var(--shadow-sm); transition: .15s; }
.geo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.geo-card .mkt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.geo-card .mkt .flag { font-size: 17px; }
.geo-card.priority .mkt::after { content: "priority"; font-family: var(--sans); font-size: 9px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft);
  padding: 2px 6px; border-radius: 5px; margin-left: auto; }
.geo-card .big { font-family: var(--serif); font-weight: 560; font-size: 40px; line-height: 1; letter-spacing: -.02em;
  color: var(--accent); margin: 12px 0 3px; font-optical-sizing: auto; }
.geo-card .lbl { font-size: 11px; color: var(--ink-faint); }
.geo-card .top { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); }
.geo-card .top div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; gap: 8px; }
.geo-card .top .up { color: var(--up); font-weight: 600; }

/* ── filters ────────────────────────────────────────────── */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px;
  margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 13px 16px; box-shadow: var(--shadow-sm); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); font-weight: 700; }
select, input[type="text"], input[type="number"] { font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; min-width: 104px;
  outline: none; transition: .15s; }
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
input[type="text"] { min-width: 160px; }
input[type="number"] { width: 86px; min-width: 0; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: transparent;
  border: none; padding: 8px 12px; cursor: pointer; transition: .12s; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:not(.on):hover { color: var(--ink); background: var(--paper-2); }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 12.5px;
  color: var(--ink-soft); font-weight: 500; padding-bottom: 8px; }
.toggle input { display: none; }
.toggle .track { width: 36px; height: 20px; border-radius: 20px; background: var(--line-2); position: relative; transition: .15s; }
.toggle .track::after { content:""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: .15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.filter-spacer { flex: 1; }
.hideable.hidden { display: none; }

/* ── summary ────────────────────────────────────────────── */
.summary { display: flex; gap: 24px; align-items: center; margin: 6px 2px 14px; flex-wrap: wrap; }
.summary .stat { font-size: 12.5px; color: var(--ink-soft); }
.summary .stat b { color: var(--ink); font-size: 15px; font-weight: 700; }
.summary .c-up { color: var(--up); } .summary .c-new { color: var(--gold); }
.summary .info { margin-left: auto; font-size: 12px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 6px; }
.summary .info .q { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-2); display: inline-grid;
  place-items: center; font-size: 10px; color: var(--ink-faint); cursor: help; font-weight: 700; }

/* ── table ──────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 0; background: var(--paper-2); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .09em; font-weight: 700; color: var(--ink-faint); text-align: left; padding: 12px 14px;
  white-space: nowrap; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
thead th.r { text-align: right; }
thead th.no-sort { cursor: default; }
thead th:not(.no-sort):hover { color: var(--ink); }
thead th .arrow { color: var(--accent); }
thead th .hint { display: inline-block; margin-left: 5px; width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid var(--line-2); color: var(--ink-faint); font-size: 9px; line-height: 11px; text-align: center; cursor: help; }
tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--paper); }
td { padding: 12px 14px; vertical-align: middle; }
td.r { text-align: right; font-variant-numeric: tabular-nums; }
.app-cell { display: flex; align-items: center; gap: 11px; max-width: 340px; }
.app-cell .flag { font-size: 15px; }
.app-cell .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-cell .id { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trans { color: var(--ink-soft); font-size: 13px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trans.none { color: var(--line-2); }
.rank-now { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.zero { color: var(--ink-faint); }

.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 3px 8px;
  border-radius: 6px; text-transform: uppercase; white-space: nowrap; }
.badge.sustained { background: var(--up-soft); color: var(--up); }
.badge.spiking   { background: var(--spike-soft); color: var(--spike); }
.badge.fading    { background: var(--down-soft); color: var(--down); }
.badge.flat      { background: var(--paper-2); color: var(--ink-faint); }
.badge.new { background: var(--gold-soft); color: var(--gold); margin-left: 7px; }
.badge.off { background: var(--paper-2); color: var(--ink-faint); border: 1px dashed var(--line-2); margin-left: 7px; }
tr.row-off { opacity: .82; }
.search-note { color: var(--accent); font-weight: 600; }
.store-pill { font-size: 10.5px; color: var(--ink-soft); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.rating { display: inline-flex; align-items: baseline; gap: 6px; justify-content: flex-end; }
.rating .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.rating .rc { font-size: 10.5px; color: var(--ink-faint); }
.rating .none { color: var(--line-2); }

.scorebar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.scorebar .track { width: 56px; height: 6px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.scorebar .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.scorebar .v { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; min-width: 30px; text-align: right; }

.empty, .loading { padding: 64px 20px; text-align: center; color: var(--ink-faint); font-size: 13.5px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tooltips via title attr are native; custom bubble for column hints */
[data-tip] { position: relative; }

/* ── drawer ─────────────────────────────────────────────── */
.drawer-bg { position: fixed; inset: 0; background: rgba(27,26,23,.32); backdrop-filter: blur(2px); z-index: 40;
  opacity: 0; pointer-events: none; transition: .2s; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(720px, 95vw); background: var(--paper);
  border-left: 1px solid var(--line-2); box-shadow: var(--shadow-md); z-index: 41; transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--line); position: relative; }
.drawer-head .x { position: absolute; top: 18px; right: 20px; font-size: 24px; color: var(--ink-faint); cursor: pointer;
  line-height: 1; background: none; border: none; }
.drawer-head .x:hover { color: var(--ink); }
.drawer-head h2 { font-family: var(--serif); font-weight: 540; margin: 0 36px 3px 0; font-size: 24px; letter-spacing: -.01em; }
.drawer-head .en { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 8px; }
.drawer-head .meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; color: var(--ink-soft); font-size: 12.5px; }
.drawer-body { padding: 20px 26px 44px; overflow-y: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-bottom: 24px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; }
.metric .k { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 700; }
.metric .v { font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 700; margin-top: 4px; }
.metric .v.up { color: var(--up); } .metric .v.down { color: var(--down); }
.chart-box, .reviews-box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 22px; }
.chart-box h3, .reviews-box h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 4px; font-weight: 700; }
.chart-box .cap { font-size: 11.5px; color: var(--ink-faint); margin: 0 0 12px; }
/* Fixed-height, positioned wrapper so Chart.js (maintainAspectRatio:false) has a
   bounded box to fill — otherwise the canvas + container feed back and grow forever. */
.chart-canvas { position: relative; height: 260px; width: 100%; }
.chart-canvas > canvas { display: block; }
.review { border-bottom: 1px solid var(--line); padding: 12px 0; }
.review:last-child { border: none; }
.review .top { display: flex; gap: 9px; align-items: center; margin-bottom: 4px; }
.review .stars { font-size: 12px; letter-spacing: 1px; }
.review .star-on { color: var(--spike); } .review .star-off { color: var(--line-2); }
.review .rtitle { font-weight: 600; font-size: 13px; }
.review .rdate { font-size: 10.5px; color: var(--ink-faint); margin-left: auto; }
.review .rbody { font-size: 12.5px; color: var(--ink-soft); }
.muted-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 8px; }

/* ── investability filter row ───────────────────────────── */
.cfilters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px;
  margin: -4px 0 14px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; box-shadow: var(--shadow-sm); }
.cfilters.hidden { display: none; }
.cfilters-lead { font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent);
  font-weight: 800; align-self: center; padding-bottom: 8px; }
.cfilters .toggle { padding-bottom: 4px; }
.cfilters-cov { margin-left: auto; align-self: center; font-size: 12px; color: var(--ink-soft); padding-bottom: 4px; }
.cfilters-cov b { color: var(--ink); } .cfilters-cov .dim { color: var(--ink-faint); }
.cfilters-cov code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* ── company chip in the app cell ───────────────────────── */
.cochip { font-size: 11px; color: var(--ink-soft); margin-top: 3px; display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.cochip .codot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cochip .cost { color: var(--ink-faint); }
.q-confirm { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold); font-size: 9px; font-weight: 800; }

/* ── company column cell ────────────────────────────────── */
.cocell .conm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.cocell .cohq { color: var(--ink-faint); font-weight: 400; font-size: 11.5px; }
.cocell .cometa { display: flex; gap: 5px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.ibadge { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; }
.ibadge.tgt { background: var(--accent-soft); color: var(--accent); }
.ibadge.vb  { background: var(--paper-2); color: var(--ink-soft); }
.ibadge.raising { background: var(--gold-soft); color: var(--gold); }
.ibadge.pub { background: var(--down-soft); color: var(--down); }
.confirm-chip { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  border: 1px solid transparent; padding: 2px 7px; border-radius: 5px; cursor: pointer; }
.confirm-chip:hover { border-color: var(--accent); }

/* ── stage / crm pills + fit bar ────────────────────────── */
.stage-pill { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.stage-pill.early  { background: var(--accent-soft); color: var(--accent); }
.stage-pill.late   { background: var(--gold-soft); color: var(--gold); }
.stage-pill.public { background: var(--down-soft); color: var(--down); }
.stage-pill.exited { background: var(--paper-2); color: var(--ink-faint); }
.scorebar.fit .v { color: var(--ink); font-weight: 700; }
.crmcell { display: flex; gap: 7px; align-items: center; }
.crm-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; text-transform: capitalize; white-space: nowrap; }
.crm-pill.portfolio   { background: var(--gold-soft); color: var(--gold); }
.crm-pill.in_pipeline { background: var(--accent-soft); color: var(--accent); }
.crm-pill.prior_contact { background: var(--paper-2); color: var(--ink-soft); }
.warm { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }

/* ── drawer: company panel ──────────────────────────────── */
.cpanel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 22px; }
.cpanel > h3 { font-family: var(--serif); font-weight: 540; font-size: 17px; margin: 0 0 4px; letter-spacing: -.01em; }
.cpanel .cap { font-size: 11.5px; color: var(--ink-faint); margin: 2px 0 0; }
.cpanel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cpanel-head .legal { font-size: 11.5px; color: var(--ink-faint); }
.cbadges { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.match-confirm { display: flex; flex-direction: column; gap: 8px; background: var(--gold-soft); border: 1px solid #ecdfc0;
  border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #6b531a; margin: 10px 0; }
.match-confirm .mc-btns { display: flex; gap: 8px; }
.match-confirm .btn { padding: 6px 12px; font-size: 12px; }
.match-meta { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin: 8px 0 2px; }
.cdesc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; margin: 10px 0 14px; }
.cstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 16px; }
.cstat { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.cstat .k { font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 700; }
.cstat .v { font-size: 14px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cblock { margin-bottom: 14px; }
.cblk-h { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 700; margin-bottom: 7px; }
.cblk-h .dim { color: var(--line-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; background: var(--paper-2); color: var(--ink-soft); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.chip.soft { background: var(--accent-soft); color: var(--accent); }
.chip.more { color: var(--ink-faint); }
.chip.person { background: var(--paper); border: 1px solid var(--line-2); }
a.chip.person:hover { border-color: var(--accent); color: var(--accent); }
.cblock.crm .crm-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.crm-deal { font-size: 11.5px; color: var(--ink-soft); }
.intros { display: flex; flex-direction: column; gap: 6px; }
.intro { font-size: 12px; color: var(--ink-soft); display: flex; gap: 7px; align-items: center; }
.intro .who { font-weight: 600; color: var(--ink); }
.intro .rs { font-size: 9px; font-weight: 800; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; }
.intro .rs.strong { background: var(--up-soft); color: var(--up); }
.intro .rs.moderate { background: var(--gold-soft); color: var(--gold); }
.intro .rs.weak { background: var(--paper-2); color: var(--ink-faint); }
.clinks { display: flex; gap: 14px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }

@media (max-width: 720px) { .metric-grid, .cstats { grid-template-columns: repeat(2,1fr); } .head-row { flex-wrap: wrap; } }
