:root {
  --ink: #10120f;
  --muted: #686d66;
  --line: #dde0da;
  --paper: #f5f6f1;
  --panel: #ffffff;
  --acid: #c9ff3f;
  --acid-dark: #91be1d;
  --blue: #315cff;
  --orange: #ff6d36;
  --mono: "DM Mono", monospace;
  --sans: "Inter", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.workspace { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.workspace.sidebar-collapsed { grid-template-columns: 44px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px);
  border-right: 1px solid var(--line); padding: 30px 22px 24px; display: flex; flex-direction: column;
  background: #eef0ea; overflow: auto;
}
.sidebar-toggle {
  position: fixed; top: 87px; left: 235px; z-index: 25; display: grid; place-items: center;
  width: 34px; height: 36px; border: 1px solid #cfd4ca; border-radius: 4px;
  background: #fff; color: var(--ink); font-size: 25px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(16,18,15,.08);
}
.sidebar-toggle:hover { background: var(--acid); border-color: var(--ink); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.workspace.sidebar-collapsed .sidebar { padding: 0; overflow: visible; }
.workspace.sidebar-collapsed .sidebar > :not(.sidebar-toggle) { display: none; }
.workspace.sidebar-collapsed .sidebar-toggle { left: 27px; }
.category-nav { display: flex; flex-direction: column; gap: 2px; }
.category-button {
  width: 100%; display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center;
  border: 0; background: transparent; text-align: left; padding: 9px 10px; cursor: pointer; color: #42463f;
  border-radius: 3px;
}
.category-button:hover { background: rgba(255,255,255,.65); }
.category-button.active { background: var(--ink); color: white; }
.category-button .icon { font-size: 14px; filter: grayscale(1); }
.category-button small { color: #90958d; font: 10px var(--mono); }
.category-button.active small { color: var(--acid); }
.method-note { margin-top: auto; border-top: 1px solid #d5d8d1; padding-top: 16px; color: var(--muted); }
.method-note span { color: var(--ink); font-weight: 700; font-size: 11px; }
.method-note p { margin: 7px 0 0; font-size: 10px; line-height: 1.55; }

.content { min-width: 0; padding: 26px 28px 40px; }
.control-deck { display: flex; flex-direction: column; gap: 10px; }
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; height: 44px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 0 13px; outline: none; border-radius: 2px;
}
.search-wrap input { padding-left: 39px; padding-right: 42px; }
.search-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(49,92,255,.08); }
.search-icon { position: absolute; left: 14px; top: 10px; font-size: 19px; color: var(--muted); }
.search-wrap kbd { position: absolute; right: 12px; top: 11px; border: 1px solid var(--line); color: var(--muted); background: #f7f8f4; padding: 2px 7px; font: 11px var(--mono); }
.filter-groups { border: 1px solid var(--line); background: var(--panel); padding: 4px 12px; }
.filter-group { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; min-height: 37px; gap: 8px; }
.filter-group + .filter-group { border-top: 1px solid #eff0eb; }
.filter-label { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.filter-options { display: flex; align-items: center; gap: 5px; min-width: 0; overflow-x: auto; padding: 4px 0; scrollbar-width: thin; }
.lifecycle-filter-group .filter-options { flex-wrap: wrap; overflow-x: visible; }
.filter-button {
  flex: 0 0 auto; min-height: 28px; padding: 4px 10px; border: 1px solid transparent;
  border-radius: 2px; background: transparent; color: #555b52; font-size: 11px; cursor: pointer; white-space: nowrap;
}
.filter-button:hover { background: #eef1e8; color: var(--ink); }
.filter-button.active { border-color: var(--ink); background: var(--ink); color: var(--acid); font-weight: 700; }
.filter-count { margin-left: 4px; color: #8b9187; font: 10px var(--mono); }
.filter-button.active .filter-count { color: inherit; opacity: .72; }
.filter-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.filter-button[hidden] { display: none; }
.country-toggle { color: var(--blue); }

.ranking-head { margin: 20px 0 16px; }
.dataset-line { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 18px; color: var(--muted); font: 11px var(--mono); }
.dataset-line b { color: var(--ink); font-weight: 500; }
.metric-tabs { display: flex; gap: 5px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.metric-tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent; padding: 9px 13px;
  color: var(--muted); cursor: pointer; border-radius: 2px;
}
.metric-tab:hover { color: var(--ink); background: #fff; }
.metric-tab.active { color: var(--ink); border-color: var(--ink); background: var(--acid); font-weight: 700; }
.social-rank-note { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.table-shell { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 10px 34px rgba(31,36,27,.04); }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1020px; border-collapse: collapse; table-layout: fixed; }
th { height: 42px; padding: 0 12px; background: #eff1eb; border-bottom: 1px solid var(--line); color: #767b73; font: 500 10px var(--mono); text-align: left; text-transform: uppercase; letter-spacing: .05em; }
th.sortable { padding: 0; }
.sort-header { display: flex; align-items: center; justify-content: flex-start; gap: 5px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; background: transparent; color: inherit; font: inherit; text-align: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; white-space: nowrap; }
.sort-header:hover { background: #e5e9df; color: var(--ink); }
.sort-header.active { color: var(--ink); font-weight: 700; }
.sort-header:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.sort-arrow { color: #9ca39a; font-size: 11px; line-height: 1; }
.sort-header.active .sort-arrow { color: var(--blue); }
th.numeric .sort-header { justify-content: flex-end; }
th.rank-col .sort-header { justify-content: center; }
th:nth-child(2) { width: 29%; }
th:nth-child(3) { width: 105px; }
th:nth-child(n+4):nth-child(-n+8) { width: 112px; }
.rank-col { width: 60px; text-align: center; }
.action-col { width: 48px; }
.numeric { text-align: right; }
td { padding: 12px; border-bottom: 1px solid #eceee8; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .14s ease; }
tbody tr:hover { background: #fafcf4; }
tbody tr:last-child td { border-bottom: 0; }
.rank { text-align: center; color: #777c73; font: 500 12px var(--mono); }
.rank.top { color: var(--ink); font-size: 16px; font-weight: 700; }
.product-cell { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 12px; align-items: center; }
.product-avatar {
  position: relative; width: 90px; height: 74px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden;
  border: 1px solid #d8dbd3; border-radius: 6px; background: #f3f4ef; font: 500 10px var(--mono); color: #92998d;
}
.product-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.product-avatar.photo-cover img { object-fit: cover; }
.product-avatar img[hidden] { display: none; }
.product-avatar.has-photo { background: #fff; }
.product-avatar.has-photo .avatar-main { z-index: 1; }
.product-avatar.large { width: 100%; height: 210px; }
.drawer-identity { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--muted); font: 11px var(--mono); }
.drawer-identity.with-photo { display: grid; gap: 8px; }
.drawer-identity a { color: var(--blue); text-decoration: none; }
.product-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-badge { display: inline-block; margin-left: 5px; padding: 2px 4px; background: var(--acid); color: var(--ink); font: 700 9px var(--mono); vertical-align: 1px; }
.history-badge { display: inline-block; margin-left: 5px; padding: 2px 4px; background: #eef0e9; color: #60675d; font: 700 9px var(--mono); vertical-align: 1px; }
.company-name { margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-tagline { margin-top: 4px; color: #3f5b45; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-tagline { margin: 12px 0; color: #31543a; font-size: 16px; line-height: 1.55; font-weight: 600; }
.drawer-tagline a { margin-left: 7px; font-size: 11px; font-weight: 400; color: var(--blue); white-space: nowrap; }
.spec-section { margin: 22px 0; border: 1px solid var(--line); background: #fbfcf8; padding: 16px; }
.spec-section h4 { margin: 0 0 8px; font-size: 14px; }
.spec-section p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.spec-item { display: grid; grid-template-columns: 95px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.spec-item > span { color: var(--muted); }
.spec-item strong, .spec-item small { display: block; line-height: 1.5; }
.spec-item small { margin: 3px 0; color: var(--muted); }
.spec-item a { color: var(--blue); text-decoration: none; }
.tag { display: inline-flex; padding: 4px 7px; border-radius: 2px; background: #eef0e9; font-size: 10px; color: #565b53; }
.score-cell { text-align: right; }
.score-value { display: block; font: 600 14px var(--mono); }
.score-bar { display: block; width: 54px; height: 3px; background: #e8eae5; margin: 5px 0 0 auto; }
.score-bar i { display: block; height: 100%; background: var(--blue); }
.data-value { text-align: right; font: 12px var(--mono); }
.data-value.missing { color: #aeb2ab; }
.discovery-table th:nth-child(2) { width: 270px; }
.discovery-table th:nth-child(3) { width: 100px; }
.discovery-table th:nth-child(4) { width: 110px; }
.discovery-table th:nth-child(5) { width: 190px; }
.discovery-table th:nth-child(6) { width: 120px; }
.discovery-table th:nth-child(7) { width: 90px; }
.catalog-table th:nth-child(4) { width: 110px; }
.catalog-table th:nth-child(5) { width: 170px; }
.catalog-table th:nth-child(6) { width: 110px; }
.catalog-table th:nth-child(7) { width: 110px; }
.catalog-table th:nth-child(8) { width: 48px; }
.discovery-table .product-cell { grid-template-columns: 68px minmax(0, 1fr); gap: 10px; }
.discovery-table .product-avatar { width: 68px; height: 60px; }
.discovery-table .product-name { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.discovery-date { color: var(--ink); font: 12px var(--mono); }
.discovery-status { color: #52594e; font-size: 12px; }
.stage-badge { display:inline-block; padding:4px 7px; background:#eff4e3; color:#355219; font-size:11px; font-weight:600; white-space:nowrap; }
.stage-badge[data-stage="unknown"] { background:#fff1e7; color:#965229; }
.stage-badge[data-stage="closed"] { background:#e9e9e6; color:#555c57; }
.stage-badge[data-stage="enterprise"] { background:#e9eff8; color:#385576; }
.stage-badge[data-stage="announced"],.stage-badge[data-stage="waitlist"] { background:#eef0eb; color:#596258; }
.stage-evidence { display:block; margin-top:5px; color:#858c81; font-size:10px; }
.discovery-source a { color: var(--blue); font-size: 11px; text-decoration: none; }
.row-open { border: 0; background: transparent; font-size: 19px; cursor: pointer; color: #8c9188; }
.empty-state { min-height: 270px; place-items: center; align-content: center; gap: 6px; color: var(--muted); }
.empty-state:not([hidden]) { display: grid; }
.empty-state strong { color: var(--ink); font-size: 18px; }
.pagination { height: 52px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 18px; color: var(--muted); font: 11px var(--mono); }
.pagination button { width: 34px; height: 32px; border: 1px solid var(--line); background: white; cursor: pointer; }
.pagination button:disabled { opacity: .35; cursor: default; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(16,18,15,.34); backdrop-filter: blur(2px); }
.detail-drawer {
  position: fixed; z-index: 40; top: 0; right: 0; width: min(520px, 94vw); height: 100vh;
  padding: 32px; background: #fff; transform: translateX(102%); transition: transform .24s ease;
  box-shadow: -20px 0 60px rgba(16,18,15,.16); overflow-y: auto;
}
.detail-drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; right: 22px; top: 20px; width: 34px; height: 34px; border: 1px solid var(--line); background: white; font-size: 21px; cursor: pointer; }
.drawer-rank { font: 500 11px var(--mono); color: var(--blue); margin: 40px 0 10px; }
.drawer-title { font-size: 34px; letter-spacing: -.045em; line-height: 1.04; margin: 0 42px 8px 0; }
.drawer-company { color: var(--muted); margin-bottom: 22px; }
.drawer-summary { font-size: 16px; line-height: 1.65; margin: 0 0 26px; }
.drawer-score { background: var(--ink); color: white; padding: 20px; display: flex; justify-content: space-between; align-items: flex-end; }
.drawer-score strong { font: 600 38px var(--mono); color: var(--acid); }
.drawer-score small { color: #a8aea3; }
.discovery-callout { display: flex; flex-direction: column; gap: 5px; padding: 17px 20px; background: var(--ink); color: white; }
.discovery-callout strong { color: var(--acid); font: 700 13px var(--mono); }
.discovery-callout span { color: #cbd0c7; font-size: 11px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-bottom: 0; margin-top: 14px; }
.detail-item { min-height: 82px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-item:nth-child(even) { border-right: 0; }
.detail-item span { display: block; color: var(--muted); font: 10px var(--mono); margin-bottom: 9px; }
.detail-item strong { font-size: 14px; }
.social-section { margin-top: 24px; }
.social-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.social-section-head strong { font-size: 14px; }
.social-section-head span { color: var(--muted); font-size: 10px; text-align: right; }
.social-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); }
.social-card { min-width: 0; padding: 12px; border-right: 1px solid var(--line); }
.social-card:last-child { border-right: 0; }
.social-card > span { display: block; color: var(--muted); font: 10px var(--mono); margin-bottom: 8px; }
.social-card > strong { display: block; font: 600 16px var(--mono); margin-bottom: 7px; }
.social-card > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue); font-size: 11px; text-decoration: none; }
.social-card small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.social-card small a { color: var(--blue); text-decoration: none; }
.detail-links { display: flex; gap: 8px; margin-top: 20px; }
.detail-links a { flex: 1; padding: 12px; text-align: center; color: var(--ink); text-decoration: none; border: 1px solid var(--ink); font-weight: 700; }
.detail-links a:first-child { background: var(--acid); }
.coverage-note { margin-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 58px 10px 14px; }
  .sidebar-toggle, .workspace.sidebar-collapsed .sidebar-toggle { top: 82px; left: auto; right: 16px; }
  .workspace.sidebar-collapsed .sidebar { height: 48px; border-bottom: 1px solid var(--line); }
  .category-nav { flex-direction: row; overflow-x: auto; }
  .category-button { width: auto; min-width: max-content; grid-template-columns: auto 1fr auto; }
  .method-note { display: none; }
}
@media (max-width: 900px) {
  .sidebar-toggle, .workspace.sidebar-collapsed .sidebar-toggle { top: 107px; }
}
@media (max-width: 720px) {
  .workspace { min-height: calc(100vh - 100px); }
  .sidebar-toggle, .workspace.sidebar-collapsed .sidebar-toggle { top: 107px; }
  .content { padding: 20px 14px 32px; }
  .filter-groups { padding: 4px 9px; }
  .filter-group { grid-template-columns: 68px minmax(0, 1fr); gap: 5px; }
  .filter-label { font-size: 10px; }
  .ranking-head { margin: 18px 0 12px; }
  .dataset-line { gap: 12px; }
  .detail-drawer { padding: 24px 18px; }
}
