.opportunities {
  --opportunity-ink: #17324d;
  --opportunity-muted: #5b7187;
  --opportunity-line: #c7d9e8;
  --opportunity-blue: #1769aa;
  color: var(--opportunity-ink);
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.opportunities button,
.opportunities input,
.opportunities select,
.opportunities textarea { font: inherit; }

.opportunities button {
  background: #fff;
  border: 1px solid #95b5cf;
  border-radius: 8px;
  color: #164a73;
  cursor: pointer;
  min-height: 44px;
  padding: 8px 12px;
}

.opportunities button:hover:not(:disabled),
.opportunities button:focus-visible {
  background: #edf7ff;
  border-color: var(--opportunity-blue);
  outline: 3px solid rgba(23, 105, 170, .22);
  outline-offset: 1px;
}

.opportunities button:disabled { cursor: not-allowed; opacity: .55; }
.opportunity-primary { background: var(--opportunity-blue) !important; border-color: var(--opportunity-blue) !important; color: #fff !important; font-weight: 800; }
.opportunity-primary:hover:not(:disabled) { background: #0f568d !important; border-color: #0f568d !important; }

.opportunities-heading,
.opportunity-controls,
.opportunity-list,
.opportunity-detail,
.opportunity-form,
.opportunity-analysis,
.opportunity-state-card,
.opportunity-evidence,
.opportunity-linked-follow-ups,
.opportunity-history,
.opportunity-close-panel {
  background: #fff;
  border: 1px solid var(--opportunity-line);
  border-radius: 10px;
}

.opportunities-heading {
  align-items: center;
  background: linear-gradient(135deg, #eef9ff, #fff);
  border-top: 4px solid #247cb7;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 16px 18px;
}

.opportunities-heading p,
.opportunities-heading h3,
.opportunities-heading span,
.opportunity-form h4,
.opportunity-form p,
.opportunity-detail h4,
.opportunity-detail p,
.opportunity-analysis h4,
.opportunity-analysis p { margin: 0; }
.opportunities-heading p,
.opportunity-form header p,
.opportunity-detail header p,
.opportunity-analysis header p { color: #176093; font-size: 13px; font-weight: 800; }
.opportunities-heading h3 { color: #173e62; font-size: 24px; margin: 3px 0; }
.opportunities-heading span,
.opportunity-form header span,
.opportunity-detail header span,
.opportunity-analysis header span { color: var(--opportunity-muted); display: block; font-size: 13px; font-weight: 700; line-height: 1.5; margin-top: 4px; }
.opportunities-heading-actions,
.opportunity-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.opportunities-state,
.opportunities-error,
.opportunities-notice,
.opportunities-warning,
.opportunity-selected {
  border: 1px solid var(--opportunity-line);
  border-radius: 8px;
  line-height: 1.55;
  margin: 0;
  padding: 11px 13px;
}
.opportunities-state { background: #f5f9fc; color: #486278; font-weight: 700; }
.opportunities-error { background: #fff3f2; border-color: #e4aaa5; color: #8f281e; font-weight: 700; }
.opportunities-error button { margin-left: 8px; min-height: 36px; }
.opportunities-notice { background: #edf9f1; border-color: #9bcbb0; color: #155d38; font-weight: 800; }
.opportunities-warning { background: #fff8e9; border-color: #e4c576; color: #754900; font-weight: 700; }
.opportunity-selected { background: #f2f8fd; color: #355d7b; }

.opportunity-controls { display: grid; gap: 12px; padding: 12px; }
.opportunity-tabs { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opportunity-tabs button { font-weight: 800; }
.opportunity-tabs button.is-active { background: #dff1ff; border-color: #277caf; color: #124c78; }
.opportunity-filters,
.opportunity-form-grid { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.opportunity-filters label,
.opportunity-form label,
.opportunity-analysis > label,
.opportunity-close-panel label { color: #294a64; display: grid; font-size: 13px; font-weight: 800; gap: 5px; min-width: 0; }
.opportunities input,
.opportunities select,
.opportunities textarea { background: #fff; border: 1px solid #9dbad1; border-radius: 7px; box-sizing: border-box; color: #17324d; min-height: 42px; padding: 8px 10px; width: 100%; }
.opportunities textarea { min-height: 86px; resize: vertical; }
.opportunities input:focus-visible,
.opportunities select:focus-visible,
.opportunities textarea:focus-visible { border-color: var(--opportunity-blue); outline: 3px solid rgba(23, 105, 170, .2); }
.opportunity-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 13px; }
.opportunity-span-2 { grid-column: span 2; }

.opportunity-list { overflow: hidden; }
.opportunity-list-head,
.opportunity-row { align-items: center; display: grid; gap: 12px; grid-template-columns: minmax(200px, 1.25fr) minmax(95px, .6fr) minmax(240px, 1.6fr) minmax(135px, .75fr) 88px; }
.opportunity-list-head { background: #edf6fd; color: #174c76; font-size: 13px; font-weight: 800; padding: 10px 14px; }
.opportunity-row { border-top: 1px solid #d3e0ea; min-width: 0; padding: 12px 14px; }
.opportunity-row strong { color: #173e62; display: block; font-size: 16px; }
.opportunity-row span { color: var(--opportunity-muted); display: block; font-size: 13px; font-weight: 700; margin-top: 4px; }
.opportunity-row p { color: #344f65; line-height: 1.5; margin: 0; }
.opportunity-row p b { color: #173e62; }
.opportunity-suggestion-header { align-items: center; background: #edf6fd; color: #174c76; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
.opportunity-suggestion-header div { display: grid; gap: 5px; min-width: 0; }
.opportunity-suggestion-header strong { font-size: 18px; }
.opportunity-suggestion-header span { color: var(--opportunity-muted); font-size: 13px; }
.opportunity-suggestion-detail > .opportunity-row { align-items: start; grid-template-columns: minmax(0, 1fr) minmax(170px, .45fr); }
.opportunity-suggestion-detail > .opportunity-row footer { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }

.opportunity-detail,
.opportunity-form,
.opportunity-analysis { display: grid; gap: 14px; padding: 16px; }
.opportunity-detail > header,
.opportunity-form > header,
.opportunity-analysis > header,
.opportunity-linked-follow-ups > header { align-items: flex-start; border-bottom: 1px solid #d2dfe9; display: flex; gap: 13px; justify-content: space-between; padding-bottom: 13px; }
.opportunity-detail h4,
.opportunity-form h4,
.opportunity-analysis h4 { color: #173e62; font-size: 22px; margin-top: 3px; }
.opportunity-detail-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opportunity-detail-grid section { background: #f7fbfe; border: 1px solid #d2e0ec; border-radius: 8px; padding: 11px; }
.opportunity-detail-grid h5,
.opportunity-evidence h5,
.opportunity-linked-follow-ups h5,
.opportunity-analysis h5 { color: #174c76; font-size: 15px; margin: 0 0 7px; }
.opportunity-detail-grid p { color: #2d485d; line-height: 1.6; margin: 0; white-space: pre-wrap; }
.opportunity-close-panel { display: grid; gap: 10px; padding: 12px; }
.opportunity-close-panel button { justify-self: start; }

.opportunity-evidence,
.opportunity-linked-follow-ups,
.opportunity-history { display: grid; gap: 10px; padding: 12px; }
.opportunity-evidence > p,
.opportunity-linked-follow-ups header p { color: var(--opportunity-muted); font-size: 13px; margin: 0; }
.opportunity-evidence > article { background: #f7fbfe; border: 1px solid #d4e2ed; border-radius: 7px; display: grid; gap: 7px; padding: 10px; }
.opportunity-evidence > article > strong { color: #174c76; }
.opportunity-evidence > article > p { color: #314f65; line-height: 1.5; margin: 0; white-space: pre-wrap; }
.opportunity-evidence small { color: var(--opportunity-muted); }
.opportunity-evidence-option { align-items: center; grid-template-columns: minmax(0, 1fr) 130px; }
.opportunity-evidence-option label { align-items: flex-start; display: flex; font-weight: 600; line-height: 1.5; }
.opportunity-evidence-option input { flex: 0 0 auto; min-height: 18px; margin: 2px 8px 0 0; width: auto; }
.opportunity-evidence-option select { min-height: 40px; }
.opportunity-linked-follow-ups > article { border-left: 4px solid #8eb9d9; padding: 8px 10px; }
.opportunity-linked-follow-ups > article strong { color: #174c76; }
.opportunity-linked-follow-ups > article p { line-height: 1.5; margin: 5px 0; white-space: pre-wrap; }
.opportunity-linked-follow-ups > article small { color: var(--opportunity-muted); }
.opportunity-history ol { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.opportunity-history li { background: #f7fbfe; border: 1px solid #d2e0ec; border-radius: 7px; display: grid; gap: 5px; padding: 9px; }
.opportunity-history li span { color: var(--opportunity-muted); font-size: 13px; }
.opportunity-history li p { margin: 0; }
.opportunity-form footer { display: flex; justify-content: flex-end; }

.opportunity-candidates { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.opportunity-candidates button { text-align: left; }
.opportunity-analysis { background: #fbfdff; }
.opportunity-analysis-step,
.opportunity-analysis-group,
.opportunity-analysis-batches {
  background: #fff;
  border: 1px solid #cbdde9;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}
.opportunity-analysis-step h5,
.opportunity-analysis-group summary { color: #174c76; font-size: 16px; font-weight: 800; }
.opportunity-analysis-step > p { color: var(--opportunity-muted); line-height: 1.55; margin: 0; }
.opportunity-analysis-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.opportunity-analysis-mode button.is-active { background: #dff1ff; border-color: #277caf; color: #124c78; font-weight: 800; }
.opportunity-analysis-period { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opportunity-analysis-group > summary { cursor: pointer; }
.opportunity-analysis-group > p { color: #314f65; line-height: 1.55; margin: 0; }
.opportunity-analysis-group > article { background: #f7fbfe; border: 1px solid #d4e2ed; border-radius: 7px; display: grid; gap: 7px; padding: 10px; }
.opportunity-analysis-group > article > p { line-height: 1.55; margin: 0; white-space: pre-wrap; }
.opportunity-analysis-batches > summary { color: #174c76; cursor: pointer; font-weight: 800; }
.opportunity-analysis-batches > p { color: var(--opportunity-muted); line-height: 1.55; margin: 0; }
.opportunity-analysis-batches > article { background: #f7fbfe; border: 1px solid #d4e2ed; border-radius: 7px; display: grid; gap: 6px; padding: 10px; }
.opportunity-analysis-batches > article p { color: #314f65; margin: 0; }
.opportunity-analysis-fields { border: 1px solid #cedfe9; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0; padding: 10px; }
.opportunity-analysis-fields legend { color: #294a64; font-size: 13px; font-weight: 800; }
.opportunity-analysis-fields label { align-items: center; display: flex; font-size: 13px; font-weight: 600; }
.opportunity-analysis-fields input { min-height: 18px; margin-right: 6px; width: auto; }
.opportunity-selected-customers { display: flex; flex-wrap: wrap; gap: 8px; }
.opportunity-selected-customers span { align-items: center; background: #e8f5ff; border: 1px solid #b5d6eb; border-radius: 999px; display: inline-flex; gap: 5px; padding: 4px 5px 4px 10px; }
.opportunity-selected-customers button { min-height: 30px; padding: 3px 8px; }
.opportunity-analysis-preview { background: #f1f9ff; border: 1px solid #b9d6e9; border-radius: 8px; display: grid; gap: 9px; padding: 12px; }
.opportunity-analysis-preview p { margin: 0; }
.opportunity-analysis-preview article { background: #fff; border: 1px solid #d3e2ed; border-radius: 7px; padding: 10px; }
.opportunity-analysis-preview dl { display: grid; gap: 6px; margin: 8px 0 0; }
.opportunity-analysis-preview dl div { display: grid; gap: 7px; grid-template-columns: 120px minmax(0, 1fr); }
.opportunity-analysis-preview dt { color: var(--opportunity-muted); }
.opportunity-analysis-preview dd { display: grid; gap: 3px; margin: 0; }
.opportunity-analysis-follow-ups,
.opportunity-analysis-runs,
.opportunity-analysis-policy,
.opportunity-analysis-policy-editor,
.opportunity-evidence-pinned { border: 1px solid #cbdde9; border-radius: 8px; display: grid; gap: 10px; padding: 12px; }
.opportunity-analysis-follow-up { align-items: flex-start; display: flex; gap: 8px; line-height: 1.5; }
.opportunity-analysis-follow-up input,
.opportunity-policy-switch input { flex: 0 0 auto; min-height: 18px; margin: 2px 0 0; width: auto; }
.opportunity-analysis-pager { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.opportunity-analysis-pager span { color: var(--opportunity-muted); font-size: 13px; font-weight: 700; }
.opportunity-analysis-runs article,
.opportunity-analysis-policy > article { background: #f7fbfe; border: 1px solid #d2e0ec; border-radius: 7px; display: grid; gap: 7px; padding: 10px; }
.opportunity-analysis-runs article p,
.opportunity-analysis-policy > article p,
.opportunity-analysis-policy-editor p { margin: 0; }
.opportunity-analysis-policy {
  background: #fff;
  box-shadow: 0 16px 42px rgba(31, 68, 99, .24);
  max-height: calc(100vh - 32px);
  overflow: auto;
  position: fixed;
  right: 16px;
  top: 16px;
  width: min(660px, calc(100vw - 32px));
  z-index: 40;
}
.opportunity-analysis-policy > header { align-items: flex-start; display: flex; gap: 10px; justify-content: space-between; }
.opportunity-analysis-policy-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.opportunity-analysis-policy > header h5,
.opportunity-analysis-policy-editor h5 { color: #174c76; margin: 0 0 5px; }
.opportunity-policy-switch { align-items: center; display: flex !important; gap: 8px; }
.opportunity-policy-limits { display: grid; gap: 9px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opportunity-policy-limits label,
.opportunity-analysis-policy-editor > label { color: #294a64; display: grid; font-size: 13px; font-weight: 800; gap: 5px; }

@media (max-width: 760px) {
  .opportunities { gap: 10px; }
  .opportunities-heading,
  .opportunity-detail > header,
  .opportunity-form > header,
  .opportunity-analysis > header,
  .opportunity-linked-follow-ups > header { align-items: stretch; flex-direction: column; }
  .opportunities-heading { padding: 14px; }
  .opportunities-heading-actions { display: grid; grid-template-columns: 1fr; }
  .opportunities-heading-actions button { width: 100%; }
  .opportunity-tabs { grid-template-columns: 1fr; }
  .opportunity-filters,
  .opportunity-form-grid { grid-template-columns: 1fr; }
  .opportunity-span-2 { grid-column: auto; }
  .opportunity-list-head { display: none; }
  .opportunity-suggestion-header { align-items: stretch; gap: 8px; grid-template-columns: minmax(0, 1fr); }
  .opportunity-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .opportunity-suggestion-detail > .opportunity-row { grid-template-columns: minmax(0, 1fr); }
  .opportunity-suggestion-detail > .opportunity-row footer { display: grid; grid-template-columns: 1fr; }
  .opportunity-row button { width: 100%; }
  .opportunity-detail,
  .opportunity-form,
  .opportunity-analysis { padding: 13px; }
  .opportunity-detail-actions,
  .opportunity-form footer { display: grid; grid-template-columns: 1fr; }
  .opportunity-detail-actions button,
  .opportunity-form footer button { width: 100%; }
  .opportunity-detail-grid { grid-template-columns: 1fr; }
  .opportunity-evidence-option { grid-template-columns: 1fr; }
  .opportunity-analysis-preview dl div { grid-template-columns: 1fr; gap: 2px; }
  .opportunity-analysis-period { grid-template-columns: 1fr; }
  .opportunity-analysis-mode { display: grid; grid-template-columns: 1fr; }
  .opportunity-policy-limits { grid-template-columns: 1fr; }
  .opportunity-analysis-policy { max-height: calc(100vh - 16px); right: 8px; top: 8px; width: calc(100vw - 16px); }
  .opportunity-analysis-policy > header { align-items: stretch; flex-direction: column; }
  .opportunity-analysis-policy-actions { display: grid; grid-template-columns: 1fr; }
  .opportunity-analysis-pager { align-items: stretch; display: grid; grid-template-columns: 1fr; }
}
