/* SAM opportunities (Ledger tables)                                   */
/* ------------------------------------------------------------------ */

.opportunity-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.opportunity-filter-panel .filter-keyword { grid-column: span 2; }
.opportunity-filter-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font: 600 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.opportunity-filter-panel input,
.opportunity-filter-panel select { width: 100%; min-width: 0; }
.opportunity-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}
.opportunity-filter-actions button { width: auto; white-space: nowrap; }
.ledger-table--filtered { min-width: 760px; table-layout: fixed; }
.ledger-table--filtered th:nth-child(1) { width: 8%; }
.ledger-table--filtered th:nth-child(2) { width: 30%; }
.ledger-table--filtered th:nth-child(3) { width: 13%; }
.ledger-table--filtered th:nth-child(4) { width: 20%; }
.ledger-table--filtered th:nth-child(5) { width: 12%; }
.ledger-table--filtered th:nth-child(6) { width: 12%; }
.ledger-table--filtered th:nth-child(7) { width: 5%; }
.ledger-table--filtered td small { display: block; color: var(--ink-3); margin-top: 3px; }
.ledger-table--hits td small { display: block; color: var(--ink-3); margin-top: 3px; }
.table-open { display: inline-grid; place-items: center; min-width: 30px; min-height: 30px; font-size: 18px; text-decoration: none; }

