/* ==========================================================================
   ZillRadar · 1-Click Quick AI Insight & Local Sentiment Pulse Styles
   Strict Metronic v8.2.0 Demo 10 + Apple HIG 3-Layer Tonal Hierarchy
   Scoped strictly to #thread-quick-insight, #thread-sentiment-pulse,
   #research-quick-insight, and .bt-qi-*
   ========================================================================== */

/* --- 1. Feature-Catalog Context-Scoped Hiding (never leaks to /collect or tests) --- */
html[data-bt-feat-analysis-scope="off"] body[data-workspace-mode="analysis"] #discovery,
html[data-bt-feat-analysis-scope="off"] body[data-workspace-mode="analysis"] #discovery-form,
html[data-bt-feat-analysis-scope="off"] body[data-workspace-mode="analysis"] #bt-explore-template-btn,
html[data-bt-feat-analysis-scope="off"] body[data-workspace-mode="analysis"] #discovery > .bt-discovery-card-head,
html[data-bt-feat-analysis-scope="off"] body[data-workspace-mode="analysis"] #discovery .connection {
  display: none !important;
}

/* Enforce single Tier-A Primary Focal Zone per route on /explore when 1-Click Quick Insight is active */
body[data-workspace-mode="analysis"] #research-quick-insight:not([hidden]) ~ #discovery {
  background: var(--bt-d10-surface, #ffffff) !important;
  border: 1px solid var(--bt-d10-border, #dce3ee) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body[data-workspace-mode="analysis"] #research-quick-insight:not([hidden]) ~ #discovery {
  background: #1b1d2b !important;
  border-color: #2c3047 !important;
}

body[data-workspace-mode="analysis"] #research-quick-insight:not([hidden]) ~ #discovery > .bt-discovery-card-head {
  background: var(--bt-d10-card-head, #f8fafd) !important;
  border-bottom: 1px solid var(--bt-d10-border, #dce3ee) !important;
}

html[data-theme="dark"] body[data-workspace-mode="analysis"] #research-quick-insight:not([hidden]) ~ #discovery > .bt-discovery-card-head {
  background: var(--bt-d10-card-head, #212436) !important;
  border-bottom-color: var(--bt-d10-border, #2c3047) !important;
}

html[data-bt-feat-analysis-diagnostics="off"] #research-technical-diagnostics,
html[data-bt-feat-analysis-diagnostics="off"] .research-retrieval,
html[data-bt-feat-analysis-diagnostics="off"] .research-usage,
html[data-bt-feat-analysis-diagnostics="off"] .research-branch-coverage,
html[data-bt-feat-analysis-diagnostics="off"] #bt-explore-history-slot,
html[data-bt-feat-analysis-diagnostics="off"] #research-history {
  display: none !important;
}

html[data-bt-feat-analysis-playbook="off"] #research-answer-findings {
  display: none !important;
}

html[data-bt-feat-thread-quality="off"] #comment-quality,
html[data-bt-feat-thread-quality="off"] #thread-quality {
  display: none !important;
}

html[data-bt-feat-brand-advanced="off"] #brand-advanced-identity {
  display: none !important;
}

html[data-bt-feat-collect-advanced="off"] #collect-advanced-watch {
  display: none !important;
}

/* Only show #research-quick-insight and #research-issue-radar on /explore (analysis mode) */
body:not([data-workspace-mode="analysis"]) #research-quick-insight,
body:not([data-workspace-mode="analysis"]) #research-issue-radar {
  display: none !important;
}

