/* Local reliability pass: one authoritative layer after legacy overrides. */
:root {
  --truth-ink: #172033;
  --truth-muted: #667085;
  --truth-line: #e2e7ef;
  --truth-soft: #f7f9fc;
  --truth-blue: #3157d5;
  --truth-green: #158f63;
  --truth-amber: #a86406;
  --truth-red: #b42318;
}

/* Home: keep real-data state and analysis readable at the existing card size. */
#view-home .insight-panel .panel-head { align-items: flex-start; }
#view-home .insight-body { display: grid; gap: 12px; padding: 2px 20px 18px; }
.action-advice-head { display: grid; gap: 7px; }
.action-advice-head > strong { color: var(--truth-ink); font-size: 14px; line-height: 21px; }
.platform-advice-head > p { margin: 0; color: var(--truth-muted); font-size: 12px; line-height: 18px; }
.research-state,
.customer-research-state > span {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  color: var(--truth-muted);
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
}
.research-state::before,
.customer-research-state > span::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #98a2b3;
  content: "";
}
.research-state.is-verified,
.customer-research-state.is-verified > span { color: var(--truth-green); }
.research-state.is-verified::before,
.customer-research-state.is-verified > span::before { background: var(--truth-green); }
.research-state.is-researching,
.customer-research-state.is-researching > span { color: var(--truth-blue); }
.research-state.is-researching::before,
.customer-research-state.is-researching > span::before { background: var(--truth-blue); box-shadow: 0 0 0 4px rgba(49,87,213,.1); }
.research-state.is-no-result,
.customer-research-state.is-no-result > span { color: var(--truth-amber); }
.research-state.is-no-result::before,
.customer-research-state.is-no-result > span::before { background: var(--truth-amber); }
.action-advice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid var(--truth-line); border-radius: 9px; overflow: hidden; }
.action-advice-grid section { min-width: 0; padding: 10px 11px; background: #fff; }
.action-advice-grid section + section { border-left: 1px solid var(--truth-line); }
.action-advice-grid span { color: var(--truth-blue); font-size: 10px; line-height: 16px; font-weight: 700; }
.action-advice-grid p { display: -webkit-box; margin: 4px 0 0; overflow: hidden; color: #536174; font-size: 11px; line-height: 17px; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
#view-home .insight-evidence { padding: 9px 11px; border: 1px solid #e3e8f3; border-radius: 8px; box-shadow: none; background: #f8faff; }
#view-home .insight-evidence span { color: #65718a; }
#view-home .insight-evidence b { color: #536174; font-size: 10px; line-height: 16px; }

/* The right card never presents an unverified fallback as a researched conclusion. */
.customer-research-state { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; margin: 10px 0 4px; padding: 10px 11px; border: 1px solid var(--truth-line); border-radius: 9px; background: var(--truth-soft); }
.customer-research-state > span { grid-column: 1; }
.customer-research-state p { grid-column: 1/-1; margin: 0; color: var(--truth-muted); font-size: 11px; line-height: 18px; }
.customer-research-state small { grid-column: 2; grid-row: 1; color: var(--truth-muted); font-size: 10px; line-height: 18px; }
.customer-routing dl { display: grid; gap: 0; margin: 0; }
.customer-routing dl > div { display: grid; grid-template-columns: 74px minmax(0,1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--truth-line); }
.customer-routing dt { color: var(--truth-muted); font-size: 12px; line-height: 20px; }
.customer-routing dd { margin: 0; color: var(--truth-ink); font-size: 13px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.customer-routing > small { display: block; margin-top: 6px; color: var(--truth-muted); font-size: 11px; line-height: 18px; }

/* Customer detail: explicit research state, compact hierarchy, no false completeness. */
.detail-modal:not(.is-analytics) { width: min(1080px,calc(100vw - 36px)) !important; }
.detail-modal:not(.is-analytics) .detail-modal-card { height: min(760px,calc(100vh - 28px)) !important; min-height: 0 !important; padding: 20px 26px 14px !important; }
.detail-modal:not(.is-analytics) .detail-modal-card > #modalCustomerBody { display: flex !important; min-height: 0 !important; overflow-y: auto !important; flex: 1 1 auto !important; }
.detail-modal .detail-verification-note { margin: 9px 0 0; padding: 8px 11px; border: 1px solid #e6eaf0; border-radius: 8px; background: #fafbfc; color: var(--truth-muted); font-size: 12px; line-height: 19px; }
.detail-modal .detail-decision-grid { min-height: 190px; }
.detail-modal .detail-decision-grid > section { min-height: 0; }

/* Crawl details: the run total can never conceal a missing per-company ledger. */
.crawl-results-modal { width: min(900px,calc(100vw - 36px)) !important; }
.crawl-results-card { width: 100% !important; max-height: calc(100vh - 28px) !important; border-radius: 16px; background: #fff; overflow: hidden; }
.crawl-results-integrity { display: flex; gap: 10px; margin: 0 24px 12px; padding: 10px 12px; border: 1px solid #f3c7c2; border-radius: 9px; background: #fff5f4; color: var(--truth-red); font-size: 12px; line-height: 18px; }
.crawl-results-integrity[hidden] { display: none; }
.crawl-results-integrity strong { white-space: nowrap; }
.crawl-results-summary > div { min-width: 0; }
.crawl-results-head,
.crawl-result-row { grid-template-columns: minmax(180px,1.4fr) 105px minmax(180px,1.2fr) 135px 100px !important; }
.crawl-results-list { min-height: 230px !important; max-height: min(45vh,390px) !important; }
.crawl-results-empty { min-height: 230px; color: var(--truth-muted); }

@media (max-width: 800px) {
  .action-advice-grid { grid-template-columns: 1fr; }
  .action-advice-grid section + section { border-top: 1px solid var(--truth-line); border-left: 0; }
  .crawl-results-head { display: none; }
  .crawl-result-row { grid-template-columns: minmax(0,1fr) 84px !important; }
}

/* Home v5: the existing one-screen frame owns the height; content may never grow it. */
#view-home .insight-panel { overflow: hidden; }
#view-home .insight-panel .panel-head { min-height: 66px; padding-bottom: 10px; }
#view-home .insight-body {
  display: block;
  min-height: 0 !important;
  height: calc(100% - 66px);
  overflow: hidden !important;
  padding: 0 18px 14px;
}
.daily-advice-topic {
  display: flex;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 18px 0 10px;
  flex-direction: column;
  justify-content: flex-start;
}
.daily-advice-topic > strong {
  display: block;
  overflow: hidden;
  color: var(--truth-ink);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.daily-advice-topic > p {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--truth-muted);
  font-size: 14px !important;
  line-height: 22px !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

#view-home .home-customer-card { overflow: hidden !important; }
#view-home .home-customer-card .customer-content-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible !important;
  padding-right: 0;
}
#view-home .home-customer-card .customer-head h2 {
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#view-home .home-customer-card .customer-score { padding: 12px 0 8px; }
#view-home .home-customer-card .customer-score.is-review .score-grade { color: var(--truth-amber); }
#view-home .home-customer-card .score-meter { height: 5px; }
.home-customer-facts {
  display: grid;
  margin: 12px 0 0;
  grid-template-columns: repeat(2,minmax(0,1fr));
  border-block: 1px solid var(--truth-line);
}
.home-customer-facts > div { min-width: 0; padding: 9px 10px 9px 0; }
.home-customer-facts > div:nth-child(even) { padding-left: 10px; border-left: 1px solid var(--truth-line); }
.home-customer-facts > div:nth-child(n+3) { border-top: 1px solid var(--truth-line); }
.home-customer-facts dt { color: var(--truth-muted); font-size: 10px; line-height: 16px; }
.home-customer-facts dd {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--truth-ink);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-customer-decision,
.home-customer-next { padding: 11px 0 0; }
.home-customer-decision h3,
.home-customer-next h3 { margin: 0 0 4px; color: var(--truth-ink); font-size: 13px; line-height: 19px; }
.home-customer-decision p,
.home-customer-next p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--truth-muted);
  font-size: 11px;
  line-height: 18px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.home-customer-decision.is-review { margin-top: 10px; padding: 9px 10px; border-radius: 8px; background: var(--truth-soft); }
.home-customer-decision.is-review h3 { color: var(--truth-amber); }
#view-home .home-customer-card .customer-action-dock { margin-top: auto !important; }
#view-home .home-customer-card .pack-readiness-section { padding-top: 12px; padding-bottom: 8px; }
#view-home .home-customer-card .readiness.readiness-cards { margin-top: 8px; gap: 6px; }
#view-home .home-customer-card .readiness-card { min-height: 54px; padding: 8px; }
#view-home .home-customer-card .customer-footer { margin-top: 8px !important; padding-top: 10px; }

@media (max-width: 1180px) {
  #view-home .home-customer-card .customer-content-scroll { overflow: visible !important; }
}