.sam-analysis-modes {
  display: block;
  gap: 18px;
  margin: 0 0 24px;
}
.sam-analysis-modes .panel { margin: 0; }
.sam-scan-card { border-top: 3px solid var(--line-strong); }
.sam-scan-card--full { border-top-color: var(--blue); }
.sam-scan-card h2 { margin: 4px 0 0; }
.sam-quick-score { display: flex; align-items: baseline; gap: 16px; margin: 10px 0 18px; }
.sam-quick-score strong { font: 600 42px var(--serif); }
.sam-quick-score strong small { font: 500 15px var(--mono); color: var(--ink-3); }
.sam-quick-score > span { color: var(--ink-2); }
.score-formula summary { cursor: pointer; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.score-components { display: grid; gap: 0; margin-top: 12px; border: 1px solid var(--line); }
.score-component {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.score-component:last-child { border-bottom: 0; }
.score-component span { font: 600 11px var(--mono); }
.score-component small { grid-column: 1 / -1; color: var(--ink-3); }
.score-component--unknown { opacity: .68; }
.score-component-details { grid-column: 1 / -1; margin-top: 5px; }
.score-component-details summary { cursor: pointer; font: 600 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.score-component-details p { margin: 7px 0 0; font-size: 12px; color: var(--ink-2); }
.full-analysis-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  align-items: center;
  margin: 0 0 24px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  background: var(--panel);
}
.full-analysis-action b,.full-analysis-action span { display: block; }
.full-analysis-action > div span { margin-top: 3px; color: var(--ink-2); font-size: 13px; }
.full-analysis-action .analysis-status { grid-column: 1 / -1; margin: 0; min-height: 0; }
.analysis-status { display: block; min-height: 18px; margin-top: 10px; color: var(--ink-2); font-size: 12px; }
.artifact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.data-sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.email-draft { white-space: pre-wrap; font: 400 14px/1.6 var(--sans); border: 1px solid var(--line); padding: 18px; background: var(--panel-hi); }
.email-copy-label { display: block; margin: 16px 0 7px; font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.email-copybox { width: 100%; min-height: 260px; resize: vertical; color: var(--ink); }
.back-link { display: inline-flex !important; align-items: center; width: auto !important; white-space: nowrap; }
.ledger-table--radar { table-layout: fixed; }
.ledger-table--radar th:nth-child(1) { width: 145px; }
.ledger-table--radar th:nth-child(2) { width: 32%; }
.ledger-table--radar th:nth-child(3) { width: 22%; }
.ledger-table--radar th:nth-child(5) { width: 105px; }
.ledger-table--radar th:nth-child(6) { width: 68px; }
.radar-due b,.radar-due small,.radar-title small,.radar-truncate b,.radar-truncate small { display: block; }
.radar-title,.radar-truncate { min-width: 0; overflow: hidden; }
.radar-title > a,.radar-truncate > b,.radar-truncate > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.radar-title small,.radar-truncate small,.radar-due small { margin-top: 4px; color: var(--ink-3); }
.clarification-questions { padding-left: 24px; }

/* dense Ledger data tables: 1px row rules, 2px header rule, no zebra */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 32px;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .opportunity-filter-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opportunity-filter-panel .filter-keyword { grid-column: span 2; }
}

@media (max-width: 760px) {
  .opportunity-filter-panel { grid-template-columns: 1fr 1fr; }
  .opportunity-filter-panel .filter-keyword { grid-column: 1 / -1; }
  .sam-analysis-modes { grid-template-columns: 1fr; }
  .data-sheet-grid { grid-template-columns: 1fr; }
  .full-analysis-action { grid-template-columns: 1fr; }
  .ledger-table--radar th:nth-child(4),.ledger-table--radar td:nth-child(4) { display: none; }
}

.ledger-table th {
  font: 600 10px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line-strong);
}

.ledger-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ledger-table tbody tr:last-child td { border-bottom: 0; }
.ledger-table tbody tr:hover { background: var(--panel-hi); }
.ledger-table .mono { font: 400 11px var(--mono); white-space: nowrap; }
.ledger-table .empty { color: var(--ink-3); font: 400 11px var(--mono); }

/* scroll safety net: a too-wide table scrolls inside its panel instead of
   pushing the panel past the viewport */
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll > .ledger-table { margin-bottom: 0; }
.panel > .table-scroll:last-child > .ledger-table,
.panel-details > .table-scroll:last-child > .ledger-table { margin-bottom: 0; }

/* opportunities hit ledger: fixed layout so the table always fits its panel.
   Columns without an explicit width class share the leftover space (title). */
.ledger-table--hits { table-layout: fixed; min-width: 760px; }
.ledger-table--hits .col-verdict { width: 7%; }
.ledger-table--hits .col-client { width: 12%; }
.ledger-table--hits .col-agency { width: 14%; }
.ledger-table--hits .col-due { width: 12%; }
.ledger-table--hits .col-fit { width: 10%; }
.ledger-table--hits .col-open { width: 6%; }

.ledger-table--hits th,
.ledger-table--hits td { overflow: hidden; }

/* long titles clip to one line with an ellipsis; the full title lives on the
   link's title attribute */
.ledger-table--hits .cell-title a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* mono client/product cells never stretch the row */
.ledger-table--hits .cell-clip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the agency column wraps on word boundaries inside its fixed width instead
   of squeezing into tall one-word lines */
.ledger-table--hits .cell-agency {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.4;
}

/* fit bar + score stay on one line inside their own column */
.ledger-table--hits .cell-fit { white-space: nowrap; }

/* the trailing Open link hugs its narrow column */
.ledger-table--hits .cell-open { white-space: nowrap; }

/* ETA urgency (oxblood text, meaning only) */
.eta-hot { color: var(--crit-ink); font-weight: 600; }

/* thin ink fit bar */
.fit-bar {
  display: inline-block;
  width: 56px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
}
.fit-bar i { display: block; height: 100%; background: var(--ink-fill); }

/* tiny ghost triage buttons */
.triage-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.triage-btn {
  border: 1px solid transparent;
  background: none;
  padding: 3px 8px;
  border-radius: 2px;
  font: 600 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
}
.triage-btn:hover { background: var(--panel-hi); color: var(--ink); border-color: var(--line-strong); }

/* detail page: triage panel + history */
.triage-panel { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.triage-state { display: flex; gap: 10px; align-items: baseline; margin: 8px 0 12px; }
.triage-panel input[type="text"] { flex: 1; min-width: 160px; width: auto; }
.triage-history { margin-top: 14px; }

/* detail page: client/product snapshot pills */
.snapshot-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }

/* verdict passes: boxed mono-header cards (SAM density) */
.verdict-pass {
  border: 1px solid var(--line);
  border-radius: 2px;
  margin: 0 0 12px;
  padding: 0 0 14px;
}

.verdict-pass-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font: 600 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.verdict-pass-head .fit-cell { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }

.verdict-reasoning { font: 400 14px var(--sans); line-height: 1.55; color: var(--ink); margin: 12px 14px 4px; }

.verdict-lists { margin: 8px 14px 0; }
.verdict-lists h4 {
  font: 600 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 10px 0 4px;
}
.verdict-lists ul { margin: 0; padding-left: 16px; font: 400 12px var(--mono); line-height: 1.6; }
.verdict-lists li { margin: 0 0 2px; }

/* concerns read as oxblood */
.concerns li { color: var(--crit-ink); }

/* mono numbered section headers (SAM density) */
.panel > header.sam-head { padding-top: 12px; padding-bottom: 12px; }
header.sam-head > span {
  font: 600 11px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}

/* collapsible sections get the same mono header language */
.section-details > summary.sam-summary {
  font: 600 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}
.section-details[open] > summary.sam-summary { margin: 0 0 14px; }

/* dense mono kv table (SAM contract / client sections) */
.kv { margin: 0; }
.kv > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.kv > div:last-child { border-bottom: 0; }
.kv dt {
  font: 600 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kv dd { margin: 0; font: 400 12px var(--mono); color: var(--ink); overflow-wrap: anywhere; }

/* mono description excerpt */
.excerpt {
  font: 400 12px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--ink-2);
}

/* compact stat strip on opportunities */
.stats--compact { margin: 0 0 32px; }


/* opportunity detail: consensus meta line above client/product data */
.run-meta { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }


/* sort/filter chip rows (operator, CRM) */
.filter-row { align-items: center; margin: 0 0 12px; }
.filter-label { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
