/* ============================================================
   OPPORTUNITY INTELLIGENCE — animated demo (Optimization surface)
   Mounts into [data-opp-dash]. Timeline:
     1) KPIs count up (identified / realized / rate / in-execution)
     2) opportunity rows stream in (staggered), confidence dots set
     3) one accepted opportunity REALIZES — stage flips green, a
        REALIZED badge slides in, realized value + rate tick up
   Pre-renders to final state under reduced-motion / anim-off.
   ============================================================ */

.opp {
  --op-ink: #1f2733;
  --op-muted: #6b7280;
  --op-border: #E7E9F0;
  --op-blue: #2f72d4;
  --op-green: #2e9456;
  --op-amber: #b9791b;
  position: relative;
  display: flex; flex-direction: column;
  height: 100%; width: 100%;
  background: #fff; font-family: var(--font-body); color: var(--op-ink);
  overflow: hidden;
}

/* header */
.opp-top { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 6px 22px 2px; }
.opp-title { font-family: var(--font-head, inherit); font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.opp-views { margin-left: auto; display: flex; gap: 4px; background: #F2F3FA; border-radius: 9px; padding: 3px; }
.opp-view { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--op-muted); padding: 6px 11px; border-radius: 7px; white-space: nowrap; }
.opp-view svg { width: 14px; height: 14px; }
.opp-view.on { background: var(--op-blue); color: #fff; }
.opp-export { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 7px 12px; border: 1px solid var(--op-border); border-radius: 8px; }
.opp-export svg { width: 14px; height: 14px; }
.opp-sub { display: none; }

/* KPI cards */
.opp-kpis { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 4px 22px 8px; }
.opp-kpi { background: #F2F3FA; border-radius: 12px; padding: 5px 12px; }
.opp-kpi-l { font-weight: 700; font-size: 11px; }
.opp-kpi-n { margin-top: 2px; font-family: var(--font-head, inherit); font-weight: 700; font-size: 16px; letter-spacing: -.02em; }

/* table */
.opp-wrap { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; border-top: 1px solid var(--op-border); }
.opp-wrap::-webkit-scrollbar { width: 8px; }
.opp-wrap::-webkit-scrollbar-thumb { background: #d9dce6; border-radius: 8px; }
.opp-listhead { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 22px 2px; }
.opp-listhead b { font-family: var(--font-head, inherit); font-size: 12px; }
.opp-listhead span { font-size: 11.5px; color: var(--op-muted); }

.opp-head, .opp-row {
  display: grid;
  grid-template-columns: minmax(220px, 2.3fr) minmax(150px, 1.3fr) 112px 96px 92px;
  align-items: center; gap: 12px; padding: 0 22px;
}
.opp-head {
  position: sticky; top: 0; z-index: 2; background: #FAFAFD; height: 22px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: var(--op-muted);
  border-top: 1px solid var(--op-border); border-bottom: 1px solid var(--op-border);
}
.opp-head .r { text-align: right; }

.opp-row {
  min-height: 30px; padding-top: 1px; padding-bottom: 1px;
  border-bottom: 1px solid var(--op-border);
  opacity: 0; transform: translateY(8px);
  transition: opacity .42s var(--ease), transform .42s var(--ease), background .5s var(--ease);
}
.opp-row.in { opacity: 1; transform: none; }
html.anim-off .opp-row { opacity: 1; transform: none; transition: none; }
@keyframes oppRealizeFlash { 0% { background: rgba(46,148,86,.16); } 100% { background: transparent; } }
.opp-row.realize-flash { animation: oppRealizeFlash 1s var(--ease); }

.opp-oppt { min-width: 0; }
.opp-oppt-t { font-weight: 700; font-size: 12.5px; letter-spacing: -.01em; line-height: 1.15; }
.opp-oppt-d { margin-top: 0; font-size: 10.5px; color: var(--op-muted); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-sit { display: none; }
.opp-sit em { font-style: normal; color: var(--op-green); }

/* source chip */
.opp-src { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; min-width: 0; }
.opp-src svg { width: 15px; height: 15px; flex: 0 0 auto; }
.opp-src span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-src.warn { color: var(--op-amber); }
.opp-src.agent { color: #6b46e0; }
.opp-src.spark { color: var(--op-green); }
.opp-src.dollar { color: var(--op-green); }

/* stage pill */
.opp-stage { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 100px; white-space: nowrap; }
.opp-stage.detected { background: #EEF0F4; color: #5b6472; }
.opp-stage.accepted { background: #E7EEFB; color: #2f5fb0; }
.opp-stage.execution { background: #FBF0DD; color: #9a6a12; }
.opp-stage.realized { background: #E3F3E8; color: var(--op-green); }

/* confidence */
.opp-conf { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--op-ink); }
.opp-conf i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.opp-conf.hi i { background: var(--op-green); }
.opp-conf.mid i { background: #e0a01b; }

.opp-owner { font-size: 12.5px; color: var(--op-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.opp-val { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.opp-val-n { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.opp-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .06em; color: var(--op-green);
  background: #E3F3E8; border-radius: 5px; padding: 2px 6px;
  opacity: 0; transform: scale(.8); transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.opp-badge.show { opacity: 1; transform: none; }
html.anim-off .opp-badge { opacity: 1; transform: none; transition: none; }

@media (max-width: 760px) {
  .opp-kpis { grid-template-columns: 1fr 1fr; }
  .opp-views { display: none; }
  .opp-head, .opp-row { grid-template-columns: minmax(160px,2fr) 100px 92px; }
  .opp-head .h-src, .opp-row .opp-src { display: none; }
}