/* --- 2. Thread Top Quick-Insight & Sentiment Pulse Stack --- */
.bt-thread-qi-zone {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.bt-thread-qi-zone:empty {
  display: none;
}

.bt-qi-card {
  background: var(--bt-d10-surface, #ffffff);
  border: 1px solid var(--bt-d10-border, #dce3ee);
  border-radius: 12px;
  overflow: hidden;
}

.bt-qi-card.bt-focal-primary-card {
  background: linear-gradient(180deg, #eaf3ff 0%, #f5f9ff 42%, #ffffff 100%);
  border: 2px solid #2563eb;
  box-shadow: 0 8px 22px -12px rgba(37, 99, 235, 0.28);
}

html[data-theme="dark"] .bt-qi-card.bt-focal-primary-card {
  background: linear-gradient(180deg, #162b4d 0%, #19243b 48%, #1b1d2b 100%);
  border-color: #3b82f6;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.55);
}

.bt-qi-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 14px 18px;
  background: var(--bt-d10-card-head, #f8fafd);
  border-bottom: 1px solid var(--bt-d10-border, #dce3ee);
}

.bt-qi-card-head > :first-child {
  flex: 1 1 300px;
}

.bt-qi-card-head > :last-child {
  flex-shrink: 0;
  margin-left: auto;
}

.bt-qi-card > .bt-qi-card-head:last-child {
  border-bottom: none;
}

.bt-qi-card.bt-focal-primary-card > .bt-qi-card-head {
  background: rgba(37, 99, 235, 0.06);
  border-bottom-color: rgba(37, 99, 235, 0.18);
}

html[data-theme="dark"] .bt-qi-card-head {
  background: var(--bt-d10-card-head, #212436);
  border-bottom-color: var(--bt-d10-border, #2c3047);
}

html[data-theme="dark"] .bt-qi-card.bt-focal-primary-card > .bt-qi-card-head {
  background: rgba(59, 130, 246, 0.12);
  border-bottom-color: rgba(59, 130, 246, 0.25);
}

.bt-qi-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.38;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-title {
  color: #f8fafc;
}

.bt-qi-subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
  letter-spacing: 0.004em;
  color: var(--bt-d10-muted, #475569);
}

html[data-theme="dark"] .bt-qi-subtitle {
  color: #b4bcd0;
}

.bt-qi-card-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --- 3. Local Sentiment Pulse (0 token) --- */
.bt-qi-pulse-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bt-qi-areas-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bt-qi-area-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border: 1px dashed var(--bt-d10-border, #dce3ee);
  color: var(--bt-d10-text, #071437);
  font-size: 12.5px;
  line-height: 1.35;
}

html[data-theme="dark"] .bt-qi-area-chip {
  background: #151724;
  border-color: #2c3047;
  color: #f8fafc;
}

.bt-qi-area-chip-role {
  font-size: 12px;
  color: var(--bt-d10-muted, #475569);
}

html[data-theme="dark"] .bt-qi-area-chip-role {
  color: #b4bcd0;
}

.bt-qi-signals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-qi-signal-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border-left: 3px solid #dc2626;
  min-width: 0;
}

.bt-qi-signal-item.is-mixed {
  border-left-color: #d97706;
}

html[data-theme="dark"] .bt-qi-signal-item {
  background: #151724;
}

.bt-qi-signal-quote {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--bt-d10-text, #071437);
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .bt-qi-signal-quote {
  color: #e2e8f0;
}

.bt-qi-signal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--bt-d10-muted, #475569);
}

html[data-theme="dark"] .bt-qi-signal-foot {
  color: #b4bcd0;
}

/* --- 4. Quick AI Insight Findings & Playbook Cards --- */
.bt-qi-overview-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border: 1px dashed var(--bt-d10-border, #dce3ee);
}

html[data-theme="dark"] .bt-qi-overview-box {
  background: #151724;
  border-color: #2c3047;
}

.bt-qi-findings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bt-qi-finding-card {
  background: var(--bt-d10-surface, #ffffff);
  border: 1px solid var(--bt-d10-border, #dce3ee);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.bt-qi-finding-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 20px -12px rgba(15, 23, 42, 0.16);
}

html[data-theme="dark"] .bt-qi-finding-card {
  background: #1b1d2b;
  border-color: #2c3047;
}

html[data-theme="dark"] .bt-qi-finding-card:hover {
  border-color: #3b4b75;
  box-shadow: 0 8px 22px -12px rgba(0, 0, 0, 0.55);
}

.bt-qi-finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 14px;
}

.bt-qi-finding-title-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 280px;
}

.bt-qi-finding-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.48;
  letter-spacing: -0.008em;
  color: var(--bt-d10-text, #071437);
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .bt-qi-finding-title {
  color: #f8fafc;
}

.bt-qi-summary-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 42px;
}

@media (max-width: 640px) {
  .bt-qi-summary-body {
    padding-left: 0;
  }
}

.bt-qi-conclusion-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
  letter-spacing: 0.005em;
  color: var(--bt-d10-text-secondary, #1e293b);
}

html[data-theme="dark"] .bt-qi-conclusion-text {
  color: #dce3f0;
}

.bt-qi-priority-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border-left: 3px solid #005fb8;
  font-size: 13.5px;
  line-height: 1.65;
  letter-spacing: 0.004em;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-priority-tip {
  background: #151724;
  border-left-color: #60a5fa;
  color: #f1f5f9;
}

.bt-qi-priority-tip-label {
  font-weight: 700;
  color: #005fb8;
  margin-right: 4px;
}

html[data-theme="dark"] .bt-qi-priority-tip-label {
  color: #93c5fd;
}

.bt-qi-location-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bt-qi-area-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e0ecff;
  color: #0b4db7;
}

html[data-theme="dark"] .bt-qi-area-badge {
  background: #1a335c;
  color: #93c5fd;
}

.bt-qi-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}

html[data-theme="dark"] .bt-qi-owner-badge {
  background: #25293e;
  color: #cbd5e1;
}

.bt-qi-quote-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bt-qi-quote {
  margin: 0;
  padding: 12px 15px;
  border-left: 3px solid #2563eb;
  border-radius: 0 10px 10px 0;
  background: var(--bt-d10-subtle, #f6f8fc);
  font-size: 13.5px;
  line-height: 1.68;
  letter-spacing: 0.004em;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-quote {
  background: #151724;
  border-left-color: #60a5fa;
  color: #e2e8f0;
}

.bt-qi-actions-well {
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  border-left: 3px solid #2563eb;
  background: var(--bt-d10-subtle, #f6f8fc);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-theme="dark"] .bt-qi-actions-well {
  background: #151724;
  border-left-color: #60a5fa;
}

.bt-qi-more-issues {
  border-radius: 9px;
  background: var(--bt-d10-subtle, #f6f8fc);
  padding: 10px 14px;
}

html[data-theme="dark"] .bt-qi-more-issues {
  background: #151724;
}

.bt-qi-more-issues-summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  color: #0b4db7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

html[data-theme="dark"] .bt-qi-more-issues-summary {
  color: #93c5fd;
}

.bt-qi-actions-ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-actions-ol {
  color: #e2e8f0;
}

.bt-qi-finding-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--bt-d10-border, #dce3ee);
}

html[data-theme="dark"] .bt-qi-finding-foot {
  border-top-color: #2c3047;
}

/* --- 5. /explore 1-Click Brand Quick Insight Focal Zone (#research-quick-insight) --- */
#research-quick-insight {
  margin-bottom: 16px;
}

.bt-explore-qi-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.bt-explore-qi-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 240px;
  min-width: 0;
}

.bt-explore-qi-field > label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bt-d10-text-secondary, #1e293b);
  margin: 0;
}

html[data-theme="dark"] .bt-explore-qi-field > label {
  color: #e2e8f0;
}

.bt-explore-qi-field select,
.bt-explore-qi-field input {
  min-height: 40px;
  border-radius: 9px;
}

.bt-explore-qi-cta {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.bt-qi-status-pill {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bt-d10-muted, #475569);
  margin: 0;
}

html[data-theme="dark"] .bt-qi-status-pill {
  color: #b4bcd0;
}

/* Primary button high-contrast AA enforcement in both themes */
.bt-qi-card .btn-primary,
#research-quick-insight .btn-primary {
  background-color: #005fb8 !important;
  border-color: #005fb8 !important;
  color: #ffffff !important;
}

.bt-qi-card .btn-primary:hover:not(:disabled),
#research-quick-insight .btn-primary:hover:not(:disabled) {
  background-color: #004c94 !important;
  border-color: #004c94 !important;
}

html[data-theme="dark"] .bt-qi-card .btn-primary,
html[data-theme="dark"] #research-quick-insight .btn-primary {
  background-color: #1d6fe2 !important;
  border-color: #1d6fe2 !important;
  color: #ffffff !important;
}

.bt-qi-card button.secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.bt-qi-card button.secondary:hover:not(:disabled) {
  border-color: #2563eb;
  background-color: #f8fafc;
  color: #0b4db7;
}

.bt-qi-card button.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

html[data-theme="dark"] .bt-qi-card button.secondary {
  background-color: #23273b;
  border-color: #363b54;
  color: #e2e8f0;
}

html[data-theme="dark"] .bt-qi-card button.secondary:hover:not(:disabled) {
  border-color: #60a5fa;
  background-color: #2b314b;
  color: #93c5fd;
}

/* Notice banner on /research when scheduled watch is in Advanced mode */
.bt-basic-advanced-notice {
  background: var(--bt-d10-surface, #ffffff);
  border: 1px dashed var(--bt-d10-border, #dce3ee);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

html[data-theme="dark"] .bt-basic-advanced-notice {
  background: #1b1d2b;
  border-color: #2c3047;
}

/* --- 6. Streamlined 3-KPI Radar, Compact Topic Filter Pills & Detail Modals --- */
#research-issue-radar {
  margin-bottom: 18px;
}

.bt-radar-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bt-radar-kpi-grid.is-four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bt-radar-kpi-tile {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border: 1px solid var(--bt-d10-border, #dce3ee);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

html[data-theme="dark"] .bt-radar-kpi-tile {
  background: #151724;
  border-color: #2c3047;
}

.bt-radar-kpi-num {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--bt-d10-text, #071437);
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .bt-radar-kpi-num {
  color: #f8fafc;
}

.bt-radar-kpi-label {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--bt-d10-muted, #475569);
  margin-top: 4px;
}

html[data-theme="dark"] .bt-radar-kpi-label {
  color: #b4bcd0;
}

.bt-aspect-pill-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bt-aspect-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.bt-aspect-tile {
  appearance: none;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border: 1px dashed var(--bt-d10-border, #dce3ee);
  color: var(--bt-d10-text, #071437);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.bt-aspect-pill-bar > button.bt-aspect-tile {
  width: auto !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border-style: solid;
  background: var(--bt-d10-surface, #ffffff);
  min-height: 40px;
}

button.bt-aspect-tile:hover,
button.bt-aspect-tile.is-active {
  border-style: solid;
  border-color: #2563eb;
  background: #eff6ff;
}

html[data-theme="dark"] .bt-aspect-tile,
html[data-bs-theme="dark"] .bt-aspect-tile {
  background: #151724;
  border-color: #2c3047;
  color: #f8fafc;
}

html[data-theme="dark"] .bt-aspect-pill-bar > button.bt-aspect-tile,
html[data-bs-theme="dark"] .bt-aspect-pill-bar > button.bt-aspect-tile {
  background: #1b1d2b;
  border-color: #363b54;
}

html[data-theme="dark"] button.bt-aspect-tile:hover,
html[data-theme="dark"] button.bt-aspect-tile.is-active,
html[data-bs-theme="dark"] button.bt-aspect-tile:hover,
html[data-bs-theme="dark"] button.bt-aspect-tile.is-active {
  border-color: #60a5fa;
  background: #172744;
}

/* Native <dialog> Detail Modals for Findings & Radar Metrics */
dialog.bt-qi-detail-dialog {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  width: min(780px, calc(100vw - 24px));
  max-width: 100%;
  max-height: min(88vh, 860px);
  overflow: visible;
  margin: auto;
}

dialog.bt-qi-detail-dialog::backdrop {
  background: rgba(7, 20, 55, 0.56);
  backdrop-filter: blur(2px);
}

.bt-qi-detail-box {
  background: var(--bt-d10-surface, #ffffff);
  color: var(--bt-d10-text, #071437);
  border: 1px solid var(--bt-d10-border, #dce3ee);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(7, 20, 55, 0.28);
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 860px);
  overflow: hidden;
}

html[data-theme="dark"] .bt-qi-detail-box,
html[data-bs-theme="dark"] .bt-qi-detail-box {
  background: #1b1d2b;
  color: #f8fafc;
  border-color: #2c3047;
}

.bt-qi-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  background: var(--bt-d10-card-head, #f8fafd);
  border-bottom: 1px solid var(--bt-d10-border, #dce3ee);
}

html[data-theme="dark"] .bt-qi-detail-head,
html[data-bs-theme="dark"] .bt-qi-detail-head {
  background: #212436;
  border-bottom-color: #2c3047;
}

.bt-qi-modal-close-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.bt-qi-modal-close-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #0b4db7;
}

.bt-qi-modal-close-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

html[data-theme="dark"] .bt-qi-modal-close-btn,
html[data-bs-theme="dark"] .bt-qi-modal-close-btn {
  background: #23273b;
  border-color: #363b54;
  color: #cbd5e1;
}

html[data-theme="dark"] .bt-qi-modal-close-btn:hover,
html[data-bs-theme="dark"] .bt-qi-modal-close-btn:hover {
  border-color: #60a5fa;
  background: #2b314b;
  color: #ffffff;
}

.bt-qi-detail-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.bt-qi-detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bt-qi-detail-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-detail-section-title,
html[data-bs-theme="dark"] .bt-qi-detail-section-title {
  color: #f8fafc;
}

.bt-qi-detail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px;
  background: var(--bt-d10-card-head, #f8fafd);
  border-top: 1px solid var(--bt-d10-border, #dce3ee);
}

html[data-theme="dark"] .bt-qi-detail-foot,
html[data-bs-theme="dark"] .bt-qi-detail-foot {
  background: #212436;
  border-top-color: #2c3047;
}

.bt-qi-detail-dialog button.secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.bt-qi-detail-dialog button.secondary:hover:not(:disabled) {
  border-color: #2563eb;
  background-color: #f8fafc;
  color: #0b4db7;
}

.bt-qi-detail-dialog button.secondary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

html[data-theme="dark"] .bt-qi-detail-dialog button.secondary,
html[data-bs-theme="dark"] .bt-qi-detail-dialog button.secondary {
  background-color: #23273b;
  border-color: #363b54;
  color: #e2e8f0;
}

html[data-theme="dark"] .bt-qi-detail-dialog button.secondary:hover:not(:disabled),
html[data-bs-theme="dark"] .bt-qi-detail-dialog button.secondary:hover:not(:disabled) {
  border-color: #60a5fa;
  background-color: #2b314b;
  color: #93c5fd;
}

.bt-qi-detail-dialog .btn-primary {
  background-color: #005fb8 !important;
  border-color: #005fb8 !important;
  color: #ffffff !important;
}

.bt-qi-detail-dialog .btn-primary:hover:not(:disabled) {
  background-color: #004c94 !important;
  border-color: #004c94 !important;
}

html[data-theme="dark"] .bt-qi-detail-dialog .btn-primary,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .btn-primary {
  background-color: #1d6fe2 !important;
  border-color: #1d6fe2 !important;
  color: #ffffff !important;
}

.bt-qi-detail-dialog .text-primary {
  color: #005fb8 !important;
}

html[data-theme="dark"] .bt-qi-detail-dialog .text-primary,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .text-primary {
  color: #7dd3fc !important;
}

.bt-qi-detail-dialog .badge-light-primary { background-color: #dbeafe !important; color: #0b4db7 !important; }
.bt-qi-detail-dialog .badge-light-info { background-color: #ede9fe !important; color: #5b21b6 !important; }
.bt-qi-detail-dialog .badge-light-warning { background-color: #fef3c7 !important; color: #854d0e !important; }
.bt-qi-detail-dialog .badge-light-danger { background-color: #fee2e2 !important; color: #991b1b !important; }
.bt-qi-detail-dialog .badge-light-success { background-color: #dcfce7 !important; color: #166534 !important; }
.bt-qi-detail-dialog .badge-light { background-color: #f1f5f9 !important; color: #334155 !important; }

html[data-theme="dark"] .bt-qi-detail-dialog .badge-light-primary,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light-primary { background-color: rgba(59, 130, 246, 0.22) !important; color: #93c5fd !important; }
html[data-theme="dark"] .bt-qi-detail-dialog .badge-light-info,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light-info { background-color: rgba(139, 92, 246, 0.22) !important; color: #c4b5fd !important; }
html[data-theme="dark"] .bt-qi-detail-dialog .badge-light-warning,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light-warning { background-color: rgba(245, 158, 11, 0.22) !important; color: #fde68a !important; }
html[data-theme="dark"] .bt-qi-detail-dialog .badge-light-danger,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light-danger { background-color: rgba(244, 63, 94, 0.22) !important; color: #fecaca !important; }
html[data-theme="dark"] .bt-qi-detail-dialog .badge-light-success,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light-success { background-color: rgba(34, 197, 94, 0.22) !important; color: #bbf7d0 !important; }
html[data-theme="dark"] .bt-qi-detail-dialog .badge-light,
html[data-bs-theme="dark"] .bt-qi-detail-dialog .badge-light { background-color: #26293e !important; color: #e2e8f0 !important; }

.bt-aspect-mini-bar {
  display: flex;
  height: 5px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

html[data-theme="dark"] .bt-aspect-mini-bar {
  background: #272b40;
}

.bt-qi-risk-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bt-qi-risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #fee2e2;
  color: #991b1b;
}

html[data-theme="dark"] .bt-qi-risk-pill {
  background: #451a1f;
  color: #fecaca;
}

.bt-qi-counter-quote {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid #15803d;
  border-radius: 0 8px 8px 0;
  background: var(--bt-d10-subtle, #f6f8fc);
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-counter-quote {
  background: #151724;
  border-left-color: #4ade80;
  color: #e2e8f0;
}

.bt-qi-workaround-well {
  padding: 9px 12px;
  border-radius: 8px;
  border-left: 3px solid #0284c7;
  background: var(--bt-d10-subtle, #f6f8fc);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--bt-d10-text, #071437);
}

html[data-theme="dark"] .bt-qi-workaround-well {
  background: #151724;
  border-left-color: #38bdf8;
  color: #e2e8f0;
}

.bt-hotspot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-hotspot-item {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--bt-d10-subtle, #f6f8fc);
  border: 1px dashed var(--bt-d10-border, #dce3ee);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

html[data-theme="dark"] .bt-hotspot-item {
  background: #151724;
  border-color: #2c3047;
}

.bt-hotspot-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.38;
  color: var(--bt-d10-text, #071437);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

html[data-theme="dark"] .bt-hotspot-title {
  color: #f8fafc;
}

/* --- 7. Responsive & Mobile >= 44px Hit Targets --- */
@media (max-width: 992px) {
  .bt-radar-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bt-hotspot-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .bt-qi-signals-grid,
  .bt-radar-kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .bt-qi-card-head,
  .bt-qi-card-body {
    padding: 13px 14px;
  }
}

@media (max-width: 640px) {
  .bt-qi-card button,
  .bt-qi-card a.btn,
  .bt-qi-card summary,
  .bt-qi-detail-dialog button,
  #research-quick-insight button,
  #research-quick-insight select,
  #research-quick-insight input,
  #research-issue-radar button,
  #research-issue-radar select,
  .bt-basic-advanced-notice button {
    min-height: 44px !important;
  }
  .bt-qi-card button.bt-icon-action-btn,
  .bt-qi-detail-dialog .bt-qi-modal-close-btn {
    min-width: 44px !important;
  }
  .bt-explore-qi-cta {
    width: 100%;
  }
}
